PageSourceSearch

https://www.wrexa.com/assets/js/countto.js

js wrexa.com collected 2026-10-09 00:00:40 UTC 2,907 bytes, 86 lines download raw bytes

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

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.