PageSourceSearch

https://www.unlock.com/app/themes/unlock/js/unlock-mega-menu.min.js?ver=2.1.4

js unlock.com collected 2026-09-28 12:37:46 UTC 2,911 bytes, 104 lines download raw bytes

1/*!
2  * Unlock Understrap v2.1.4 (https://www.unlock.com)
3  * Copyright 2013-2026 Unlk Developers
4  * Licensed under GPL-3.0 (undefined)
5  */
6(function (factory) {
7  typeof define === 'function' && define.amd ? define(factory) :
8  factory();
9})((function () { 'use strict';
10
11  function sendTrack(eventName, payload) {
12    if (globalThis.dataLayer) {
13      // eslint-disable-next-line no-undef
14      dataLayer.push({
15        event: eventName,
16        ...payload
17      });
18    }
19    if (globalThis.analytics) {
20      // eslint-disable-next-line no-undef
21      analytics.track(eventName, payload);
22    }
23  }
24  if (typeof globalThis !== 'undefined') {
25    globalThis.unlk = globalThis.unlk || {};
26    globalThis.unlk.sendTrack = sendTrack;
27  }
28
29  const megaMenuEl = document.querySelector('#mega-menu-primary');
30  const isMobile = () => globalThis.matchMedia('(max-width: 991.98px)').matches;
31  let mobileMenuIsOpen = false;
32  let desktopHidden = false;
33  document.addEventListener('DOMContentLoaded', init);
34  globalThis.addEventListener('resize', handleResize);
35  function init() {
36    if (!megaMenuEl || !globalThis.jQuery) {
37      return;
38    }
39    mobileMegaMenuState();
40    expandMegaSubMenu();
41  }
42  function handleResize() {
43    expandMegaSubMenu();
44  }
45  function mobileMegaMenuState() {
46    if (!megaMenuEl || !globalThis.jQuery) {
47      return;
48    }
49    const $menu = globalThis.jQuery(megaMenuEl);
50    $menu.on('mmm:showMobileMenu', () => {
51      mobileMenuIsOpen = true;
52      document.body.classList.add('blur');
53      expandMegaSubMenu(true);
54      sendTrack('Mobile Menu Opened', {
55        path: globalThis.location.pathname,
56        url: globalThis.location.href,
57        title: document.title
58      });
59    });
60    $menu.on('mmm:hideMobileMenu', () => {
61      if (!document.querySelector('.collapse.show[data-collapse="blur"]')) {
62        document.body.classList.remove('blur');
63      }
64      if (!mobileMenuIsOpen) {
65        return;
66      }
67      mobileMenuIsOpen = false;
68      sendTrack('Mobile Menu Closed', {
69        path: globalThis.location.pathname,
70        url: globalThis.location.href,
71        title: document.title
72      });
73    });
74  }
75  function expandMegaSubMenu(force = false) {
76    if (!megaMenuEl || !globalThis.jQuery) {
77      return;
78    }
79    const $ = globalThis.jQuery;
80    const $menu = $('#mega-menu-primary');
81    const maxMega = $menu.data('maxmegamenu');
82    if (!maxMega) {
83      return;
84    }
85    if (isMobile() || force) {
86      setTimeout(() => {
87        const $panelToShow = $('#mega-menu-item-1150 > a.mega-menu-link');
88        if ($panelToShow.length) {
89          maxMega.showPanel($panelToShow);
90        }
91      }, 50);
92      desktopHidden = false;
93      return;
94    }
95    if (!desktopHidden) {
96      setTimeout(() => {
97        maxMega.hideAllPanels();
98      }, 50);
99      desktopHidden = true;
100    }
101  }
102
103}));
104//# sourceMappingURL=unlock-mega-menu.min.js.map

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.