1const progressJS = { 2 defaults: { 3 attach: null, 4 round: 2 5 }, 6 start: function(configs = {}) { 7 const { attach: attachSelector, round: roundto } = { ...this.defaults, ...configs }; 8 const progressJSelem = document.createElement("div"); 9 progressJSelem.classList.add("progress-bar"); 10 document.body.appendChild(progressJSelem); 11 const attachElem = attachSelector ? document.querySelector(attachSelector) : null; 12 const maxHeight = document.body.scrollHeight; 13 const sizeHeight = window.innerHeight; 14 let formattedPercentage; 15 function updateProgressBar() { 16 const scrolls = window.scrollY; 17 const percentageValue = (scrolls / (maxHeight - sizeHeight)) * 100; 18 formattedPercentage = percentageValue.toFixed(roundto); 19 progressJSelem.style.width = `${formattedPercentage}%`; 20 if (attachElem) { 21 attachElem.textContent = formattedPercentage; 22 } 23 requestAnimationFrame(updateProgressBar); 24 } 25 requestAnimationFrame(updateProgressBar); 26 } 27} 28progressJS.start();
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.