<commit_before>import React from "react";
import { render } from "react-dom";
import { Router, Route, Redirect, browserHistory, IndexRoute, applyRouterMiddleware } from "react-router";
import useScroll from 'react-router-scroll';
import ReactGA from 'react-ga';

// Components

import Header from "./components/header/header.jsx";
import Footer from "./components/footer/footer.jsx";

// Pages

import BlogList from "./pages/blog.jsx";
import BlogPost from "./pages/blog-post/blog-post.jsx";
import Home from "./pages/home/home.jsx";
import People from "./pages/people.jsx";
import Projects from "./pages/projects/projects.jsx";
import Project from "./pages/project-details/project-details.jsx";
import Resources from "./pages/resources/resources.jsx";
import StyleGuide from "./pages/style-guide.jsx";
import Events from "./pages/events.jsx";
import StudyGroups from "./pages/study-groups/study-groups.jsx";
import Fellowships from "./pages/fellowships/fellowships.jsx";
import Event from "./pages/event-details/event-details.jsx";
import CodeOfConduct from "./pages/code-of-conduct/code-of-conduct.jsx";

ReactGA.initialize(`UA-49796218-50`);

const App = React.createClass({
  render() {
    return (
      <div>
        <Header path={this.props.location.pathname}/>
        <div id="content-wrapper">
          <div id="content">
            {this.props.children}
          </div>
        </div>
        <Footer/>
      </div>
    );
  }
});

function logPageView(){
  var _dntStatus = navigator.doNotTrack || navigator.msDoNotTrack;
  var fxMatch = navigator.userAgent.match(/Firefox\/(\d+)/);
  var ie10Match = navigator.userAgent.match(/MSIE 10/i);
  var w8Match = navigator.appVersion.match(/Windows NT 6.2/);

  if (fxMatch && Number(fxMatch[1]) < 32) {
    _dntStatus = `Unspecified`;
  } else if (ie10Match && w8Match) {
    _dntStatus = `Unspecified`;
  } else {
    _dntStatus = { '0': `Disabled`, '1': `Enabled` }[_dntStatus] || `Unspecified`;
  }

  if (_dntStatus !== `Enabled`){
    if(window.location.host === `science.mozilla.org`){
      ReactGA.set({ page: window.location.pathname });
      ReactGA.pageview(window.location.pathname);
    }
  }
}

