1 2; /* Start:"a:4:{s:4:"full";s:67:"/simai/asset/milestone-counter//js/jquery.countTo.js?17270921992501";s:6:"source";s:52:"/simai/asset/milestone-counter//js/jquery.countTo.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/ 3(function ($) { 4 $.fn.countTo = function (options) { 5 options = options || {}; 6 7 return $(this).each(function () { 8 // set options for current element 9 var settings = $.extend({}, $.fn.countTo.defaults, { 10 from: $(this).data('from'), 11 to: $(this).data('to'), 12 speed: $(this).data('speed'), 13 refreshInterval: $(this).data('refresh-interval'), 14 decimals: $(this).data('decimals') 15 }, options); 16 17 // how many times to update the value, and how much to increment the value on each update 18 var loops = Math.ceil(settings.speed / settings.refreshInterval), 19 increment = (settings.to - settings.from) / loops; 20 21 // references & variables that will change with each update 22 var self = this, 23 $self = $(this), 24 loopCount = 0, 25 value = settings.from, 26 data = $self.data('countTo') || {}; 27 28 $self.data('countTo', data); 29 30 // if an existing interval can be found, clear it first 31 if (data.interval) { 32 clearInterval(data.interval); 33 } 34 data.interval = setInterval(updateTimer, settings.refreshInterval); 35 36 // initialize the element with the starting value 37 render(value); 38 39 function updateTimer() { 40 value += increment; 41 loopCount++; 42 43 render(value); 44
45 if (typeof(settings.onUpdate) == 'function') { 46 settings.onUpdate.call(self, value); 47 } 48 49 if (loopCount >= loops) { 50 // remove the interval 51 $self.removeData('countTo'); 52 clearInterval(data.interval); 53 value = settings.to; 54 55 if (typeof(settings.onComplete) == 'function') { 56 settings.onComplete.call(self, value); 57 } 58 } 59 } 60 61 function render(value) { 62 var formattedValue = settings.formatter.call(self, value, settings); 63 $self.text(formattedValue); 64 } 65 }); 66 }; 67 68 $.fn.countTo.defaults = { 69 from: 0, // the number the element should start at 70 to: 0, // the number the element should end at 71 speed: 1000, // how long it should take to count between the target numbers 72 refreshInterval: 100, // how often the element should be updated 73 decimals: 0, // the number of decimal places to show 74 formatter: formatter, // handler for formatting the value before rendering 75 onUpdate: null, // callback method for every time the element is updated 76 onComplete: null // callback method for when the element finishes updating 77 }; 78 79 function formatter(value, settings) { 80 return value.toFixed(settings.decimals); 81 } 82}(jQuery)); 83 84/* End */ 85;; /* /simai/asset/milestone-counter//js/jquery.countTo.js?17270921992501*/
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.