1document.addEventListener('DOMContentLoaded', function (e) { 2 const arrow = '<button class="open-sub-menu"></button>'; 3 const mobileSubmenuList = document.querySelectorAll('.new-menu .menu-item-has-children'); 4 const newMenu = document.querySelector('.new-menu'); 5 const megaMenuList = document.querySelectorAll('.mega-menu-categories li'); 6 const headerMenuList = document.querySelectorAll('header .wd-header-main-nav li'); 7 8 if (megaMenuList.length) { 9 megaMenuList.forEach(li => { 10 const submenu = li.querySelector('ul'); 11 if (submenu) { 12 const link = submenu.previousElementSibling; 13 link.insertAdjacentHTML('afterend', arrow); 14 } 15 }) 16 } 17 18 19 if (mobileSubmenuList.length) { 20 mobileSubmenuList.forEach(li => { 21 const submenu = li.querySelector('ul'); 22 if (submenu) { 23 const link = submenu.previousElementSibling; 24 link.insertAdjacentHTML('afterend', arrow); 25 } 26 }) 27 } 28 29 if (headerMenuList.length) { 30 headerMenuList.forEach(li => { 31 const submenu = li.querySelector('ul'); 32 const link = li.querySelector('.woodmart-nav-link'); 33 if (submenu) { 34 link.insertAdjacentHTML('afterend', arrow); 35 } 36 }) 37 } 38 39 document.addEventListener('click', function (e) { 40 const targetEl = e.target; 41 42 // faq popup 43 if (targetEl.classList.contains('faq__popup-close')) { 44 targetEl.closest('.faq__popup').classList.remove('_open') 45 } 46 if (targetEl.classList.contains('faq__popup')) { 47 targetEl.classList.remove('_open') 48 } 49 // faq popup 50 51 52 // new menu 53 if (targetEl.classList.contains('open-mobile-menu')) { 54 targetEl.classList.toggle('_open') 55 newMenu.classList.toggle('_open') 56 document.body.classList.toggle('_lock') 57 } 58 59 if (targetEl.classList.contains('new-menu__close') || targetEl.classList.contains('new-menu')) { 60 targetEl.classList.remove('_open') 61 newMenu.classList.remove('_open') 62 document.body.classList.remove('_lock') 63 } 64 65 if (targetEl.classList.contains('open-sub-menu')) { 66 targetEl.closest('li').classList.toggle('_active') 67 } 68 // new menu 69 70 // mega menu 71 const megaMenu = document.querySelector('.mega-menu'); 72 if (targetEl.classList.contains('open-mega-menu')) { 73 targetEl.classList.toggle('_active') 74 megaMenu.classList.toggle('_open') 75 } 76 77 if (targetEl.classList.contains('subcat-open')) { 78 targetEl.closest('li').classList.toggle('_active') 79 } 80 81 if (!targetEl.classList.contains('open-mega-menu') && !targetEl.classList.contains('mega-menu') && !targetEl.closest('.mega-menu') && megaMenu.classList.contains('_open')) { 82 megaMenu.classList.remove('_open') 83 document.querySelector('.open-mega-menu._active').classList.remove('_active') 84 } 85 86 if (targetEl.classList.contains('mega-menu-close')) { 87 megaMenu.classList.remove('_open') 88 document.querySelector('.open-mega-menu._active').classList.remove('_active') 89 } 90 91 if (targetEl.classList.contains('mega-menu') && window.innerWidth <= 1024) { 92 megaMenu.classList.remove('_open') 93 document.querySelector('.open-mega-menu._active').classList.remove('_active') 94 } 95 // mega menu 96 }) 97})
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.