1(function($){ 2 3 $(document).ready(function() { 4 5 if(typeof $.ZnThemeJs != 'undefined') { 6 7 var fw = $.ZnThemeJs; 8 var counter_element = function( scope ) { 9 10 var elements = scope.find('.zn-counterElm'); 11 12 if(elements && elements.length){ 13 elements.each(function(i, el){ 14 15 if(typeof($.fn.countTo) != 'undefined') { 16 17 var $el = $(el), 18 $params = $el.is("[data-zn-count]") ? JSON.parse( $el.attr("data-zn-count") ) : {}, 19 $paramsInt = {}, 20 loaded = false; 21 22 $.map( $params, function( val, i ) { 23 $paramsInt[i] = parseInt(val); 24 }); 25 26 var doElement = function(){ 27 // animate counter 28 $el.addClass('is-appeared').countTo( $paramsInt ); 29 // set loaded 30 loaded = true; 31 }; 32 33 var isInViewport = function(element) { 34 var rect = element.getBoundingClientRect(); 35 var html = document.documentElement; 36 var tolerance = rect.height * 0.75; // 3/4 of itself 37 return ( 38 rect.top >= -tolerance 39 && rect.bottom <= (window.innerHeight || html.clientHeight) + tolerance 40 ); 41 }; 42 43 // If it's in viewport, load it 44 $(window).on('scroll', function() { 45 if( isInViewport( $el[0] ) ){ 46 if(!loaded){ 47 doElement(); 48 } 49 } 50 }).trigger('scroll'); 51 } 52 }); 53 } 54 }; 55 56 $.extend( true, fw.prototype.zinit, counter_element( $(document) ) ); 57 58 $(window).on('ZnNewContent',function(e){ 59 counter_element( e.content ); 60 }); 61 } 62 63 }); 64 65})(jQuery);
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.