PageSourceSearch

https://www.maennerhilfetelefon.de/modules/custom/flow_dropdown_language/js/dropdown_language.js?v=11.3.11

js maennerhilfetelefon.de collected 2026-09-24 09:28:11 UTC 3,295 bytes, 87 lines download raw bytes

1(function ($) {
2  Drupal.behaviors.FlowLanguageDropdownAlphabet = {
3    attach: function(context, settings) {
4      $(once('FlowLanguageDropdownAlphabet', '.language-selector button', context)).each(function () {
5        var $button = $(this);
6        var $menu = $('.language-selector [id*="language-menu"]');
7
8        $button.on('click', function () {
9          var isExpanded = $button.attr('aria-expanded') === 'true';
10          $button.attr('aria-expanded', !isExpanded);
11          console.log("click!");
12          if (isExpanded) {
13            $menu.fadeOut();
14            document.body.style.overflow = 'auto';
15          } else {
16            $menu.fadeIn();
17            document.body.style.overflow = 'hidden';
18          }
19        });
20      });
21    },
22  };
23
24  Drupal.behaviors.FlowLanguageDropdownDefault = {
25    attach(context, settings) {
26      $(once('FlowLanguageDropdownDefault', 'ul.fdl-language-dropdown.fdl--default', context)).each(function () {
27        var $language_selector = $(this);
28
29        function dropdownIsExpanded() {
30          return $language_selector.find('.second-list').hasClass('open');
31        }
32
33        function closeDropdown($trigger) {
34          if (dropdownIsExpanded() && $trigger) {
35            $language_selector.each(function () {
36              $(this).find('.second-list').removeClass('open');
37              $(this).find('button.language-selector-trigger').attr('aria-expanded', false);
38              $(this).removeClass('expanded');
39            });
40          }
41        }
42
43        $language_selector.on('click', function (e) {
44          if ($(this).find('.second-list').hasClass('open')) {
45            $(this).find('.second-list').removeClass('open');
46            $(this).find('button.language-selector-trigger').attr('aria-expanded', false);
47            $(this).removeClass('expanded');
48          } else {
49            $(this).find('.second-list').addClass('open');
50            $(this).find('button.language-selector-trigger').attr('aria-expanded', true);
51            $(this).addClass('expanded');
52          }
53
54        });
55
56        $(document).on('keyup', function (e) {
57          // Tab key
58          const $openDropdown = $language_selector.find('.second-list.open');
59          if (($openDropdown.length !== 0) // dropdown is open
60            && ($openDropdown.find(document.activeElement).length === 0) // not focusing in the dropdown
61            && e.keyCode === 9) { // tabbing away
62            // Close the open menu if the next focused element is outside of the submenu/language selector
63            $openDropdown.removeClass('open');
64            const $rootDropdown = $openDropdown.closest('.fdl-language-dropdown');
65            $rootDropdown.find('button.language-selector-trigger').attr('aria-expanded', false);
66            $rootDropdown.removeClass('expanded');
67
68          }
69        });
70
71        // close submenus or main menu on ESC key
72        $(document).on('keydown', function (e) {
73          // ESC key
74          if (e.keyCode === 27) {
75            closeDropdown(true);
76          }
77        });
78
79        $(document).on('click', function (e) {
80          let $button = $(e.target);
81          closeDropdown(!$button.closest('.fdl-language-dropdown').find('.second-list.open').length);
82        });
83
84      });
85    },
86  };
87})(window.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.