1/*! data-type: counter */ 2(function() { 3 'use strict'; 4 5 /* counter */ 6 let counter = document.querySelectorAll("[data-type='counter']"); 7 if (counter) { 8 function counting(el) { 9 let counter = el; 10 let duration = el.dataset.duration ? el.dataset.duration : 2000; 11 let start = el.dataset.start ? el.dataset.start : 0; 12 let target = el.dataset.count; 13 let value = start; 14 let begin = 0; 15 let dots = el.dataset.dots ? el.dataset.dots == 'true' : true; 16 function writeNumber(x) { 17 if (dots) { 18 x = x.toString(); 19 var pattern = /(-?\d+)(\d{3})/; 20 while (pattern.test(x)) { 21 x = x.replace(pattern, "$1.$2"); 22 } 23 } 24 el.innerHTML = x; 25 } 26 function easeInOutCubic(t){ 27 return t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1; 28 }; 29 function count(now) { 30 if (now >= begin + duration) { 31 writeNumber(target); 32 } else { 33 writeNumber(Math.floor(begin + (target - begin) * easeInOutCubic((now - begin) / duration))); 34 requestAnimationFrame(count); 35 } 36 } 37 function startCounting(timestamp) { 38 begin = timestamp; 39 count(timestamp); 40 } 41 if (target) { 42 requestAnimationFrame(startCounting); 43 } 44 } 45 let observer = new IntersectionObserver(function(entries) { 46 for (let i=0; i < entries.length; i++) { 47 if (entries[i].isIntersecting) { 48 counting(entries[i].target); 49 observer.unobserve(entries[i].target); 50 } 51 } 52 }, 53 { 54 threshold: [0.1], 55 delay: 100 56 }); 57 for (let i=0; i<counter.length; i++) { 58 observer.observe(counter[i]); 59 } 60 } 61 62})();
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.