1function MegaMenuLoader( mobileBreakpoint) { 2 3 4 const BASE_PATH = "/apps-shared/navigation/mega-menu"; 5 const desktopCSS = BASE_PATH + '/mega-menu-desktop-core.css'; 6 const mobileCSS = BASE_PATH + '/mega-menu-mobile-core.css'; 7 const scriptJS = BASE_PATH + '/megaMenu.js'; 8 let megaMenuNav = null; 9 let megaMenuConfig = null; 10 if (window._enNavMobileMenuParams && window._enNavMobileMenuParams.megaMenuConfig) { 11 megaMenuConfig = window._enNavMobileMenuParams.megaMenuConfig; 12 megaMenuNav = _ennav.enNav; 13 } 14 if (!megaMenuNav) { 15 let navContainer = document.querySelector("[en-nav-mega-menu]"); 16 if (!navContainer) { 17 return; 18 }else { 19 megaMenuConfig = _enNavMegaMenuConfig; 20 } 21 if (navContainer.tagName === "HEADER" || navContainer.tagName === "DIV") { 22 megaMenuNav = navContainer.querySelector("nav.en-nav"); 23 } else if (navContainer.tagName === "NAV") { 24 megaMenuNav = navContainer; 25 } 26 } 27 28 if (!megaMenuNav || !megaMenuConfig) { 29 return; 30 } 31 32 let megaMenuJS = document.createElement(`script`); 33 megaMenuJS.src = scriptJS; 34 35 megaMenuJS.onload = () => { 36 megaMenuConfig.nav = megaMenuNav; 37 window._enNavMegaMenu = new EnMegaMenu(megaMenuConfig); 38 }; 39 40 document.head.appendChild(megaMenuJS); 41 42 if (mobileBreakpoint) { 43 appendCss("not " + mobileBreakpoint, desktopCSS); 44 appendCss(mobileBreakpoint, mobileCSS) 45 } else { 46 appendCss(``, desktopCSS); 47 } 48 49 function appendCss(media, href) { 50 const style = document.createElement('link'); 51 style.type = 'text/css'; 52 style.rel = 'stylesheet'; 53 if (media) { 54 style.media = media; 55 } 56 style.href = href; 57 document.head.append(style); 58 } 59 60}
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.