1/** 2 * stats-band.js â viewScript do bloco Stats Band 3 * Anima o contador ao entrar na viewport e aplica .is-visible. 4 */ 5 6( function () { 7 'use strict'; 8 9 function animateCount( el ) { 10 var target = parseInt( el.dataset.count, 10 ); 11 var suffix = el.dataset.suffix || ''; 12 if ( isNaN( target ) ) return; 13 14 var duration = 1200; 15 var start = null; 16 17 function step( timestamp ) { 18 if ( ! start ) start = timestamp; 19 var progress = Math.min( ( timestamp - start ) / duration, 1 ); 20 var eased = 1 - Math.pow( 1 - progress, 3 ); 21 el.textContent = Math.floor( eased * target ) + suffix; 22 if ( progress < 1 ) requestAnimationFrame( step ); 23 } 24 25 requestAnimationFrame( step ); 26 } 27 28 var items = document.querySelectorAll( '.stats-band__item' ); 29 if ( ! items.length ) return; 30 31 var observer = new IntersectionObserver( 32 function ( entries ) { 33 entries.forEach( function ( entry ) { 34 if ( entry.isIntersecting ) { 35 entry.target.classList.add( 'is-visible' ); 36 var counter = entry.target.querySelector( '[data-count]' ); 37 if ( counter ) animateCount( counter ); 38 observer.unobserve( entry.target ); 39 } 40 } ); 41 }, 42 { threshold: 0.15 } 43 ); 44 45 items.forEach( function ( el ) { observer.observe( el ); } ); 46} )();
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.