PageSourceSearch

https://globalyouthmobilization.org/wp-content/themes/gymgd/js/counter.js?ver=1.0.01790959500

js globalyouthmobilization.org collected 2026-10-02 16:45:55 UTC 2,787 bytes, 78 lines download raw bytes

1(function ($, root, undefined) {
2	
3	$(function () {
4		
5		'use strict';
6
7        var timing = 3000; //milliseconds
8        var countcount = 0;
9        var $arrCounters = [];
10
11        function runCounter($target, $counter, $countcount) {
12            if ($counter.hasClass('running') == false) {
13
14                var timer = 0;
15                var compensate = $target;
16                if ($target > 1000000) {
17                    timer = (Math.floor($target / 1000000) * 1000000) - 123456;
18                    compensate = 1000;
19                } else if ($target > 100000) {
20                    timer = (Math.floor($target / 100000) * 100000) - 23456;
21                    compensate = 2000;
22                } else if ($target > 10000) {
23                    timer = (Math.floor($target / 10000) * 10000) - 4567;
24                    compensate = 4000;
25                } else if ($target > 1000) {
26                    timer = (Math.floor($target / 1000) * 1000) - 654;
27                    compensate = 6000;
28                }
29
30                $counter.addClass('running');
31                var $interval = timing / $target;
32
33                $counter.data('id', countcount);
34                $arrCounters[countcount] = setInterval(function () {
35
36                    var factor = Math.ceil($target / compensate);
37                    timer = timer + factor;
38                    var $diff = $counter.find('span').length - String(timer).length;
39                    for (var $i = 0; $i < String(timer).length; $i++) {
40                        $counter.find('.counter'+($i + $diff)).html(String(timer)[$i]);
41                    }
42
43                    if (timer >= $target) {
44                        clearInterval($arrCounters[$counter.data('id')]);
45                    }
46                }, $interval, $counter);
47
48                countcount++;
49                
50            }
51        }
52
53        function checkCounterScroll(strict = false) {
54            if (strict == true) {
55                $('.wp-block-cgb-counter-gymgd').each(function() {
56                    var $target = $(this).data('target');
57                    if (($(window).scrollTop() + $(window).height()) > ($(this).offset().top)) {
58                        runCounter($(this).data('target'), $(this));
59                    }
60                });
61            } else {
62                $('.wp-block-cgb-counter-gymgd').each(function() {
63                    if (($(window).scrollTop() + $(window).height()) > ($(this).offset().top)) {
64                        runCounter($(this).data('target'), $(this));
65                    }
66                });
67            }
68        }
69		
70		// DOM ready, take it away
71        $(window).scroll(function(){
72            checkCounterScroll();
73        });
74        checkCounterScroll(true);
75
76	});
77	
78})(jQuery, this);

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.