1'use strict';class ScrollToggle{constructor(element){if(!(element instanceof HTMLElement)){throw new Error('Parameter `element` must be a `HTMLElement`.')} 2this.element=element;this.elementRect=undefined;this.isEnabled=undefined;window.addEventListener('scroll',this.checkScroll.bind(this));window.addEventListener('resize',this.calculate.bind(this));this.calculate()} 3enable(){this.toggle(!0)} 4disable(){this.toggle(!1)} 5toggle(isEnabled){if(isEnabled===undefined){isEnabled=!this.isEnabled}else if(isEnabled===this.isEnabled){return} 6this.isEnabled=isEnabled;this.element.classList.toggle('scroll-toggle--enabled',this.isEnabled);this.element.classList.toggle('scroll-toggle--disabled',!this.isEnabled);this.dispatchEvent('scrollToggle')} 7checkScroll(){if(this.isScrollPastTogglePosition()){this.enable()}else{this.disable()}} 8isScrollPastTogglePosition(){return this.elementRect&&window.scrollY>this.elementRect.bottom} 9calculate(){this.disable();window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const bounds=this.element.getBoundingClientRect();this.elementRect={};this.elementRect.y=bounds.y+window.scrollY;this.elementRect.height=bounds.height;this.elementRect.bottom=this.elementRect.y+this.elementRect.height;this.dispatchEvent('scrollToggleCalculate');this.checkScroll()})})} 10dispatchEvent(eventName){const event=new CustomEvent(eventName,{detail:this});this.element.dispatchEvent(event)}}
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.