PageSourceSearch

https://www.dissenyhub.barcelona/sites/all/modules/lang_dropdown/lang_dropdown.js?tje2pl

js dissenyhub.barcelona collected 2026-10-02 03:30:20 UTC 3,092 bytes, 74 lines download raw bytes

1(function ($) {
2Drupal.behaviors.lang_dropdown = {
3  attach: function (context, settings) {
4    var settings = settings || Drupal.settings;
5
6    if (settings.lang_dropdown) {
7      var flags, msddSettings;
8      for (key in settings.lang_dropdown) {
9        msddSettings = settings.lang_dropdown[key].jsWidget;
10        flags = msddSettings.languageicons;
11        if (flags) {
12          $.each(flags, function(index, value) {
13            if (msddSettings.widget == "msdropdown") {
14              $('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]', context).attr('data-image', value);
15            }
16            else if (msddSettings.widget == "ddslick" && Boolean(msddSettings.showSelectedHTML)) {
17              $('select#lang-dropdown-select-' + key + ' option[value="' + index + '"]', context).attr('data-imagesrc', value);
18            }
19          });
20        }
21
22        if (msddSettings.widget == "msdropdown") {
23          try {
24            $('select#lang-dropdown-select-' + key, context).msDropDown({
25              visibleRows: msddSettings.visibleRows,
26              roundedCorner: Boolean(msddSettings.roundedCorner),
27              animStyle: msddSettings.animStyle,
28              event: msddSettings.event,
29              mainCSS: msddSettings.mainCSS
30            });
31          }
32          catch (e) {
33            if (console) { console.log(e); }
34          }
35        }
36        else if (msddSettings.widget == "chosen") {
37          $('select#lang-dropdown-select-' + key, context).chosen({
38            disable_search: msddSettings.disable_search,
39            no_results_text: msddSettings.no_results_text
40          });
41        }
42        else if (msddSettings.widget == "ddslick") {
43          $('select#lang-dropdown-select-' + key, context).ddslick({
44            width: (msddSettings.width == 0) ? null : msddSettings.width,
45            height: (msddSettings.height == 0) ? null : msddSettings.height,
46            showSelectedHTML: Boolean(msddSettings.showSelectedHTML),
47            imagePosition: msddSettings.imagePosition,
48            onSelected: function(data) {
49              // ddselect also fires this function on initialization, so we have
50              // to make sure this select has already been initialized.
51              if (!data.selectedItem.parent().data('ddslick-has-been-initialized')) {
52                data.selectedItem.parent().data('ddslick-has-been-initialized', true);
53                return;
54              }
55
56              var lang = data.selectedData.value;
57              var href = $('#lang-dropdown-select-'+key, context).parents('form').find('input[name="' + lang + '"]').val();
58              window.location.href = href;
59            }
60          });
61        }
62      }
63    }
64
65    $('select.lang-dropdown-select-element', context).change(function() {
66      var lang = this.options[this.selectedIndex].value;
67      var href = $(this).parents('form').find('input[name="' + lang + '"]').val();
68      window.location.href = href;
69    });
70
71    $('form.lang-dropdown-form', context).after('<div style="clear:both;"></div>');
72  }
73};
74})(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.