<commit_before>/*global document, window, location */
'use strict';
var _ = require('lodash');
var $ = require('jquery');
var React = require('react/addons');
var Router = require('react-router');

var ContactOverlay = require('./ContactOverlay');
var MenuOverlay = require('./MenuOverlay');
var Collections = require('./Collections');

var PictureFill;
var FastClick;

try {
  PictureFill = require('picturefill');
  FastClick = require('fastclick');
} catch (e) {
  if (! e instanceof ReferenceError)
    throw e;
}

var RESPONSIVE_BREAKPOINT = 800;

var Layout = React.createClass({
  getInitialState: function() {
    return {
      menuOpen: false,
      contactOpen: false,
      small: false
    }
  },
  
  componentWillMount: function() {
    if (typeof location !== 'undefined' && location.hash === '#contact') {
      this.setState({contactOpen: true});
    }
  },
  
  componentDidMount: function() {
    // need to bind this at a higher level
    $(document).on('keydown', this.handleKeyDown);

    $(window).on('resize', this.handleWindowResize);

    FastClick.attach(document.body);

    this.pictureFill();
  },
  
  componentWillUnmount: function() {
    $(document).off('keydown', this.handleKeyDown);
    $(window).off('resize', this.handleWindowResize);
  },
  
  openMenu: function(state) {
    this.setState({menuOpen: state});
  },
  
  openContact: function(state) {
    this.setState({contactOpen: state});
    location.hash = state ? 'contact' : '';
  },
  
  handleKeyDown: function(event) {
    if (event.which == 27) { // esc closes everything
      if ( $('input, textarea').is(':focus')) {
        return ; // input or textarea is focused, ignore other part of function
      }
      this.openContact(false);
      this.openMenu(false);
    }
  },
  
  handleWindowResize: function() {
    this.setState({
      small: $(window).width() <= RESPONSIVE_BREAKPOINT
    });
  },
  
  componentWillReceiveProps: function(nextProps) {
    if (nextProps.params)
      this.pictureFill();
  },
  <commit_msg>Set small on startup. #34<commit_after>/*global document, window, location */
'use strict';
var _ = require('lodash');
var $ = require('jquery');
var React = require('react/addons');
var Router = require('react-router');

var ContactOverlay = require('./ContactOverlay');
var MenuOverlay = require('./MenuOverlay');
var Collections = require('./Collections');

var PictureFill;
var FastClick;

try {
  PictureFill = require('picturefill');
  FastClick = require('fastclick');
} catch (e) {
  if (! e instanceof ReferenceError)
    throw e;
}

var RESPONSIVE_BREAKPOINT = 800;

var Layout = React.createClass({
  getInitialState: function() {
    return {
      menuOpen: false,
      contactOpen: false,
      small: this.isSmall()
    }
  },
  
  componentWillMount: function() {
    if (typeof location !== 'undefined' && location.hash === '#contact') {
      this.setState({contactOpen: true});
    }
  },
  
  componentDidMount: function() {
    // need to bind this at a higher level
    $(document).on('keydown', this.handleKeyDown);

    $(window).on('resize', this.handleWindowResize);

    FastClick.attach(document.body);

    this.pictureFill();
  },
  
  componentWillUnmount: function() {
    $(document).off('keydown', this.handleKeyDown);
    $(window).off('resize', this.handleWindowResize);
  },
  
  openMenu: function(state) {
    this.setState({menuOpen: state});
  },
  
  openContact: function(state) {
    this.setState({contactOpen: state});
    location.hash = state ? 'contact' : '';
  },
  
  handleKeyDown: function(event) {
    if (event.which == 27) { // esc closes everything
      if ( $('input, textarea').is(':focus')) {
        return ; // input or textarea is focused, ignore other part of function
      }
      this.openContact(false);
      this.openMenu(false);
    }
  },
  
  isSmall: function() {
    return (typeof window !== 'undefined') && $(window).width() <= RESPONSIVE_BREAKPOINT;
  },
  
  handleWindowResize: function() {
    this.setState({
      small: this.isSmall()
    });
  },
  
  componentWillReceiveProps: function(nextProps) {
    if (nextProps.params)
      this.pictureFill();
  },
  
{'fraction_non_alphanumeric': 0.15697535295525245, 'fraction_numerical': 0.002871500358937545, 'mean_word_length': 3.4, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1173266', 'n_tokens_mistral': 1286, 'n_tokens_neox': 1274, 'n_words': 281}