<commit_before>(function($) {
  
  var filters;
  
  $.filters = filters = {
    append: function(field_label, field_name, field_type, field_value, field_operator, field_options, index) {
      var value_name = 'filters[' +  field_name + '][' + index + '][value]';
      var operator_name = 'filters[' +  field_name + '][' + index + '][operator]';
      switch(field_type) {
        case 'boolean': 
          var control = '<select name="' + value_name + '">' + 
            '<option value="true"' + (field_value == "true" ? 'selected="selected"' : '') + '>True</option>' +
            '<option value="false"' + (field_value == "false" ? 'selected="selected"' : '') + '>False</option>' +
          '</select>';
          break;
        case 'date':
        case 'datetime':
        case 'timestamp':
          var control = '<select class="switch-additionnal-fieldsets" name="' + operator_name + '">' + 
            '<option ' + (field_operator == "today"     ? 'selected="selected"' : '') + ' value="today"     data-additional-fieldset="false">Today</option>' +
            '<option ' + (field_operator == "yesterday" ? 'selected="selected"' : '') + ' value="yesterday" data-additional-fieldset="false">Yesterday</option>' +
            '<option ' + (field_operator == "this_week" ? 'selected="selected"' : '') + ' value="this_week" data-additional-fieldset="false">This week</option>' +
            '<option ' + (field_operator == "last_week" ? 'selected="selected"' : '') + ' value="last_week" data-additional-fieldset="false">Last week</option>' +
            '<option ' + (field_operator == "less_than" ? 'selected="selected"' : '') + ' value="less_than" data-additional-fieldset="true">Less than ... days ago</option>' +
            '<option ' + (field_operator == "more_than" ? 'selected="selected"' : '') + ' value="more_than" data-additional-fieldset="true">More than ... days ago</option>' +
          '</select>' +
          '<input class="additional-fieldset" style="display:' + (field_operator == "less_than" || field_operator == "more_than" ? 'block' : 'none') + ';" type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
        case 'enum':
          field_options = $j('<div/>').html(field_options).text(); // entities decode
          var control = '<select name="' + value_name + '">' + 
            field_options + 
          '</select>';
          break;
        case 'string':
        case 'text':
          var control = '<select value="' + field_operator + '" name="' + operator_name + '">' + 
            '<option value="like" ' + (field_operator == "like" ? 'selected="selected"' : '') + '>Like</option>' +
            '<option value="starts_with" ' + (field_operator == "starts_with" ? 'selected="selected"' : '') + '>Starts with</option>' +
            '<option value="ends_with" ' + (field_operator == "ends_with" ? 'selected="selected"' : '') + '>Ends with</option>' +
            '<option value="is" ' + (field_operator == "is" ? 'selected="selected"' : '') + '>Is exactly</option>' +
          '</select>' +
          '<input type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
        default:
          var control = '<input type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
      }
    
      $('#filters_box').append(
        '<div class="filter" style="clear:both;">' + 
    
          '<div class="ui-state-default ui-corner-all"><span alt="delete" class="delete ui-icon ui-icon-trash" data-disabler-name="filters[' +  field_name + '][' + index + '][disabled]" style="cursor:pointer" title="delete"></span></div>' +
          '<label>' + field_label + '</label>' + 
          control +
        '</div>'
      );
    }
  }

  $(document).ready(function() {
    $("#filter_select").bind('change', function() {
      var option = $(this).find('option:selected')
      $(this).val(''); // reset select
    
      $.filters.append(
        option.data('field-label'), 
        option.data('field-name'), 
        option.data('field-type'), <commit_msg>The select boxes produced by the filtering search can be uniform styled too.<commit_after>(function($) {
  
  var filters;
  
  $.filters = filters = {
    append: function(field_label, field_name, field_type, field_value, field_operator, field_options, index) {
      var value_name = 'filters[' +  field_name + '][' + index + '][value]';
      var operator_name = 'filters[' +  field_name + '][' + index + '][operator]';
      switch(field_type) {
        case 'boolean': 
          var control = '<select name="' + value_name + '">' + 
            '<option value="true"' + (field_value == "true" ? 'selected="selected"' : '') + '>True</option>' +
            '<option value="false"' + (field_value == "false" ? 'selected="selected"' : '') + '>False</option>' +
          '</select>';
          break;
        case 'date':
        case 'datetime':
        case 'timestamp':
          var control = '<select class="switch-additionnal-fieldsets" name="' + operator_name + '">' + 
            '<option ' + (field_operator == "today"     ? 'selected="selected"' : '') + ' value="today"     data-additional-fieldset="false">Today</option>' +
            '<option ' + (field_operator == "yesterday" ? 'selected="selected"' : '') + ' value="yesterday" data-additional-fieldset="false">Yesterday</option>' +
            '<option ' + (field_operator == "this_week" ? 'selected="selected"' : '') + ' value="this_week" data-additional-fieldset="false">This week</option>' +
            '<option ' + (field_operator == "last_week" ? 'selected="selected"' : '') + ' value="last_week" data-additional-fieldset="false">Last week</option>' +
            '<option ' + (field_operator == "less_than" ? 'selected="selected"' : '') + ' value="less_than" data-additional-fieldset="true">Less than ... days ago</option>' +
            '<option ' + (field_operator == "more_than" ? 'selected="selected"' : '') + ' value="more_than" data-additional-fieldset="true">More than ... days ago</option>' +
          '</select>' +
          '<input class="additional-fieldset" style="display:' + (field_operator == "less_than" || field_operator == "more_than" ? 'block' : 'none') + ';" type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
        case 'enum':
          field_options = $j('<div/>').html(field_options).text(); // entities decode
          var control = '<select name="' + value_name + '">' + 
            field_options + 
          '</select>';
          break;
        case 'string':
        case 'text':
          var control = '<select value="' + field_operator + '" name="' + operator_name + '">' + 
            '<option value="like" ' + (field_operator == "like" ? 'selected="selected"' : '') + '>Like</option>' +
            '<option value="starts_with" ' + (field_operator == "starts_with" ? 'selected="selected"' : '') + '>Starts with</option>' +
            '<option value="ends_with" ' + (field_operator == "ends_with" ? 'selected="selected"' : '') + '>Ends with</option>' +
            '<option value="is" ' + (field_operator == "is" ? 'selected="selected"' : '') + '>Is exactly</option>' +
          '</select>' +
          '<input type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
        default:
          var control = '<input type="text" name="' + value_name + '" value="' + field_value + '" /> ';
          break;
      }
    
      $('#filters_box').append(
        '<div class="filter" style="clear:both;">' + 
    
          '<div class="ui-state-default ui-corner-all"><span alt="delete" class="delete ui-icon ui-icon-trash" data-disabler-name="filters[' +  field_name + '][' + index + '][disabled]" style="cursor:pointer" title="delete"></span></div>' +
          '<label>' + field_label + '</label>' + 
          control +
        '</div>'
      );
      $("#filters_box select").uniform();
    }
  }

  $(document).ready(function() {
    $("#filter_select").bind('change', function() {
      var option = $(this).find('option:selected')
      $(this).val(''); // reset select
    
      $.filters.append(
        option.data('field-label'), 
        option.data('field-name'), 
        option.data('field-type'), 
{'fraction_non_alphanumeric': 0.2088706761480053, 'fraction_numerical': 0.0, 'mean_word_length': 2.8186838472158304, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 91, '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': '3863021', 'n_tokens_mistral': 2497, 'n_tokens_neox': 2442, 'n_words': 462}