1( function () { 2 'use strict'; 3 4 function animateChart( chart ) { 5 chart.querySelectorAll( '.simple-data__bar' ).forEach( function ( bar, i ) { 6 setTimeout( function () { 7 bar.classList.add( 'is-animating' ); 8 }, i * 120 ); 9 } ); 10 } 11 12 function init() { 13 var charts = document.querySelectorAll( '.simple-data__chart' ); 14 if ( ! charts.length ) return; 15 16 if ( ! ( 'IntersectionObserver' in window ) ) { 17 charts.forEach( animateChart ); 18 return; 19 } 20 21 var observer = new IntersectionObserver( function ( entries ) { 22 entries.forEach( function ( entry ) { 23 if ( entry.isIntersecting ) { 24 animateChart( entry.target ); 25 observer.unobserve( entry.target ); 26 } 27 } ); 28 }, { threshold: 0.2 } ); 29 30 charts.forEach( function ( chart ) { 31 observer.observe( chart ); 32 } ); 33 } 34 35 if ( document.readyState === 'loading' ) { 36 document.addEventListener( 'DOMContentLoaded', init ); 37 } else { 38 init(); 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.