1function HeaderMarquee() { 2 const component = { 3 marquee: null, 4 5 init() { 6 this.marquee = document.querySelector('[data-marquee]') 7 if (!this.marquee) return 8 9 const list = this.marquee.querySelector('.header-marquee__list') 10 if (list) { 11 const fragment = document.createDocumentFragment() 12 Array.from(list.children).forEach((el) => { 13 fragment.appendChild(el.cloneNode(true)) 14 }) 15 list.appendChild(fragment) 16 17 const speedPxPerSec = 60 18 const distance = list.scrollWidth / 2 19 const durationSec = distance / speedPxPerSec 20 this.marquee.style.setProperty('--marquee-duration', `${durationSec}s`) 21 } 22 23 this.marquee.addEventListener('mouseenter', () => this.pause()) 24 this.marquee.addEventListener('mouseleave', () => this.play()) 25 }, 26 27 pause() { 28 this.marquee?.setAttribute('data-marquee-paused', '') 29 }, 30 31 play() { 32 this.marquee?.removeAttribute('data-marquee-paused') 33 }, 34 } 35 component.init() 36} 37 38if (typeof window !== 'undefined') { 39 window.addEventListener('ReactContentLoaded', HeaderMarquee) 40 document.addEventListener('DOMContentLoaded', HeaderMarquee) 41}
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.