1jQuery(document).ready(function ($) 2{ 3 const allSubMenus = $(".header-navigation .sub-menu-wrapper") 4 const $rootSubMenus = $(".header-navigation .sub-menu-wrapper.depth-0") 5 const $deeperSubMenus = $(".header-navigation .sub-menu-wrapper.depth-1") 6 let $hoveredLi = false 7 let hideTimeout = false 8 let switchTimeout = false 9 const hideDelay = 800 10 const switchDelay = 500 11 12 // Move submenus inside their parent 13 allSubMenus.each(function () 14 { 15 const $parentLi = $(this).prev() 16 $($parentLi).append($(this)) 17 }) 18 19 // If on mobile, stop here 20 if ($("#mobile-navigation").css('display') !== 'none') 21 return 22 23 // Deeper submenu behaviour -------------------------------------------- 24 25 $deeperSubMenus.each(function () 26 { 27 const $parentLi = $(this).parent() 28 $parentLi.hover(onDeeperLiMouseOver, onDeeperLiMouseOut) 29 }) 30 31 function onDeeperLiMouseOver() 32 { 33 const $parentLi = $(this) 34 $parentLi.find(">.sub-menu-wrapper").show() 35 } 36 37 function onDeeperLiMouseOut() 38 { 39 const $parentLi = $(this) 40 $parentLi.find(">.sub-menu-wrapper").hide() 41 } 42 43 // Root submenu behaviour -------------------------------------------- 44 45 $rootSubMenus.each(function () 46 { 47 const $parentLi = $(this).parent() 48 // Add unique ID to parent 49 // $parentLi.attr('id', generateID(16)) 50 // Setup behaviour 51 $parentLi.hover(onRootLiMouseOver, onRootLiMouseOut) 52 }) 53 54 function onRootLiMouseOver() 55 { 56 const $parentLi = $(this) 57 // const id = $parentLi.attr('id') 58 const wasAnotherItemActive = $hoveredLi !== false 59 60 // console.log(id, 'OVER', wasAnotherItemActive) 61 62 $parentLi.addClass('active') 63 64 clearTimeout(hideTimeout) 65 $hoveredLi = $parentLi 66 67 if (wasAnotherItemActive) 68 { 69 clearTimeout(switchTimeout) 70 switchTimeout = setTimeout(updateRootSubMenus, switchDelay) 71 } 72 else 73 updateRootSubMenus() 74 } 75 76 function onRootLiMouseOut() 77 { 78 const $parentLi = $(this) 79 // const id = $parentLi.attr('id') 80 81 // console.log('OUT', $parentLi, $hoveredLi) 82 83 hideTimeout = setTimeout(() => 84 { 85 $hoveredLi = false 86 $parentLi.removeClass('active') 87 updateRootSubMenus() 88 }, hideDelay) 89 } 90 91 function updateRootSubMenus() 92 { 93 // Hide all root submenus 94 $rootSubMenus.hide() 95 // Remove all active classes 96 $rootSubMenus.each(function () 97 { 98 const $parentLi = $(this).parent() 99 $parentLi.removeClass('active') 100 }) 101 102 // Show hovered submenu if exists 103 if ($hoveredLi) 104 { 105 $hoveredLi.addClass('active') 106 $hoveredLi.find(">.sub-menu-wrapper").show() 107 } 108 } 109 110 /*function generateID(length) 111 { 112 var arr = new Uint8Array((length || 40) / 2) 113 window.crypto.getRandomValues(arr) 114 return Array.from(arr, dec2hex).join('') 115 } 116 117 function dec2hex(dec) 118 { 119 return dec.toString(16).padStart(2, "0") 120 }*/ 121})
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.