1'use strict' 2 3const HSBsDropdown = { 4 init(options) { 5 this.setAnimations() 6 this.openOnHover() 7 }, 8 9 setAnimations() { 10 window.addEventListener('show.bs.dropdown', el => { 11 const animation = el.target.hasAttribute('data-bs-dropdown-animation') 12 if (!animation) return 13 14 const menu = el.target.nextElementSibling 15 menu.style.opacity = 0 16 setTimeout(() => { 17 menu.style.transform = `${menu.style.transform} translateY(10px)` 18 }) 19 setTimeout(() => { 20 menu.style.transform = `${menu.style.transform} translateY(-10px)` 21 menu.style.transition = 'transform 300ms, opacity 300ms' 22 menu.style.opacity = 1 23 }, 100) 24 }) 25 26 window.addEventListener('hide.bs.dropdown', el => { 27 const animation = el.target.hasAttribute('data-bs-dropdown-animation') 28 if (!animation) return 29 30 const menu = el.target.nextElementSibling 31 setTimeout(() => { 32 menu.style.removeProperty('transform') 33 menu.style.removeProperty('transition') 34 }) 35 }) 36 }, 37 38 openOnHover() { 39 const $targets = Array.from(document.querySelectorAll('[data-bs-open-on-hover]')) 40 41 $targets.forEach($target => { 42 var timeout 43 const instance = new bootstrap.Dropdown($target) 44 45 function close() { 46 timeout = setTimeout(() => { 47 instance.hide() 48 }, 500) 49 } 50 51 $target.addEventListener('mouseenter', () => { 52 clearTimeout(timeout) 53 instance.show() 54 }) 55 56 instance._menu.addEventListener('mouseenter', () => { 57 window.clearTimeout(timeout) 58 }) 59 60 Array.from([instance._menu, $target]).forEach($el => $el.addEventListener('mouseleave', close)) 61 }) 62 } 63}
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.