1class AbtPageNavigation extends HTMLElement { 2 breakpoint = 768; 3 button = null; 4 5 visibleY = 200; 6 7 constructor() { 8 super(); 9 10 this.button = document.querySelector('button[data-target="#abt-page-navigation"]'); 11 12 document.addEventListener('scroll', this.onScroll.bind(this)); 13 window.addEventListener('resize', this.onResize.bind(this)); 14 15 this.onScroll(); 16 } 17 18 onResize() { 19 if (window.innerWidth >= this.breakpoint 20 && this.button && this.button.getAttribute('aria-expanded') === 'true') { 21 this.button.click(); 22 } 23 } 24 25 onScroll() { 26 const visible = window.scrollY > this.visibleY; 27 28 if (visible) { 29 this.classList.add('visible'); 30 } else { 31 this.classList.remove('visible'); 32 33 if (this.button && this.button.getAttribute('aria-expanded') === 'true') { 34 this.button.click(); 35 } 36 } 37 } 38} 39 40customElements.define('abt-page-navigation', AbtPageNavigation);
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.