1document.addEventListener('DOMContentLoaded', () => { 2 const DELAY = 800; 3 const menuSelectors = [ 4 '.kb-navigation .menu-item-has-children:not(.kb-nav-link-sub-click)', // Kadence Advanced Navigation 5 '.wp-block-navigation .has-child:not(.open-on-click)' // WordPress core Navigation 6 ].join(', '); 7 8 const navigationItems = document.querySelectorAll(menuSelectors); 9 10 if (!navigationItems.length) { 11 return; 12 } 13 14 navigationItems.forEach((menuItem) => { 15 let timeoutId = null; 16 17 menuItem.addEventListener('mouseenter', () => { 18 clearTimeout(timeoutId); 19 requestAnimationFrame(() => { 20 timeoutId = setTimeout(() => { 21 navigationItems.forEach((other) => { 22 if (other !== menuItem && !other.contains(menuItem)) { 23 other.classList.remove('delay'); 24 } 25 }); 26 27 menuItem.classList.add('delay'); 28 }, 0); 29 }); 30 }); 31 32 menuItem.addEventListener('mouseleave', (e) => { 33 clearTimeout(timeoutId); 34 35 if (menuItem.contains(e.relatedTarget)) { 36 return; 37 } 38 39 requestAnimationFrame(() => { 40 timeoutId = setTimeout(() => { 41 menuItem.classList.remove('delay'); 42 }, DELAY); 43 }); 44 }); 45 }); 46});
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.