1/** 2 * Electric News - Single Post Interactions & Reading Bar 3 */ 4 5document.addEventListener('DOMContentLoaded', () => { 6 const progressBar = document.querySelector('.reading-progress-bar'); 7 const article = document.querySelector('.article-content'); 8 9 if (progressBar && article) { 10 window.addEventListener('scroll', () => { 11 const articleTop = article.offsetTop; 12 const articleHeight = article.offsetHeight; 13 const windowHeight = window.innerHeight; 14 const scrollY = window.scrollY; 15 16 if (scrollY < articleTop) { 17 progressBar.style.width = '0%'; 18 } else if (scrollY > articleTop + articleHeight - windowHeight) { 19 progressBar.style.width = '100%'; 20 } else { 21 const progress = ((scrollY - articleTop) / (articleHeight - windowHeight)) * 100; 22 progressBar.style.width = `${Math.min(100, Math.max(0, progress))}%`; 23 } 24 }, { passive: true }); 25 } 26});
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.