1/* 2* TF-Numbers 3* Author : Aleksej Vukomanovic 4*/ 5 6//Statistics in numbers 7jQuery.fn.statsCounter = function(){ 8 //declaring vars 9 var stat = this.find('.statistics-inner').children(); 10 var startValue = 0; 11 12 //iterate through every .stat class and collect values 13 stat.each(function(){ 14 var count = parseInt( jQuery(this).data('count'), 10 ); 15 var number = jQuery(this).find('.number'); 16 var start = 0; 17 var go = setInterval(function(){ startCounter(); },1); //increment value every 1ms 18 19 function startCounter(){ 20 incrementBy = Math.round(count / 90); //Divide inputed number by 90 to gain optimal speed (not too fast, not too slow) 21 if( count < 90 ) incrementBy = Math.round(count / 5); 22 if( count < 5 ) incrementBy = Math.round(count / 2); 23 start = start + incrementBy; 24 if( count != 0 ) { 25 jQuery(number).text(start); 26 } else { 27 jQuery(number).text(0); 28 start = count; 29 } 30 //if desired number reched, stop counting 31 if( start === count ) { 32 clearInterval(go); 33 } else if( start >= count ){ //or if greater than selected num - stop and return value 34 clearInterval(go); 35 jQuery(number).text(count); 36 } 37 }//startCounter; 38 });//stat.each() 39}//statsCounter(); 40 41 //if visible src = http://www.rupertlanuza.com/how-to-check-if-element-is-visible-in-the-screen-using-jquery/ 42 function isElementVisible(elementToBeChecked) { 43 var TopView = jQuery(window).scrollTop(); 44 var BotView = TopView + jQuery(window).height(); 45 var TopElement = jQuery(elementToBeChecked).offset().top; 46 var BotElement = TopElement + jQuery(elementToBeChecked).height(); 47 return ((BotElement <= BotView) && (TopElement >= TopView)); 48 } 49 50jQuery(document).ready(function(jQuery){ 51 52 var statistics = jQuery('.statistics'); 53 var n = 0; 54 55 if( statistics.length > 0 ) { 56 57 statistics.each(function(){ 58 var thisStats = jQuery(this); 59 var statId = thisStats.attr('id'); 60 thisStats.addClass( 'stats-custom-' + n ); 61 62 //setting counts to 0 63 if( jQuery('.stat').length > 0 ){ 64 var stat = thisStats.find('.stat'); 65 stat.each(function(){ 66 var icon = jQuery(this).find('span'); 67 icon.each(function(){ 68 var val = jQuery(this).attr('class'); 69 if( val.indexOf('.') != -1 && jQuery(this).find('img').length <= 0 ) { 70 jQuery(this).append('<img src="'+val+'" />'); 71 } 72 }); 73 stat.find('.number').text(0); 74 }) 75 } 76 //animating when scrolled 77 var countDone = 0; 78 var cmo = thisStats.data('cmo'); 79 80 81 if( jQuery(window).width() > 780 ) { 82 var visible = isElementVisible('#' + statId); 83 if( visible && countDone == 0 ) { //check if it's not already done 84 setTimeout(function(){ 85 thisStats.statsCounter(); 86 countDone = 1; 87 },600); 88 }//if visible && not shown 89 jQuery(window).scroll(function(){ 90 var visible = isElementVisible('#' + statId); 91 92 //if stats section visible, start the counting after 400ms 93 if( visible && countDone == 0 ) { //check if it's not already done 94 setTimeout(function(){ 95 thisStats.statsCounter(); 96 countDone = 1; 97 },400); 98 }//if visible && not shown 99 });//scroll function 100 } else { 101 thisStats.statsCounter(); 102 countDone = 1; 103 }// window.width() 104 }); 105 } 106});
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.