1class EditorPlusProgressBar { 2 constructor(wrapper) { 3 this.wrapper = wrapper; 4 this.progressBar = this.wrapper.querySelector(".ep_pb"); 5 this.percentage = this.wrapper.querySelector(".ep_pb_percentage"); 6 this.progressBarPercentage = Number(this.wrapper.dataset.eppercentage); 7 this.showPercentage = this.wrapper.dataset.epdpercentage; 8 9 this.count = 0; 10 this.initialize(); 11 } 12 initialize() { 13 this.observation(); 14 } 15 updateCounter = () => { 16 let isPercentageShow = this.showPercentage === "true" ? true : false; 17 this.percentageCounter(); 18 if (isPercentageShow) { 19 if (this.count < this.progressBarPercentage) { 20 this.percentage.innerHTML = this.count + 1 + "%"; 21 requestAnimationFrame(this.updateCounter); 22 } else { 23 cancelAnimationFrame(this.updateCounter); 24 } 25 } 26 }; 27 percentageCounter() { 28 if (this.count < this.progressBarPercentage) { 29 this.count++; 30 } 31 } 32 setPercentage() { 33 this.progressBar.style.width = this.progressBarPercentage + "%"; 34 this.progressBar.style.transition = "1.5s"; 35 } 36 observation() { 37 const progressBarAnimation = document.querySelectorAll(".ep_pb"); 38 progressBarAnimation.forEach((animationElem) => { 39 animationElem.style.visibility = "hidden"; 40 41 const observer = new IntersectionObserver( 42 (entries, observer) => { 43 const [entry = null] = entries; 44 if ( 45 entry && 46 entry.isIntersecting && 47 animationElem.isSameNode(this.progressBar) 48 ) { 49 animationElem.style.visibility = "visible"; 50 this.setPercentage(); 51 let counter = requestAnimationFrame(this.updateCounter); 52 observer.disconnect(); 53 } 54 }, 55 { 56 rootMargin: "0px", 57 threshold: 1.0, 58 } 59 ); 60 observer.observe(animationElem); 61 }); 62 } 63} 64window.addEventListener("load", () => { 65 const wrappers = document.querySelectorAll(".progress_bar_wrapper"); 66 wrappers.forEach((wrapper) => new EditorPlusProgressBar(wrapper)); 67});
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.