render((
  <Router history={browserHistory} onUpdate={logPageView} render={applyRouterMiddleware(useScroll())}>
    <Route path="/" component={App}>
      <IndexRoute component={Home}/>
      <Route path="blog" component={BlogList}/>
      <Route path="blog/:slug" component={BlogPost}/>
      <Route path="people" component={People}/>
      <Route path="projects" component={Projects} >
        // https://github.com/mozilla/science.mozilla.org/issues/425#issuecomment-221339156
        <Redirect from="jstirnaman-openMetaAnalysis.github.io" to="openMetaAnalysis" />
      </Route>
      <Route path="projects/:id" component={Project} />
      <Route path="programs/events/:id" component={Event}>
        <Route path=":tab" component={Event}/>
      </Route>
      <Route path="programs/events" component={Events} />
      <Route path="programs/fellowships" component={Fellowships}>
        <Route path=":tab" component={Fellowships} />
      </Route>
      <Route path="programs/studygroups" component={StudyGroups}>
        <Route path=":tab" component={StudyGroups} />
      </Route>
      <Route path="resources" component={Resources}/>
      <Route path="style-guide" component={StyleGuide}/>
      <Route path="code-of-conduct" component={CodeOfConduct}/>

      // Redirect old Science site URLs
      <Redirect from="training" to="resources" />
      <Redirect from="community" to="programs/events" />
      <Redirect from="collaborate" to="projects" />
      <Redirect from="about" to="/" />
      <Redirect from="u/:membername" to="/" />
      <Redirect from="programs" to="/" />
      <Redirect from="fellows" to="programs/fellowships" />
      <Redirect from="fellows/2015" to="programs/fellowships" />
      <Redirect from="training" to="programs" />
<commit_msg>Fix MozillaFoundation/mofo-devops#487 - Redirect Global Sprint 2017 to github page (#621)<commit_after>import React from "react";
import { render } from "react-dom";
import { Router, Route, Redirect, browserHistory, IndexRoute, applyRouterMiddleware } from "react-router";
import useScroll from 'react-router-scroll';
import ReactGA from 'react-ga';

// Components

import Header from "./components/header/header.jsx";
import Footer from "./components/footer/footer.jsx";

// Pages

import BlogList from "./pages/blog.jsx";
import BlogPost from "./pages/blog-post/blog-post.jsx";
import Home from "./pages/home/home.jsx";
import People from "./pages/people.jsx";
import Projects from "./pages/projects/projects.jsx";
import Project from "./pages/project-details/project-details.jsx";
import Resources from "./pages/resources/resources.jsx";
import StyleGuide from "./pages/style-guide.jsx";
import Events from "./pages/events.jsx";
import StudyGroups from "./pages/study-groups/study-groups.jsx";
import Fellowships from "./pages/fellowships/fellowships.jsx";
import Event from "./pages/event-details/event-details.jsx";
import CodeOfConduct from "./pages/code-of-conduct/code-of-conduct.jsx";

ReactGA.initialize(`UA-49796218-50`);

const App = React.createClass({
  render() {
    return (
      <div>
        <Header path={this.props.location.pathname}/>
        <div id="content-wrapper">
          <div id="content">
            {this.props.children}
          </div>
        </div>
        <Footer/>
      </div>
    );
  }
});

function logPageView(){
  var _dntStatus = navigator.doNotTrack || navigator.msDoNotTrack;
  var fxMatch = navigator.userAgent.match(/Firefox\/(\d+)/);
  var ie10Match = navigator.userAgent.match(/MSIE 10/i);
  var w8Match = navigator.appVersion.match(/Windows NT 6.2/);

  if (fxMatch && Number(fxMatch[1]) < 32) {
    _dntStatus = `Unspecified`;
  } else if (ie10Match && w8Match) {
    _dntStatus = `Unspecified`;
  } else {
    _dntStatus = { '0': `Disabled`, '1': `Enabled` }[_dntStatus] || `Unspecified`;
  }

  if (_dntStatus !== `Enabled`){
    if(window.location.host === `science.mozilla.org`){
      ReactGA.set({ page: window.location.pathname });
      ReactGA.pageview(window.location.pathname);
    }
  }
}

render((
  <Router history={browserHistory} onUpdate={logPageView} render={applyRouterMiddleware(useScroll())}>
    <Route path="/" component={App}>
      <IndexRoute component={Home}/>
      <Route path="blog" component={BlogList}/>
      <Route path="blog/:slug" component={BlogPost}/>
      <Route path="people" component={People}/>
      <Route path="projects" component={Projects} >
        // https://github.com/mozilla/science.mozilla.org/issues/425#issuecomment-221339156
        <Redirect from="jstirnaman-openMetaAnalysis.github.io" to="openMetaAnalysis" />
      </Route>
      <Route path="projects/:id" component={Project} />
      <Route path="programs/events/global-sprint-2017" onEnter={() => { window.location.href = `https://mozilla.github.io/global-sprint`; }} />
      <Route path="programs/events/:id" component={Event}>
        <Route path=":tab" component={Event}/>
      </Route>
      <Route path="programs/events" component={Events} />
      <Route path="programs/fellowships" component={Fellowships}>
        <Route path=":tab" component={Fellowships} />
      </Route>
      <Route path="programs/studygroups" component={StudyGroups}>
        <Route path=":tab" component={StudyGroups} />
      </Route>
      <Route path="resources" component={Resources}/>
      <Route path="style-guide" component={StyleGuide}/>
      <Route path="code-of-conduct" component={CodeOfConduct}/>

      // Redirect old Science site URLs
      <Redirect from="training" to="resources" />
      <Redirect from="community" to="programs/events" />
      <Redirect from="collaborate" to="projects" />
      <Redirect from="about" to="/" />
      <Redirect from="u/:membername" to="/" />
      <Redirect from="programs" to="/" />
      <Redirect from="fellows" to="programs/fellowships" />
      <Redirect from="fellows/2015" to="programs/fellowships" />
      <Redirect from="training" to="programs" />

{'fraction_non_alphanumeric': 0.16748829184126202, 'fraction_numerical': 0.011831402514173034, 'mean_word_length': 3.6134167140420694, 'pattern_counts': {'":': 6, '<': 86, '<?xml version=': 0, '>': 85, 'https://': 3, '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': '721019', 'n_tokens_mistral': 2601, 'n_tokens_neox': 2508, 'n_words': 508}