1/* Laserum Menu â front-end behaviour (megas hover/click, search toggle, 2 mobile drawer). PORTED VERBATIM from the prototype menu-laserum.html. */ 3(function(){ 4 var nav=document.querySelector('.nav'); 5 var items=[].slice.call(document.querySelectorAll('.nav>li.has-mega')); 6 var t; 7 function closeAll(){items.forEach(function(li){li.classList.remove('open');var b=li.querySelector('.nav-link');if(b)b.setAttribute('aria-expanded','false');});} 8 function open(li){items.forEach(function(o){if(o!==li)o.classList.remove('open');});li.classList.add('open');var b=li.querySelector('.nav-link');if(b)b.setAttribute('aria-expanded','true');} 9 items.forEach(function(li){ 10 li.addEventListener('mouseenter',function(){clearTimeout(t);open(li);}); 11 li.addEventListener('mouseleave',function(){t=setTimeout(closeAll,150);}); 12 var b=li.querySelector('.nav-link'); 13 b.addEventListener('click',function(e){e.preventDefault();li.classList.contains('open')?closeAll():open(li);}); 14 }); 15 document.addEventListener('click',function(e){if(nav&&!nav.contains(e.target))closeAll();}); 16 // pesquisa: a lupa abre uma barra full-width sobreposta; fica aberta até clicar no X (ou Esc) 17 var panel=document.querySelector('.hdr-search'); 18 var stog=document.querySelector('.ns-toggle'); 19 if(panel&&stog){ 20 var sinp=panel.querySelector('.hs-input'), sclose=panel.querySelector('.hs-close'); 21 function openSearch(){closeAll();panel.classList.add('open');stog.setAttribute('aria-expanded','true');setTimeout(function(){if(sinp)sinp.focus();},140);} 22 function closeSearch(){panel.classList.remove('open');stog.setAttribute('aria-expanded','false');} 23 stog.addEventListener('click',function(e){e.preventDefault();e.stopPropagation();panel.classList.contains('open')?closeSearch():openSearch();}); 24 if(sclose)sclose.addEventListener('click',function(e){e.preventDefault();closeSearch();stog.focus();}); 25 document.addEventListener('keydown',function(e){if(e.key==='Escape')closeSearch();}); 26 } 27 // pesquisa no drawer móvel: a lupa revela o campo 28 var mstog=document.querySelector('.lm-search-toggle'), msrch=document.querySelector('.lm-search'); 29 if(mstog&&msrch){ 30 var minp=msrch.querySelector('.lm-search-input'); 31 mstog.addEventListener('click',function(e){e.preventDefault(); 32 var op=msrch.classList.toggle('open');mstog.setAttribute('aria-expanded',op?'true':'false'); 33 if(op&&minp)setTimeout(function(){minp.focus();},120);}); 34 } 35 // mobile drawer: close on link click + ESC (toggle is CSS :checked) 36 var cb=document.getElementById('lm-toggle'); 37 if(cb){ 38 document.querySelectorAll('.lm-drawer a').forEach(function(l){l.addEventListener('click',function(){cb.checked=false;});}); 39 document.addEventListener('keydown',function(e){if(e.key==='Escape'){cb.checked=false;closeAll();}}); 40 } 41})();
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.