PageSourceSearch

https://www.lampdirect.nl/static/version1790658255/frontend/Wwl/anylamp/nl_NL/Magento_Theme/js/islands/menu.js

js lampdirect.nl collected 2026-10-04 14:36:29 UTC 4,255 bytes, 1 lines download raw bytes

1const MOBILE_QUERY="(max-width: 768px)",IMAGE_HOVER_DELAY_MS=100;function isMobileViewport(){return window.matchMedia(MOBILE_QUERY).matches}const MENU_ITEM_SELECTOR="nav#mega-menu .mega-menu__list .mega-menu__item",PARENT_ITEM_CLASS="mega-menu__item--parent",INNER_LEVEL1_CLASS="mega-menu__inner-item--level1",IMAGE_WRAPPER_SELECTOR=".mega-menu__item--image";function initDesktopHover(){const e=document.querySelectorAll(`${MENU_ITEM_SELECTOR}.${PARENT_ITEM_CLASS}`),t=document.querySelector(IMAGE_WRAPPER_SELECTOR);let n;function o(e){const n=e||"",o=t?.querySelector("img");o&&o.setAttribute("src",n.toString()),t?.classList.toggle("open",""!==n)}function i(e){if(!e)return;e.parentElement?.querySelectorAll(`:scope > .${INNER_LEVEL1_CLASS}`).forEach(t=>{t!==e&&t.classList.remove("open")}),e.classList.add("open");const t=e.querySelector(".mega-menu__inner-list--level2");if(t){document.querySelectorAll(".mega-menu__inner-list--level2").forEach(e=>{e.classList.remove("open")}),t.classList.add("open");const e=t.querySelector("a")?.dataset.imageSrc;e&&o(e)}}e.forEach(e=>{e.addEventListener("mouseenter",()=>{isMobileViewport()||(document.body.classList.add("mega-menu-active"),i(e.querySelector(`.${INNER_LEVEL1_CLASS}`)),o(e.querySelector("a")?.dataset.imageSrc||""))}),e.addEventListener("mouseleave",()=>{isMobileViewport()||(document.body.classList.remove("mega-menu-active"),e.querySelectorAll(`.${INNER_LEVEL1_CLASS}`).forEach(e=>{e.classList.remove("open")}),o(""))})}),document.querySelectorAll(`${MENU_ITEM_SELECTOR} .${INNER_LEVEL1_CLASS}`).forEach(e=>{e.addEventListener("mouseenter",()=>{isMobileViewport()||(clearTimeout(n),n=setTimeout(()=>{i(e)},100))}),e.addEventListener("mouseleave",()=>{isMobileViewport()||clearTimeout(n)})}),document.querySelectorAll(`${MENU_ITEM_SELECTOR} .${INNER_LEVEL1_CLASS} ul li`).forEach(e=>{e.addEventListener("mouseenter",()=>{if(isMobileViewport())return;const t=e.querySelector("a")?.dataset.imageSrc;t&&o(t)})}),document.querySelectorAll(".cms-faq a").forEach(e=>{e.addEventListener("click",t=>{const n=e.getAttribute("href");n&&n.startsWith("#")&&(t.preventDefault(),window.location.hash=n)})})}function initMobileSideMenu(){const e=document.body.querySelector("nav#mega-menu");if(!e)return;const t=e.querySelector(".mega-menu__wrapper"),n=e.querySelector(".mega-menu__list-secondary"),o=[];function i(t=!1){e.querySelectorAll(".mega-menu__trigger--close.back").forEach(e=>{e.style.visibility=t?"hidden":"visible"})}function l(n){let i=e.querySelector("#mega-menu-facade-panel");i||(i=document.createElement("div"),i.id="mega-menu-facade-panel",i.style.position="absolute",i.style.top="69px",i.style.width="100%",i.addEventListener("click",n=>{if("A"!==n.target.nodeName||!n.target.dataset.menu)return;const i=t.querySelector(`a[data-menu="${n.target.dataset.menu}"]`),r=i?.nextElementSibling;r&&(n.preventDefault(),n.stopPropagation(),o.push(e.querySelector("#mega-menu-facade-panel")?.firstElementChild),l(r))}));const r=n instanceof Element?n:n?.[0];r&&(i.innerHTML=r.outerHTML,i.firstElementChild.querySelectorAll("li a + ul").forEach(e=>e.remove()),i.firstElementChild.style.marginTop="0",i.firstElementChild.classList.add("open"),e.appendChild(i),i.scrollTop=0,t&&(t.style.display="none"))}function r(){i(!0),e.querySelector("#mega-menu-facade-panel")?.remove(),n?.classList.remove("hidden"),t&&(t.style.display="block"),o.splice(0)}document.querySelectorAll(".mega-menu__trigger").forEach(e=>{e.addEventListener("click",()=>{document.documentElement.classList.add("mobile-menu-open"),document.body.classList.add("mobile-menu-open","new-menu")})}),e.querySelectorAll(".mega-menu__trigger--close.close").forEach(e=>{e.addEventListener("click",()=>{document.documentElement.classList.remove("mobile-menu-open"),document.body.classList.remove("mobile-menu-open"),r()})}),e.querySelectorAll(".mega-menu__trigger--close.back").forEach(e=>{e.addEventListener("click",()=>{if(!o.length)return void r();l(o.pop())})}),e.querySelectorAll(".mega-menu__link").forEach(e=>{e.addEventListener("click",t=>{if(!isMobileViewport())return;const o=e.nextElementSibling;o&&o.matches("ul")&&(t.preventDefault(),t.stopPropagation(),i(),n?.classList.add("hidden"),l(o))})})}initDesktopHover(),initMobileSideMenu();

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.