1import {body, subMenuPosition} from './menu.js'; 2 3const searchBox = document.querySelectorAll('.search-box-mobile, .search-box'); 4const closesearchBox = document.querySelector('.close-search'); 5const main = document.querySelector('main'); 6const lisA = document.querySelectorAll('.main-navigation > li > a'); 7 8searchBox.forEach(function (searchBoxItem) { 9 searchBoxItem.addEventListener('click', (e) => { 10 e.preventDefault(); 11 12 if (window.innerWidth > 991) { 13 if (window.scrollY < 51) { 14 subMenuPosition(151); 15 } else { 16 subMenuPosition(81); 17 } 18 } else if (window.scrollY < 51) { 19 subMenuPosition(150); 20 } else { 21 subMenuPosition(80); 22 } 23 24 body.classList.remove('main-menu-active'); 25 body.classList.toggle('search-popup-open'); 26 document.querySelector('input[type=search]').focus(); 27 }); 28}); 29 30closesearchBox.addEventListener('click', function (e) { 31 e.preventDefault(); 32 body.classList.remove('search-popup-open'); 33}); 34 35document.addEventListener('click', function (e) { 36 if (!e.target.closest('.search-popup, .search-box, .search-box-mobile')) { 37 body.classList.remove('search-popup-open'); 38 } 39}); 40 41main.addEventListener('focusin', function () { 42 body.classList.remove('search-popup-open'); 43}); 44 45lisA.forEach(function (li) { 46 li.addEventListener('focus', function () { 47 body.classList.remove('search-popup-open'); 48 }); 49});
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.