PageSourceSearch

https://montagut.com/modules/montagutheadercomponents/views/js/header-components.js

js montagut.com collected 2026-10-08 01:33:56 UTC 1,654 bytes, 49 lines download raw bytes

1/**
2 * Header Components — Account Dropdown (main header + sticky)
3 * Desktop only — Click toggle + hover support
4 */
5(function () {
6    'use strict';
7
8    if (window.innerWidth < 1000) return;
9
10    document.addEventListener('DOMContentLoaded', function () {
11
12        /* Get ALL account dropdown wrappers (main header + sticky) */
13        var allWrappers = document.querySelectorAll('.account-dropdown-wrapper');
14        if (!allWrappers.length) return;
15
16        allWrappers.forEach(function (wrapper) {
17            var btn = wrapper.querySelector('.account-btn');
18            if (btn) {
19                btn.addEventListener('click', function (e) {
20                    e.preventDefault();
21                    e.stopPropagation();
22                    /* Close all other dropdowns first */
23                    allWrappers.forEach(function (w) {
24                        if (w !== wrapper) w.classList.remove('is-open');
25                    });
26                    wrapper.classList.toggle('is-open');
27                });
28            }
29        });
30
31        /* Close on outside click */
32        document.addEventListener('click', function (e) {
33            allWrappers.forEach(function (wrapper) {
34                if (!wrapper.contains(e.target)) {
35                    wrapper.classList.remove('is-open');
36                }
37            });
38        });
39
40        /* Close on Escape */
41        document.addEventListener('keydown', function (e) {
42            if (e.key === 'Escape') {
43                allWrappers.forEach(function (wrapper) {
44                    wrapper.classList.remove('is-open');
45                });
46            }
47        });
48    });
49})();

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.