1document.addEventListener('DOMContentLoaded', () => { 2 const counters = document.querySelectorAll('.counter'); 3 4 const formatNumber = (num, isPercent) => { 5 const rounded = Math.round(num); 6 return isPercent ? `${rounded}%` : rounded.toLocaleString('pl-PL').replace(/\u00A0/g, ' '); 7 }; 8 9 const animateCounter = (el) => { 10 const stop = parseFloat(el.getAttribute('data-stop')); 11 const speed = parseInt(el.getAttribute('data-speed')) || 1500; 12 const isPercent = el.textContent.trim().includes('%'); 13 14 let current = 0; 15 let frame = 0; 16 const totalFrames = 60; 17 const increment = stop / totalFrames; 18 const frameDuration = speed / totalFrames; 19 20 const update = () => { 21 frame++; 22 current += increment; 23 if (frame < totalFrames) { 24 el.textContent = formatNumber(current, isPercent); 25 setTimeout(update, frameDuration); 26 } else { 27 el.textContent = formatNumber(stop, isPercent); 28 } 29 }; 30 31 update(); 32 }; 33 34 const observer = new IntersectionObserver((entries, obs) => { 35 entries.forEach(entry => { 36 if (entry.isIntersecting) { 37 animateCounter(entry.target); 38 obs.unobserve(entry.target); 39 } 40 }); 41 }, { 42 threshold: 0.6 43 }); 44 45 counters.forEach(counter => { 46 observer.observe(counter); 47 }); 48}); 49 50 51// /* 52// _ _ _ _ _ 53// ____ __| | ____(_) ___ | | ___ __ __(_) ___ ____ _ __ | | 54// |_ // _` ||_ /| |/ __|| | / _ \\ \ /\ / /| | / __||_ / | '_ \ | | 55// / /| (_| | / / | |\__ \| || (_) |\ V V / | || (__ / / _ | |_) || | 56// /___|\__,_|/___||_||___/|_| \___/ \_/\_/ |_| \___|/___|(_)| .__/ |_| 57// |_| 58 59// COUNTER PLUGIN 60// www.zdzislowicz.pl 61// [email protected] 62 63// all rights reserved 64// */ 65 66// $.fn.zCounter = function(options) { 67// var element = this; 68 69// var settings = $.extend({ 70// start: parseInt(element.attr('data-start')), 71// stop: parseInt(element.attr('data-stop')), 72// speed: parseInt(element.attr('data-speed')), 73// value: parseInt(element.attr('data-start')) 74// }, options); 75 76// function run(element) { 77// settings.value++; 78 79// if(settings.value < settings.stop + 1) 80// { 81// // element.html((settings.value)); 82// // element.attr('data-start', settings.value); 83 84// } 85// }; 86 87// if(settings.value == 0) 88// { 89// setInterval(function() { 90// run(element) 91// }, settings.speed / settings.stop); 92// } 93// }; 94 95// $(document).ready(function() { 96// function zCounterRun() { 97// $(".counter").each(function(s) { 98// var a = $(this).offset().top; 99 100// if($(window).scrollTop() + $(window).height() / 4 * 3.5 > a) 101// $(this).zCounter(); 102// }); 103// } 104 105// $(window).scroll(function() { 106// zCounterRun(); 107// }); 108// zCounterRun(); 109// });
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.