<commit_before>(function() {

  var FADE_IN_DURATION = 0;
  var FADE_OUT_DURATION = 200;

  function GraphModeDropdown() {
    window.app.EventEmitter.call(this);
    this._$element = $('#graph-mode-dropdown');
    this._$items = $('.graph-mode-dropdown-item');
    this._$label = $('#graph-mode-label');

    this._modeNames = [];
    for (var i = 0; i < this._$items.length; ++i) {
      this._modeNames[i] = this._$items.eq(i).text();
    }

    this._showing = false;
    this._boundClickThru = this._clickThru.bind(this);

    this._updateFromModel();
    this._registerEvents();
  }

  GraphModeDropdown.prototype =
    Object.create(window.app.EventEmitter.prototype);

  GraphModeDropdown.prototype._clickThru = function(e) {
    if (!e.inElement(this._$element[0]) &&
        !e.inElement(this._$label[0])) {
      this._toggle();
    }
  };

  GraphModeDropdown.prototype._registerEvents = function() {
    window.app.observe.activePuzzle('graphMode',
      this._updateFromModel.bind(this));
    this._$label.click(this._toggle.bind(this));
    for (var i = 0; i < this._$items.length; ++i) {
      this._$items.eq(i).click(function(index) {
        this.emit('change', index);
        this._toggle();
      }.bind(this, i));
    }
  };

  GraphModeDropdown.prototype._toggle = function() {
    if (this._showing) {
      this._$element.fadeOut(FADE_OUT_DURATION);
      window.clickthru.removeListener(this._boundClickThru);
    } else {
      this._$element.css({display: 'block', opacity: 1});
      window.clickthru.addListener(this._boundClickThru);
    }
    this._showing = !this._showing;
  };

  GraphModeDropdown.prototype._updateFromModel = function() {
    var index = window.app.store.getActivePuzzle().graphMode;
    for (var i = 0; i < this._modeNames.length; ++i) {
      if (i === index) {
        this._$items.eq(i).addClass('graph-mode-dropdown-item-selected');<commit_msg>handle spam-clicking of graph mode<commit_after>(function() {

  var FADE_IN_DURATION = 0;
  var FADE_OUT_DURATION = 200;

  function GraphModeDropdown() {
    window.app.EventEmitter.call(this);
    this._$element = $('#graph-mode-dropdown');
    this._$items = $('.graph-mode-dropdown-item');
    this._$label = $('#graph-mode-label');

    this._modeNames = [];
    for (var i = 0; i < this._$items.length; ++i) {
      this._modeNames[i] = this._$items.eq(i).text();
    }

    this._showing = false;
    this._boundClickThru = this._clickThru.bind(this);

    this._updateFromModel();
    this._registerEvents();
  }

  GraphModeDropdown.prototype =
    Object.create(window.app.EventEmitter.prototype);

  GraphModeDropdown.prototype._clickThru = function(e) {
    if (!e.inElement(this._$element[0]) &&
        !e.inElement(this._$label[0])) {
      this._toggle();
    }
  };

  GraphModeDropdown.prototype._registerEvents = function() {
    window.app.observe.activePuzzle('graphMode',
      this._updateFromModel.bind(this));
    this._$label.click(this._toggle.bind(this));
    for (var i = 0; i < this._$items.length; ++i) {
      this._$items.eq(i).click(function(index) {
        this.emit('change', index);
        this._toggle();
      }.bind(this, i));
    }
  };

  GraphModeDropdown.prototype._toggle = function() {
    if (this._showing) {
      this._$element.fadeOut(FADE_OUT_DURATION);
      window.clickthru.removeListener(this._boundClickThru);
    } else {
      this._$element.stop(true, true).css({display: 'block', opacity: 1});
      window.clickthru.addListener(this._boundClickThru);
    }
    this._showing = !this._showing;
  };

  GraphModeDropdown.prototype._updateFromModel = function() {
    var index = window.app.store.getActivePuzzle().graphMode;
    for (var i = 0; i < this._modeNames.length; ++i) {
      if (i === index) {
        this._$items.eq(i).addClass('graph-mode-dropdown-item-selected');
{'fraction_non_alphanumeric': 0.16727367325702394, 'fraction_numerical': 0.005202913631633715, 'mean_word_length': 3.2817371937639197, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7580837', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1283, 'n_words': 180}