<commit_before>import React from 'react';
import ReactDOM from 'react-dom';
import {UIToggle} from 'ui/components/ui-toggle';
import EVENTS from 'api/constants/events';
import { Root } from 'ui/components/root';
import Frame from 'react-frame-component';
import injectTapEventPlugin from "react-tap-event-plugin";

import normalizeCss from 'normalize.css/normalize.css';
import flexboxGrid from 'flexboxgrid';
import reactSelect from 'react-select/dist/react-select.css';
import applicationCss from 'ui/assets/stylesheets/application.scss';

let appFrame;

const root = document.createElement('div');
root.style.position = 'fixed';
root.style.top = 0;
root.style.left = 0;
root.style.zIndex = 2147483646;

//Needed for onTouchTap
//Can go away when react 1.0 release
//Check this repo:
//https://github.com/zilverline/react-tap-event-plugin
injectTapEventPlugin();

function initFrame() {
  const initialPosition = __ENV === 'development' ? '0' : '-100%';

  Object.assign(appFrame.style, {
    visibility: 'visible',
    background: 'white',
    width: '100%',
    height: '100%',
    border: 0,
    bottom: 0,
    overflow: 'auto',
    position: 'fixed',
    top: initialPosition,
    transition: 'top .5s',
    zIndex: 2147483646
  });

  // get the react dev tools to be able to connect to the iframe
  const childDocument = appFrame.contentWindow.document;
  const script = childDocument.createElement('script');
  script.innerHTML = '__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__';
  script.type = 'text/javascript';
  childDocument.body.appendChild(script);

  const style = childDocument.createElement('style');
  style.innerHTML += normalizeCss.toString();
  style.innerHTML += flexboxGrid.toString();
  style.innerHTML += reactSelect.toString();
  style.innerHTML += applicationCss.toString();

  childDocument.head.appendChild(style);
}

function initUIToggle() {
  let uiToggle = document.createElement('div');

  ReactDOM.render(<UIToggle onToggle={ toggleUI }/>, uiToggle);

  document.body.appendChild(uiToggle);
}

function toggleUI() {
  const hidden = appFrame.style.top === '-100%';

  window.requestAnimationFrame(() => {
    appFrame.style.top = hidden ? '0' : '-100%';
  });<commit_msg>Disable react dev tools when not in development mode closes #103<commit_after>import React from 'react';
import ReactDOM from 'react-dom';
import {UIToggle} from 'ui/components/ui-toggle';
import EVENTS from 'api/constants/events';
import { Root } from 'ui/components/root';
import Frame from 'react-frame-component';
import injectTapEventPlugin from "react-tap-event-plugin";

import normalizeCss from 'normalize.css/normalize.css';
import flexboxGrid from 'flexboxgrid';
import reactSelect from 'react-select/dist/react-select.css';
import applicationCss from 'ui/assets/stylesheets/application.scss';

let appFrame;

const root = document.createElement('div');
root.style.position = 'fixed';
root.style.top = 0;
root.style.left = 0;
root.style.zIndex = 2147483646;

//Needed for onTouchTap
//Can go away when react 1.0 release
//Check this repo:
//https://github.com/zilverline/react-tap-event-plugin
injectTapEventPlugin();

function initFrame() {
  const initialPosition = __ENV === 'development' ? '0' : '-100%';

  Object.assign(appFrame.style, {
    visibility: 'visible',
    background: 'white',
    width: '100%',
    height: '100%',
    border: 0,
    bottom: 0,
    overflow: 'auto',
    position: 'fixed',
    top: initialPosition,
    transition: 'top .5s',
    zIndex: 2147483646
  });

  // get the react dev tools to be able to connect to the iframe
  const childDocument = appFrame.contentWindow.document;

  if (__ENV === 'development') {
    const script = childDocument.createElement('script');
    script.innerHTML = '__REACT_DEVTOOLS_GLOBAL_HOOK__ = parent.__REACT_DEVTOOLS_GLOBAL_HOOK__';
    script.type = 'text/javascript';
    childDocument.body.appendChild(script);
  }

  const style = childDocument.createElement('style');
  style.innerHTML += normalizeCss.toString();
  style.innerHTML += flexboxGrid.toString();
  style.innerHTML += reactSelect.toString();
  style.innerHTML += applicationCss.toString();

  childDocument.head.appendChild(style);
}

function initUIToggle() {
  let uiToggle = document.createElement('div');

  ReactDOM.render(<UIToggle onToggle={ toggleUI }/>, uiToggle);

  document.body.appendChild(uiToggle);
}

function toggleUI() {
  const hidden = appFrame.style.top === '-100%';

  window.requestAnimationFrame(() => {
    appFrame.style.top = hidden ? '0' : '-100%';
  });
{'fraction_non_alphanumeric': 0.13894367740521588, 'fraction_numerical': 0.019943019943019943, 'mean_word_length': 4.5931372549019605, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1724969', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1390, 'n_words': 337}