<commit_before>$.fn.nuiMenu = function(customOptions) {
  var options = $.extend({icon:''}, customOptions);
  return this.each(function(i, select) {
    $(select).hide();
    var iconHTML = '';
    if(options.icon != '') {
      iconHTML = '<span class="nui-icon nui-icon-' + options.icon + '"></span> ';
    }
    var selectArray = $('option', select);
    $(select).after('<div class="nui nui-menu"><div class="nui-button">' + iconHTML +
      $(select).attr('title') + ' <span class="nui-icon nui-icon-down"></span></div>' +
      '<div class="nui-menu-choices"></div>' +
    '</div>');
    var menu = $(select).next('.nui-menu');
    var button = $('.nui-button', menu);
    var choices = $('.nui-menu-choices', menu);
    var closeMenu = function() {
      $(choices).slideUp();
      $(button).removeClass('nui-active');
    };
    $('option', select).each(function(i, option) {
      $(choices).append('<div class="nui-menu-choice" id="' + $(option).attr('value') + '">' + $(option).text() + '</div>');
    });
    $.each($('.nui-menu-choice', choices), function(i, choice) {
      $(choice).click(function() {
        closeMenu();
      });
    });
    $(button).click(function() {
      $(choices).slideToggle();
      $(button).toggleClass('nui-active');
      $(document).keyup(function(event) {
        if (event.keyCode == 27) { // esc key
          closeMenu();
        }
      });
      $(choices).mouseleave(function() {
        closeMenu();
      });
    });
  });
};<commit_msg>nuiMenu now takes an onChange handler bound to newly-chosen <option>.<commit_after>$.fn.nuiMenu = function(customOptions) {
  var options = $.extend({
    icon:'',
    onChange:function(){}
  }, customOptions);
  return this.each(function(i, select) {
    $(select).hide();
    var iconHTML = '';
    if(options.icon != '') {
      iconHTML = '<span class="nui-icon nui-icon-' + options.icon + '"></span> ';
    }
    var selectArray = $('option', select);
    $(select).after('<div class="nui nui-menu"><div class="nui-button">' + iconHTML +
      $(select).attr('title') + ' <span class="nui-icon nui-icon-down"></span></div>' +
      '<div class="nui-menu-choices"></div>' +
    '</div>');
    var menu = $(select).next('.nui-menu');
    var button = $('.nui-button', menu);
    var choices = $('.nui-menu-choices', menu);
    var closeMenu = function() {
      $(choices).slideUp();
      $(button).removeClass('nui-active');
    };
    $('option', select).each(function(i, option) {
      var item = $('<div class="nui-menu-choice">' + $(option).text() + '</div>');
      item.click(function() {
        closeMenu();
        options.onChange.call(option);
      });
      $(choices).append(item);
    });
    $(button).click(function() {
      $(choices).slideToggle();
      $(button).toggleClass('nui-active');
      $(document).keyup(function(event) {
        if (event.keyCode == 27) { // esc key
          closeMenu();
        }
      });
      $(choices).mouseleave(function() {
        closeMenu();
      });
    });
  });
};
{'fraction_non_alphanumeric': 0.23277283217936037, 'fraction_numerical': 0.0013188262446422684, 'mean_word_length': 2.8115577889447234, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, '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': '6262996', 'n_tokens_mistral': 988, 'n_tokens_neox': 982, 'n_words': 165}