1/** 2 * Jquery.rcounter.js 3 * Version: 1.0.0 4 * Author: Sharifur 5 * Inspired By Benjamin Intal 6 * */ 7 8(function($) { 9 'use strict'; 10 $.fn.rCounter = function(options) { 11 var settings = $.extend({ 12 duration: 20, 13 easing: 'swing', 14 }, options); 15 return this.each(function() { 16 var $this = $(this); 17 18 var startCounter = function() { 19 var numbers = []; 20 var length = $this.length; 21 var number = $this.text(); 22 var isComma = /[,\-]/.test(number); 23 var isFloat = /[,\-]/.test(number); 24 var number = number.replace(/,/g, ''); 25 var divisions = settings.duration; 26 var decimalPlaces = isFloat ? (number.split('.')[1] || []).length : 0; 27 28 // make number string to array for displaying counterup 29 for (var rcn = divisions; rcn >= 1; rcn--) { 30 31 var newNum = parseInt(number / divisions * rcn); 32 if (isFloat) { 33 newNum = parseFloat(number / divisions * rcn).toFixed(decimalPlaces); 34 } 35 if (isComma) { 36 while (/(\d+)(\d{3})/.test(newNum.toString())) { 37 newNum = newNum.toString().replace(/(\d+)(\d{3})/, '$1' + ',' + '$2'); 38 } 39 } 40 41 numbers.unshift(newNum); 42 } 43 var counterUpDisplay = function() { 44 $this.text(numbers.shift()); 45 setTimeout(counterUpDisplay, settings.duration); 46 }; 47 setTimeout(counterUpDisplay, settings.duration); 48 } // end function 49 50 //bind with waypoints 51 $this.waypoint(startCounter, { offset: '100%', triggerOnce: true }); 52 }); 53 54 55 } 56 57}(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.