1function isElementInViewport($el) { 2 const rect = $el[0].getBoundingClientRect(); 3 return rect.bottom > 0 && rect.top < window.innerHeight; 4} 5 6function initCounterScroll() { 7 const $counters = $(".counter-item"); 8 9 if ($counters.length === 0) return; 10 11 function updateCounters() { 12 $counters.each(function () { 13 const $counter = $(this); 14 if (isElementInViewport($counter) && !$counter.hasClass("counted")) { 15 $counter.addClass("counted"); 16 const targetNumber = $counter.find(".odometer").data("number"); 17 $counter.find(".odometer").text(targetNumber); 18 } 19 }); 20 } 21 22 // Throttle scroll event (má»i 200ms) 23 let timeout; 24 $(window).on("scroll", function () { 25 if (!timeout) { 26 timeout = setTimeout(function () { 27 updateCounters(); 28 timeout = null; 29 }, 200); 30 } 31 }); 32 updateCounters(); 33} 34 35 36$(document).ready(function () { 37 if ($(".counter-scroll").length > 0) { 38 initCounterScroll(); 39 } 40});
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.