PageSourceSearch

https://trioeclipses.es/modules/contrib/lang_dropdown/js/lang_dropdown.js?v=1.x

js trioeclipses.es collected 2026-10-04 00:26:24 UTC 2,817 bytes, 75 lines download raw bytes

1(function ($, drupalSettings) {
2  'use strict';
3
4  Drupal.behaviors.lang_dropdown = {
5    attach: function (context, settings) {
6      settings = settings || drupalSettings;
7
8      if (settings.lang_dropdown) {
9        $('select.lang-dropdown-select-element').each(function() {
10          var $dropdown = $(this);
11          var key = $dropdown.data('lang-dropdown-id');
12
13          var ldSettings = settings.lang_dropdown[key];
14          if (ldSettings) {
15            var flags = ldSettings.languageicons;
16            if (flags) {
17              $.each(flags, function (index, value) {
18                var option = $dropdown.find('option[value="' + index + '"]');
19                if (ldSettings.widget === 'msdropdown') {
20                  option.attr('data-image', value);
21                }
22                else if (ldSettings.widget === 'ddslick' && Boolean(ldSettings.showSelectedHTML)) {
23                  option.attr('data-imagesrc', value);
24                }
25              });
26            }
27            if (ldSettings.widget === 'msdropdown') {
28              try {
29                $dropdown.msDropDown({
30                  visibleRows: ldSettings.visibleRows,
31                  roundedCorner: Boolean(ldSettings.roundedCorner),
32                  animStyle: ldSettings.animStyle,
33                  event: ldSettings.event,
34                  mainCSS: ldSettings.mainCSS
35                });
36              }
37              catch (e) {
38                if (console) {
39                  console.log(e);
40                }
41              }
42            }
43            else if (ldSettings.widget === 'chosen') {
44              $dropdown.chosen({
45                disable_search: ldSettings.disable_search,
46                no_results_text: ldSettings.no_results_text
47              });
48            }
49            else if (ldSettings.widget === 'ddslick') {
50              $.data(document.body, 'ddslick' + key + 'flag', 0);
51              $dropdown.ddslick({
52                width: ldSettings.width,
53                height: (ldSettings.height === 0) ? null : ldSettings.height,
54                showSelectedHTML: Boolean(ldSettings.showSelectedHTML),
55                imagePosition: ldSettings.imagePosition,
56                onSelected: function (data, element) {
57                  var i = jQuery.data(document.body, 'ddslick' + key + 'flag');
58                  if (i) {
59                    $.data(document.body, 'ddslick' + key + 'flag', 0);
60                    data.selectedItem.closest('form').submit()
61                  }
62                  $.data(document.body, 'ddslick' + key + 'flag', 1);
63                }
64              });
65            }
66          }
67        });
68      }
69
70      $('select.lang-dropdown-select-element').change(function () {
71        $(this).closest('form').submit();
72      });
73    }
74  };
75})(jQuery, drupalSettings);

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.