<commit_before>import React from "react";
import Router from "react-router";
import jQuery from "jquery";
import ConfigStore from "../../stores/configStore";
import DropdownLink from "../dropdownLink";
import MenuItem from "../menuItem";

var ProjectSelector = React.createClass({
  childContextTypes: {
    router: React.PropTypes.func
  },

  getChildContext() {
    return {
      router: this.props.router
    };
  },

  getInitialState() {
    return {
      filter: ''
    };
  },

  onFilterChange(e) {
    this.setState({
      filter: e.target.value
    });
  },

  onKeyUp(e) {
    if (event.key === 'Escape' || event.keyCode === 27) {
      // blur handler should additionally hide dropdown
      this.close();
    }
  },

  onFilterBlur() {
    // HACK: setTimeout because blur might be caused by clicking
    // project link; in which case, will close dropdown before
    // link click is processed. Why 200ms? Decently short time
    // period that seemed to work in all browsers.
    setTimeout(() => this.close(), 200);
  },

  close() {
    this.setState({ filter: '' });
    this.refs.dropdownLink.close();
  },

  highlight(text, highlightText) {
    if (!highlightText) {
      return text;
    }
    highlightText = highlightText.toLowerCase();
    var idx = text.toLowerCase().indexOf(highlightText);<commit_msg>Fix "event is not defined" error affecting Firefox<commit_after>import React from "react";
import Router from "react-router";
import jQuery from "jquery";
import ConfigStore from "../../stores/configStore";
import DropdownLink from "../dropdownLink";
import MenuItem from "../menuItem";

var ProjectSelector = React.createClass({
  childContextTypes: {
    router: React.PropTypes.func
  },

  getChildContext() {
    return {
      router: this.props.router
    };
  },

  getInitialState() {
    return {
      filter: ''
    };
  },

  onFilterChange(evt) {
    this.setState({
      filter: evt.target.value
    });
  },

  onKeyUp(evt) {
    if (evt.key === 'Escape' || evt.keyCode === 27) {
      // blur handler should additionally hide dropdown
      this.close();
    }
  },

  onFilterBlur() {
    // HACK: setTimeout because blur might be caused by clicking
    // project link; in which case, will close dropdown before
    // link click is processed. Why 200ms? Decently short time
    // period that seemed to work in all browsers.
    setTimeout(() => this.close(), 200);
  },

  close() {
    this.setState({ filter: '' });
    this.refs.dropdownLink.close();
  },

  highlight(text, highlightText) {
    if (!highlightText) {
      return text;
    }
    highlightText = highlightText.toLowerCase();
    var idx = text.toLowerCase().indexOf(highlightText);
{'fraction_non_alphanumeric': 0.13520502401182122, 'fraction_numerical': 0.005910602142593277, 'mean_word_length': 2.8796561604584525, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4557448', 'n_tokens_mistral': 811, 'n_tokens_neox': 790, 'n_words': 222}