PageSourceSearch

https://theperfectingchurch.org/wp-content/themes/levelup/assets/js/counters.js?ver=2.0.11

js theperfectingchurch.org collected 2026-10-06 18:43:34 UTC 6,518 bytes, 151 lines download raw bytes

1/* Counters */
2
3(function(a){"use strict";a.fn.absoluteCounter=function(b){b=a.extend({},a.fn.absoluteCounter.defaults,b||{});return a(this).each(function(){var d=this,g=b.speed,f=b.setStyles,e=b.delayedStart,c=b.fadeInDelay;if(f){a(d).css({display:"block",position:"relative",overflow:"hidden"}).addClass('animated')}a(d).css("opacity","0");a(d).animate({opacity:0},e,function(){var l=a(d).text();a(d).text("");for(var k=0;k<l.length;k++){var n=l.charAt(k);var m="";if(parseInt(n,10)>=0){m='<span class="onedigit p'+(l.length-k)+" d"+n+'">';for(var h=0;h<=parseInt(n,10);h++){m+='<span class="n'+(h%10)+'">'+(h%10)+"</span>"}m+="</span>"}else{m='<span class="onedigit p'+(l.length-k)+' char"><span class="c">'+n+"</span></span>"}a(d).append(m)}a(d).animate({opacity:1},c);a("span.onedigit",d).each(function(i,o){if(f){a(o).css({"float":"left",position:"relative"});a("span",a(o)).css({display:"block"})}var p=a("span",a(o)).length,j=a(d).height();a(o).css({height:(p*j)+"px",top:"0"});a("span",a(o)).css({height:j+"px"});a(o).animate({top:-1*((p-1)*j)+"px"},g,function(){if(typeof(b.onComplete)==="function"){b.onComplete.call(d)}})})})})};a.fn.absoluteCounter.defaults={speed:2000,setStyles:true,onComplete:null,delayedStart:0,fadeInDelay:0}}(jQuery));
4
5
6(function($) {
7    "use strict";
8
9    $.fn.countTo = function(options) {
10        // merge the default plugin settings with the custom options
11        options = $.extend({}, $.fn.countTo.defaults, options || {});
12
13        // how many times to update the value, and how much to increment the value on each update
14        var loops = Math.ceil(options.speed / options.refreshInterval),
15            increment = (options.to - options.from) / loops;
16
17        return $(this).each(function() {
18            var _this = this,
19                loopCount = 0,
20                value = options.from,
21                interval = setInterval(updateTimer, options.refreshInterval);
22
23            function updateTimer() {
24                value += increment;
25                loopCount++;
26                $(_this).html(value.toFixed(options.decimals));
27
28                if (typeof(options.onUpdate) === 'function') {
29                    options.onUpdate.call(_this, value);
30                }
31
32                if (loopCount >= loops) {
33                    clearInterval(interval);
34                    value = options.to;
35
36                    if (typeof(options.onComplete) === 'function') {
37                        options.onComplete.call(_this, value);
38                    }
39                }
40            }
41        });
42    };
43
44    $.fn.countTo.defaults = {
45        from: 0,  // the number the element should start at
46        to: 100,  // the number the element should end at
47        speed: 1000,  // how long it should take to count between the target numbers
48        refreshInterval: 100,  // how often the element should be updated
49        decimals: 0,  // the number of decimal places to show
50        onUpdate: null,  // callback method for every time the element is updated,
51        onComplete: null  // callback method for when the element finishes updating
52    };
53})(jQuery);
54
55
56(function($)
57{
58    "use strict";
59
60    var _units	= ['weeks','days','hours','minutes','seconds'],
61        _second = 1000,
62        _minute = _second * 60,
63        _hour 	= _minute * 60,
64        _day 	= _hour * 24,
65        _week	= _day * 7,
66        ticker	= function(_self)
67        {
68            var _time		= {},
69                _now 		= new Date(),
70                _timestamp  = _self.end - _now;
71
72            if(_timestamp <= 0)
73            {
74                clearInterval(_self.countdown);
75                return;
76            }
77
78            _self.time.weeks   	= Math.floor( _timestamp / _week);
79            _self.time.days 	= Math.floor((_timestamp % _week) / _day);
80            _self.time.hours	= Math.floor((_timestamp % _day) / _hour);
81            _self.time.minutes 	= Math.floor((_timestamp % _hour) / _minute);
82            _self.time.seconds 	= Math.floor((_timestamp % _minute) / _second);
83
84            switch(_self.data.maximum)
85            {
86                case 1: _self.time.seconds 	= Math.floor(_timestamp / _second); break;
87                case 2: _self.time.minutes 	= Math.floor(_timestamp / _minute); break;
88                case 3: _self.time.hours	= Math.floor(_timestamp / _hour); 	break;
89                case 4: _self.time.days 	= Math.floor(_timestamp / _day); 	break;
90            }
91
92            for (var i in _self.time)
93            {
94                if(typeof _self.update[i] == "object")
95                {
96                    if(_self.firstrun || _self.oldtime[i] != _self.time[i])
97                    {
98                        var labelkey = ( _self.time[i] === 1 ) ? "single" : "multi";
99
100                        _self.update[i].time_container.text(_self.time[i]);
101                        _self.update[i].label_container.text(_self.update[i][labelkey]);
102                    }
103                }
104            }
105
106            //show ticker
107            if(_self.firstrun) _self.container.addClass('rdy-countdown-active')
108
109            _self.oldtime 	= $.extend( {}, _self.time );
110            _self.firstrun	= false;
111        };
112
113
114    $.fn.rdyCountdown = function( options )
115    {
116        if(!this.length) return;
117
118        return this.each(function()
119        {
120            var _self 			= {};
121            _self.update		= {};
122            _self.time			= {};
123            _self.oldtime		= {};
124            _self.firstrun		= true;
125
126            _self.container		= $(this);
127            _self.data			= _self.container.data();
128            _self.end			= new Date(_self.data.year, _self.data.month, _self.data.day, _self.data.hour, _self.data.minute );
129
130            for (var i in _units)
131            {
132                _self.update[_units[i]] = {
133                    time_container:  _self.container.find('.rdy-countdown-' + _units[i] + ' .rdy-countdown-time'),
134                    label_container: _self.container.find('.rdy-countdown-' + _units[i] + ' .rdy-countdown-time-label'),
135                };
136
137                if(_self.update[_units[i]].label_container.length)
138                {
139                    _self.update[_units[i]].single = _self.update[_units[i]].label_container.data('label');
140                    _self.update[_units[i]].multi  = _self.update[_units[i]].label_container.data('label-multi');
141                }
142            }
143
144            ticker(_self);
145            _self.countdown 	= setInterval(function(){ ticker(_self); }, _self.data.interval);
146
147
148        });
149    }
150
151}(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.