<commit_before>
open_graph = {

  track: {

    config: {

      init: function() {
        jQuery('.panel-body input[type=checkbox]:first').each(function(i, checkbox) {
          open_graph.track.config.toggleParent(checkbox)
        })
      },

      toggle: function(checkbox) {
        var panel = $(checkbox).parents('.panel')
        var checkboxes = panel.find('.panel-body input[type=checkbox]')
        checkboxes.prop('checked', checkbox.checked)
      },

      toggleParent: function(checkbox) {
        var panel = $(checkbox).parents('.panel')
        var parentCheckbox = panel.find('.panel-heading input[type=checkbox]')
        var nChecked = panel.find('.panel-body input[type=checkbox]:checked').length
        var nTotal = panel.find('.panel-body input[type=checkbox]').length

        parentCheckbox.prop('indeterminate', false)
        if (nChecked == nTotal)
          parentCheckbox.prop('checked', true)
        else if (nChecked === 0)
          parentCheckbox.prop('checked', false)
        else
          parentCheckbox.prop('indeterminate', true)
      },

    },
  },

  autocomplete: {
    bloodhoundOptions: {
      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      ajax: {
        beforeSend: function() {
          input.addClass('small-loading')
        },
        complete: function() {
          input.removeClass('small-loading')
        },
      },
    },
    tokenfieldOptions: {

    },
    typeaheadOptions: {
      minLength: 1,
      highlight: true,
    },

    init: function(url, selector, data, options) {
      options = options || {}
      var bloodhoundOptions = jQuery.extend({}, this.bloodhoundOptions, options.bloodhound || {});
      var typeaheadOptions = jQuery.extend({}, this.typeaheadOptions, options.typeahead || {});
      var tokenfieldOptions = jQuery.extend({}, this.tokenfieldOptions, options.tokenfield || {});

      var input = $(selector)
      bloodhoundOptions.remote = jQuery.param.querystring(url, {query:'%QUERY'});
      var engine = new Bloodhound(bloodhoundOptions)
      engine.initialize()

      tokenfieldOptions.typeahead = [typeaheadOptions, { displayKey: 'label', source: engine.ttAdapter() }]

      input.tokenfield(tokenfieldOptions)
      input.tokenfield('setTokens', data);
    },
  },
}
<commit_msg>Parse url using replace from remote<commit_after>
open_graph = {

  track: {

    config: {

      init: function() {
        jQuery('.panel-body input[type=checkbox]:first').each(function(i, checkbox) {
          open_graph.track.config.toggleParent(checkbox)
        })
      },

      toggle: function(checkbox) {
        var panel = $(checkbox).parents('.panel')
        var checkboxes = panel.find('.panel-body input[type=checkbox]')
        checkboxes.prop('checked', checkbox.checked)
      },

      toggleParent: function(checkbox) {
        var panel = $(checkbox).parents('.panel')
        var parentCheckbox = panel.find('.panel-heading input[type=checkbox]')
        var nChecked = panel.find('.panel-body input[type=checkbox]:checked').length
        var nTotal = panel.find('.panel-body input[type=checkbox]').length

        parentCheckbox.prop('indeterminate', false)
        if (nChecked == nTotal)
          parentCheckbox.prop('checked', true)
        else if (nChecked === 0)
          parentCheckbox.prop('checked', false)
        else
          parentCheckbox.prop('indeterminate', true)
      },

    },
  },

  autocomplete: {
    bloodhoundOptions: {
      datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
      queryTokenizer: Bloodhound.tokenizers.whitespace,
      ajax: {
        beforeSend: function() {
          input.addClass('small-loading')
        },
        complete: function() {
          input.removeClass('small-loading')
        },
      },
    },
    tokenfieldOptions: {

    },
    typeaheadOptions: {
      minLength: 1,
      highlight: true,
    },

    init: function(url, selector, data, options) {
      options = options || {}
      var bloodhoundOptions = jQuery.extend({}, this.bloodhoundOptions, options.bloodhound || {});
      var typeaheadOptions = jQuery.extend({}, this.typeaheadOptions, options.typeahead || {});
      var tokenfieldOptions = jQuery.extend({}, this.tokenfieldOptions, options.tokenfield || {});

      var input = $(selector)
      bloodhoundOptions.remote = {
        url: url,
        replace: function(url, uriEncodedQuery) {
          return jQuery.param.querystring(url, {query:uriEncodedQuery});
        },
      }
      var engine = new Bloodhound(bloodhoundOptions)
      engine.initialize()

      tokenfieldOptions.typeahead = [typeaheadOptions, { displayKey: 'label', source: engine.ttAdapter() }]

      input.tokenfield(tokenfieldOptions)
      input.tokenfield('setTokens', data);
    },
  },
}

{'fraction_non_alphanumeric': 0.13760525775313207, 'fraction_numerical': 0.0008215239268843705, 'mean_word_length': 2.740399385560676, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4734610', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1355, 'n_words': 241}