PageSourceSearch

https://theartssociety.org/sites/all/modules/contrib/chosen/chosen.js?v=1.1.0

js theartssociety.org collected 2026-10-02 07:20:27 UTC 2,545 bytes, 66 lines download raw bytes

1(function($) {
2  Drupal.behaviors.chosen = {
3    attach: function(context, settings) {
4      settings.chosen = settings.chosen || Drupal.settings.chosen;
5
6      // Prepare selector and add unwantend selectors.
7      var selector = settings.chosen.selector;
8
9      // Function to prepare all the options together for the chosen() call.
10      var getElementOptions = function (element) {
11        var options = $.extend({}, settings.chosen.options);
12
13        // The width default option is considered the minimum width, so this
14        // must be evaluated for every option.
15        if (settings.chosen.minimum_width > 0) {
16          if ($(element).width() < settings.chosen.minimum_width) {
17            options.width = settings.chosen.minimum_width + 'px';
18          }
19          else {
20            options.width = $(element).width() + 'px';
21          }
22        }
23
24        // Some field widgets have cardinality, so we must respect that.
25        // @see chosen_pre_render_select()
26        if ($(element).attr('multiple') && $(element).data('cardinality')) {
27          options.max_selected_options = $(element).data('cardinality');
28        }
29
30        return options;
31      };
32
33      // Process elements that have opted-in for Chosen.
34      // @todo Remove support for the deprecated chosen-widget class.
35      $('select.chosen-enable, select.chosen-widget', context).once('chosen', function() {
36        options = getElementOptions(this);
37        $(this).chosen(options);
38      });
39
40      $(selector, context)
41        // Disabled on:
42        // - Field UI
43        // - WYSIWYG elements
44        // - Tabledrag weights
45        // - Elements that have opted-out of Chosen
46        // - Elements already processed by Chosen
47        .not('#field-ui-field-overview-form select, #field-ui-display-overview-form select, .wysiwyg, .draggable select[name$="[weight]"], .draggable select[name$="[position]"], .chosen-disable, .chosen-processed')
48        .filter(function() {
49          // Filter out select widgets that do not meet the minimum number of
50          // options.
51          var minOptions = $(this).attr('multiple') ? settings.chosen.minimum_multiple : settings.chosen.minimum_single;
52          if (!minOptions) {
53            // Zero value means no minimum.
54            return true;
55          }
56          else {
57            return $(this).find('option').length >= minOptions;
58          }
59        })
60        .once('chosen', function() {
61          options = getElementOptions(this);
62          $(this).chosen(options);
63        });
64    }
65  };
66})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.