PageSourceSearch

https://www.virtu.com/wp-content/plugins/wpdevart-countdown-pro/in…/jquery.classycountdown.js?ver=7.1.2

js virtu.com collected 2026-09-24 09:38:53 UTC 9,511 bytes, 207 lines download raw bytes

1/*!
2 * jQuery ClassyCountdown
3 * www.class.pm
4 *
5 * Written by Marius Stanciu - Sergiu <[email protected]>
6 * Licensed under the MIT license www.class.pm/LICENSE-MIT
7 * Version 1.0.0
8 *
9 */
10
11(function($) {
12    $.fn.ClassyCountdown = function(options, callback) {
13        var element = $(this);
14        var DaysLeft, HoursLeft, MinutesLeft, SecondsLeft;
15        var secondsLeft;
16        var isFired = false;
17        var settings = {
18            end: undefined,
19            now: $.now(),
20            labels: true,
21            labelsOptions: {
22                lang: {
23                    days: 'Days',
24                    hours: 'Hours',
25                    minutes: 'Minutes',
26                    seconds: 'Seconds'
27                },
28                style: 'font-size: 0.5em;'
29            },
30            style: {
31                element: '',
32                labels: false,
33                textResponsive: 0.5,
34                days: {
35                    gauge: {
36                        thickness: 0.02,
37                        bgColor: 'rgba(0, 0, 0, 0)',
38                        fgColor: 'rgba(0, 0, 0, 1)',
39                        lineCap: 'butt'
40                    },
41                    textCSS: ''
42                },
43                hours: {
44                    gauge: {
45                        thickness: 0.02,
46                        bgColor: 'rgba(0, 0, 0, 0)',
47                        fgColor: 'rgba(0, 0, 0, 1)',
48                        lineCap: 'butt'
49                    },
50                    textCSS: ''
51                },
52                minutes: {
53                    gauge: {
54                        thickness: 0.02,
55                        bgColor: 'rgba(0, 0, 0, 0)',
56                        fgColor: 'rgba(0, 0, 0, 1)',
57                        lineCap: 'butt'
58                    },
59                    textCSS: ''
60                },
61                seconds: {
62                    gauge: {
63                        thickness: 0.02,
64                        bgColor: 'rgba(0, 0, 0, 0)',
65                        fgColor: 'rgba(0, 0, 0, 1)',
66                        lineCap: 'butt'
67                    },
68                    textCSS: ''
69                }
70            },
71            onEndCallback: function() {
72            }
73        };
74        if (options.theme) {
75            settings = $.extend(true, settings, getPreset(options.theme));
76        }
77        settings = $.extend(true, settings, options);
78        prepare();
79        doTick();
80        setInterval(doTick, 1000);
81        doResponsive();
82        
83        function prepare() {
84            element.append('<div class="ClassyCountdown-wrapper">' +
85                    '<div class="ClassyCountdown-days">' +
86                        '<input type="text" />' +
87                        '<span class="ClassyCountdown-value"><div></div><span></span></span>' +
88                    '</div>' +
89                    '<div class="ClassyCountdown-hours">' +
90                        '<input type="text" />' +
91                        '<span class="ClassyCountdown-value"><div></div><span></span></span>' +
92                    '</div>' +
93                    '<div class="ClassyCountdown-minutes">' +
94                        '<input type="text" />' +
95                        '<span class="ClassyCountdown-value"><div></div><span></span></span>' +
96                    '</div>' +
97                    '<div class="ClassyCountdown-seconds">' +
98                        '<input type="text" />' +
99                        '<span class="ClassyCountdown-value"><div></div><span></span></span>' +
100                    '</div>' +
101                '</div>');
102            element.find('.ClassyCountdown-days input').knob($.extend({
103                width: '100%',
104                displayInput: false,
105                readOnly: true,
106                max: 365
107            }, settings.style.days.gauge));
108            element.find('.ClassyCountdown-hours input').knob($.extend({
109                width: '100%',
110                displayInput: false,
111                readOnly: true,
112                max: 24
113            }, settings.style.hours.gauge));
114            element.find('.ClassyCountdown-minutes input').knob($.extend({
115                width: '100%',
116                displayInput: false,
117                readOnly: true,
118                max: 60
119            }, settings.style.minutes.gauge));
120            element.find('.ClassyCountdown-seconds input').knob($.extend({
121                width: '100%',
122                displayInput: false,
123                readOnly: true,
124                max: 60
125            }, settings.style.seconds.gauge));
126            element.find('.ClassyCountdown-wrapper > div').attr("style", settings.style.element);
127            element.find('.ClassyCountdown-days .ClassyCountdown-value').attr('style', settings.style.days.textCSS);
128            element.find('.ClassyCountdown-hours .ClassyCountdown-value').attr('style', settings.style.hours.textCSS);
129            element.find('.ClassyCountdown-minutes .ClassyCountdown-value').attr('style', settings.style.minutes.textCSS);
130            element.find('.ClassyCountdown-seconds .ClassyCountdown-value').attr('style', settings.style.seconds.textCSS);
131            element.find('.ClassyCountdown-value').each(function() {
132                $(this).css('margin-top', Math.floor(0 - (parseInt($(this).height()) / 2)) + 'px');
133            });
134            if (settings.labels) {
135                element.find(".ClassyCountdown-days .ClassyCountdown-value >
135 span").html(settings.labelsOptions.lang.days);
136                element.find(".ClassyCountdown-hours .ClassyCountdown-value > span").html(settings.labelsOptions.lang.hours);
137                element.find(".ClassyCountdown-minutes .ClassyCountdown-value > span").html(settings.labelsOptions.lang.minutes);
138                element.find(".ClassyCountdown-seconds .ClassyCountdown-value > span").html(settings.labelsOptions.lang.seconds);
139                element.find(".ClassyCountdown-value > span").attr("style", settings.labelsOptions.style);
140            }
141            secondsLeft = settings.end - settings.now;
142            secondsToDHMS();
143        }
144        
145        function secondsToDHMS() {
146            DaysLeft = Math.floor(secondsLeft / 86400);
147            HoursLeft = Math.floor((secondsLeft % 86400) / 3600);
148            MinutesLeft = Math.floor(((secondsLeft % 86400) % 3600) / 60);
149            SecondsLeft = Math.floor((((secondsLeft % 86400) % 3600) % 60) % 60);
150        }
151
152        function doTick() {
153            secondsLeft--;
154            secondsToDHMS();
155            if (secondsLeft <= 0) {
156                if (!isFired) {
157                    isFired = true;
158                    settings.onEndCallback();
159                }
160                DaysLeft = 0;
161                HoursLeft = 0;
162                MinutesLeft = 0;
163                SecondsLeft = 0;
164            }
165            element.find('.ClassyCountdown-days input').val(365 - DaysLeft).trigger('change');
166            element.find('.ClassyCountdown-hours input').val(24 - HoursLeft).trigger('change');
167            element.find('.ClassyCountdown-minutes input').val(60 - MinutesLeft).trigger('change');
168            element.find('.ClassyCountdown-seconds input').val(60 - SecondsLeft).trigger('change');
169            element.find('.ClassyCountdown-days .ClassyCountdown-value > div').html(DaysLeft);
170            element.find('.ClassyCountdown-hours .ClassyCountdown-value > div').html(HoursLeft);
171            element.find('.ClassyCountdown-minutes .ClassyCountdown-value > div').html(MinutesLeft);
172            element.find('.ClassyCountdown-seconds .ClassyCountdown-value > div').html(SecondsLeft);
173        }
174        
175        function doResponsive() {
176            element.find('.ClassyCountdown-wrapper > div').each(function() {
177                $(this).css('height', $(this).width() + 'px');
178            });
179			
180            if (settings.style.textResponsive) {
181
182                element.find('.ClassyCountdown-value').css('font-size', Math.floor(element.find('> div > div').eq(0).width() * settings.style.textResponsive / 10) + 'px');
183                element.find('.ClassyCountdown-value').each(function() {
184                    $(this).css('margin-top', Math.floor(0 - (parseInt($(this).height()) / 2)) + 'px');
185                });
186            }
187            $(window).trigger('resize');
188            $(window).resize($.throttle(50, onResize));
189        }
190
191        function onResize() {
192            element.find('.ClassyCountdown-wrapper > div').each(function() {
193                $(this).css('height', $(this).width() + 'px');
194            });
195            if (settings.style.textResponsive) {
196                element.find('.ClassyCountdown-value').css('font-size', Math.floor(element.find('> div > div').eq(0).width() * settings.style.textResponsive / 10) + 'px');
197            }
198            element.find('.ClassyCountdown-value').each(function() {
199                $(this).css("margin-top", Math.floor(0 - (parseInt($(this).height()) / 2)) + 'px');
200            });
201            element.find('.ClassyCountdown-days input').trigger('change');
202            element.find('.ClassyCountdown-hours input').trigger('change');
203            element.find('.ClassyCountdown-minutes input').trigger('change');
204            element.find('.ClassyCountdown-seconds input').trigger('change');
205        }
206    };
207})(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.