<commit_before>/*
 * Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * speciesDropdown: Javascript counterpart for E::W::Form::Element::SpeciesDropdown
 * Extension of filterableDropdown to add species icons to the tags
 * Reserverd classname prefix: _sdd
 **/
(function ($) {
  $.fn.speciesDropdown = function (options) {
  /*
   * options: same as accepted by filterableDropdown, except 'change' key
   */

    return this.each(function () {
      $.speciesDropdown($(this), options);
    });
  };

  $.speciesDropdown = function (el, options) {
    $.filterableDropdown(el, $.extend(options, {
      'change': function() {
        $(this).find('._fd_tag').css('background-image', function() {
          return this.style.backgroundImage.replace(/[^\/]+\.png/, $($(this).data('input')).val() + '.png');
        });
      }
    }));
  };
})(jQuery);<commit_msg>Apply the 'change' handler if provided<commit_after>/*
 * Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * speciesDropdown: Javascript counterpart for E::W::Form::Element::SpeciesDropdown
 * Extension of filterableDropdown to add species icons to the tags
 * Reserverd classname prefix: _sdd
 **/
(function ($) {
  $.fn.speciesDropdown = function (options) {
  /*
   * options: same as accepted by filterableDropdown
   */

    return this.each(function () {
      $.speciesDropdown($(this), options);
    });
  };

  $.speciesDropdown = function (el, options) {
    $.filterableDropdown(el, $.extend({}, options, {
      'change': function() {
        $(this).find('._fd_tag').css('background-image', function() {
          return this.style.backgroundImage.replace(/[^\/]+\.png/, $($(this).data('input')).val() + '.png');
        });
        if (options && options.change) {
          options.change.apply(this, arguments);
        }
      }
    }));
  };
})(jQuery);
{'fraction_non_alphanumeric': 0.13296488946684004, 'fraction_numerical': 0.007802340702210663, 'mean_word_length': 3.4529667149059335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '925834', 'n_tokens_mistral': 877, 'n_tokens_neox': 834, 'n_words': 289}