PageSourceSearch

https://www.egnyte.com/modules/custom/fusion_mega_menu/js/mega-menu.js?tluxj0

js egnyte.com collected 2026-09-24 08:29:17 UTC 6,681 bytes, 159 lines download raw bytes

1// document.addEventListener("DOMContentLoaded", () => {
2//   const tabs = document.querySelectorAll(".navbar__nav--subitem");
3//   const panes = document.querySelectorAll(".content__pane");
4//   const mobileNavs = document.querySelectorAll(".mobile__navigation");
5//   const dropdownItems = document.querySelectorAll(".navbar__nav--item.has-dropdown");
6
7//   // ── Screen size helper ───────────────────────────────────────────────────────
8//   const isMobile = () => window.innerWidth <= 1106;
9//   const isDesktop = () => window.innerWidth > 1106;
10
11//   // ── Init / resize ────────────────────────────────────────────────────────────
12//   const handleViewChange = () => {
13//     if (isDesktop()) {
14//       const activeTab = document.querySelector(".navbar__nav--subitem.active");
15//       if (!activeTab && tabs.length) {
16//         tabs[0].classList.add("active");
17//         const target = tabs[0].getAttribute("data-target");
18//         document.getElementById(target)?.classList.add("active");
19//       }
20//     } else {
21//       tabs.forEach((t) => t.classList.remove("active"));
22//       panes.forEach((p) => p.classList.remove("active"));
23//       mobileNavs.forEach((nav) => {
24//         const p = nav.querySelector("p");
25//         if (p && nav.dataset.originalText) p.textContent = nav.dataset.originalText;
26//       });
27//     }
28//   };
29
30//   // Store original mobile header text
31//   mobileNavs.forEach((nav) => {
32//     const p = nav.querySelector("p");
33//     if (p) nav.dataset.originalText = p.textContent.trim();
34//   });
35
36//   handleViewChange();
37
38//   let resizeTimer;
39//   window.addEventListener("resize", () => {
40//     clearTimeout(resizeTimer);
41//     resizeTimer = setTimeout(handleViewChange, 100);
42//   });
43
44//   // ── Industries tab switching ─────────────────────────────────────────────────
45//   function activateTab(tab) {
46//     const target = tab.getAttribute("data-target");
47//     if (!target) return;
48
49//     const industryTitle = tab.querySelector(".industry-title").firstChild.textContent.trim();
50
51//     tabs.forEach((t) => t.classList.remove("active"));
52//     panes.forEach((p) => p.classList.remove("active"));
53//     tab.classList.add("active");
54
55//     const targetPane = document.getElementById(target);
56//     if (targetPane) {
57//       targetPane.classList.add("active");
58
59//       if (isMobile()) {
60//         const mobileHeader = tab
61//           .closest(".megamenu-container")
62//           ?.querySelector(".mobile__navigation p");
63//         if (mobileHeader) mobileHeader.textContent = industryTitle;
64//       }
65//     }
66//   }
67
68//   tabs.forEach((tab) => {
69//     tab.addEventListener("click", () => {
70//       if (isMobile()) activateTab(tab);
71//     });
72//     tab.addEventListener("mouseenter", () => {
73//       if (isDesktop()) activateTab(tab);
74//     });
75//   });
76
77//   // ── Mobile back button ───────────────────────────────────────────────────────
78//   mobileNavs.forEach((nav) => {
79//     nav.addEventListener("click", (e) => {
80//       e.stopPropagation();
81//       if (!isMobile()) return;
82
83//       const anyActivePane = document.querySelector(".content__pane.active");
84//       const p = nav.querySelector("p");
85
86//       if (anyActivePane) {
87//         panes.forEach((pane) => pane.classList.remove("active"));
88//         tabs.forEach((t) => t.classList.remove("active"));
89//         if (p && nav.dataset.originalText) p.textContent = nav.dataset.originalText;
90//       } else {
91//         nav.closest(".navbar__nav--item")?.classList.remove("open");
92//       }
93//     });
94//   });
95
96//   // ── Dropdown open/close ──────────────────────────────────────────────────────
97//   dropdownItems.forEach((el) => {
98//     const trigger = el.querySelector(":scope > button.nav__item--link");
99
100//     // Mobile: clicking the trigger button toggles open
101//     if (trigger) {
102//       trigger.addEventListener("click", (e) => {
103//         if (!isMobile()) return;
104//         e.stopPropagation();
105
106//         const isOpen = el.classList.contains("open");
107
108//         // Close all other open dropdowns
109//         dropdownItems.forEach((other) => {
110//           if (other !== el) other.classList.remove("open");
111//         });
112
113//         el.classList.toggle("open", !isOpen);
114//       });
115//     }
116
117//     // Desktop: hover adds/removes active + resets tabs on leave
118//     el.addEventListener("mouseenter", () => {
119//       if (isDesktop()) el.classList.add("active");
120//     });
121
122//     el.addEventListener("mouseleave", () => {
123//       if (!isDesktop()) return;
124//       el.classList.remove("active");
125//       tabs.forEach((t) => t.classList.remove("active"));
126//       panes.forEach((p) => p.classList.remove("active"));
127
128//       if (tabs.length) {
129//         tabs[0].classList.add("active");
130//         const target = tabs[0].getAttribute("data-target");
131//         document.getElementById(target)?.classList.add("active");
132//       }
133//     });
134//   });
135
136//   // ── Search toggle ────────────────────────────────────────────────────────────
137//   const searchLoop = document.getElementById("search__loop");
138//   const searchClose = document.getElementById("search__close");
139//   const navbarNav = document.querySelector(".navbar__nav");
140//   const searchInput = document.getElementById("edit-search");
141
142//   searchLoop?.addEventListener("click", () => {
143//     if (!isDesktop()) return;
144//     navbarNav.classList.add("main-nav--hidden");
145//     searchLoop.classList.add("search__loop--hidden");
146//     searchClose.classList.add("search__close--visible");
147//     searchInput.classList.add("search__input--visible");
148//     searchInput.focus();
149//   });
150
151//   searchClose?.addEventListener("click", () => {
152//     if (!isDesktop()) return;
153//     navbarNav.classList.remove("main-nav--hidden");
154//     searchLoop.classList.remove("search__loop--hidden");
155//     searchClose.classList.remove("search__close--visible");
156//     searchInput.classList.remove("search__input--visible");
157//     searchInput.blur();
158//   });
159// });

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.