1"use strict"; 2 3// Set jQuery to NoConflict Mode 4jQuery.noConflict(); 5(function ($, window, document, undefined) { 6 $(function () { 7 var $document = $(document); 8 var $bar = $(".vw-reading-progress"); 9 var $contentarea = $(".vw-main-post"); 10 11 // Exit when no content area 12 if (!$contentarea.length) return; 13 14 // Get start and end point of content aread 15 var viewport = window.innerHeight; 16 var viewportThreshold = viewport * 0.5; // Offset -50% of viewport 17 var start = $contentarea.offset().top - viewportThreshold; 18 var end = start + $contentarea.outerHeight() - viewportThreshold; 19 20 var onScroll = (e) => { 21 var scrollTop = $document.scrollTop(); 22 23 if (scrollTop > start && scrollTop < end) { 24 $bar.removeClass("vw-reading-progress-inactive"); 25 $bar.addClass("vw-reading-progress-active"); 26 $bar.css("width", ((scrollTop - start) / (end - start)) * 100 + "%"); 27 } else { 28 $bar.removeClass("vw-reading-progress-active"); 29 $bar.addClass("vw-reading-progress-inactive"); 30 } 31 }; 32 33 document.addEventListener("scroll", onScroll, { passive: true }); 34 }); 35})(jQuery, window, document);
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.