1class EditorPlusCounter { 2 constructor(wrapper) { 3 this.container = wrapper; 4 this.counterNumber = this.container.querySelector(".ep_counter_number"); 5 this.startCount = parseInt(this.container.dataset.startnum, 10); 6 this.stopCounter = parseInt(this.container.dataset.endnum, 10); 7 this.animationDuration = parseInt(this.container.dataset.animduration, 10); 8 this.frameDuration = 1000 / 60; 9 this.totalFrames = Math.round((this.animationDuration * 1000) / this.frameDuration); 10 this.easeOutQuad = t => t * (2 - t); 11 this.initialize(); 12 } 13 initialize() { 14 this.observation(); 15 } 16 updateCounter() { 17 let frame = 0; 18 const countTo = this.stopCounter - this.startCount; 19 20 let interval = setInterval(() => { 21 22 frame++; 23 24 const progress = this.easeOutQuad(frame / this.totalFrames); 25 const currentCount = Math.round(countTo * progress) + this.startCount; 26 27 if (parseInt(this.counterNumber.innerHTML, 10) !== currentCount) { 28 this.counterNumber.innerHTML = currentCount; 29 } 30 31 if (frame === this.totalFrames) { 32 clearInterval(interval); 33 } 34 35 }, this.frameDuration); 36 } 37 observation() { 38 const counterAnimation = document.querySelectorAll(".ep_counter_number"); 39 counterAnimation.forEach((animationElem) => { 40 animationElem.style.visibility = "hidden"; 41 const observer = new IntersectionObserver( 42 (entries, observer) => { 43 const [entry = null] = entries; 44 if ( 45 entry && 46 entry.isIntersecting && 47 animationElem.isSameNode(this.counterNumber) 48 ) { 49 animationElem.style.visibility = "visible"; 50 this.updateCounter(); 51 observer.disconnect() 52 } 53 }, 54 { 55 rootMargin: "0px", 56 threshold: 1.0, 57 } 58 ); 59 observer.observe(animationElem); 60 }); 61 } 62} 63window.addEventListener("load", () => { 64 const wrappers = document.querySelectorAll(".epc_num"); 65 wrappers.forEach((wrapper) => new EditorPlusCounter(wrapper)); 66});
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.