PageSourceSearch

https://practicalmind.net/wp-content/themes/pma-theme/js/countdown.js?ver=20150315

js practicalmind.net collected 2026-10-05 03:42:27 UTC 4,591 bytes, 104 lines download raw bytes

1(function($){
2	"use strict";
3	$.fn.apusCountDown = function( options ) {
4	 	return this.each(function() {
5			new $.apusCountDown( this, options ); 
6		});
7 	}
8	$.apusCountDown = function( obj, options ) {
9		this.options = $.extend({
10			autoStart : true,
11			LeadingZero:true,
12			DisplayFormat:"<div>%%D%% Days</div><div>%%H%% Hours</div><div>%%M%% Minutes</div><div>%%S%% Seconds</div>",
13			FinishMessage:"Expired",
14			CountActive:true,
15			TargetDate:null
16		}, options || {} );
17		if ( this.options.TargetDate == null || this.options.TargetDate == '' ){
18			return ;
19		}
20		this.timer  = null;
21		this.element = obj;
22		this.CountStepper = -1;
23		this.CountStepper = Math.ceil(this.CountStepper);
24		this.SetTimeOutPeriod = (Math.abs(this.CountStepper)-1)*1000 + 990;
25		var dthen = new Date(this.options.TargetDate);
26		var dnow = new Date();
27		if ( this.CountStepper > 0 ) {
28			var ddiff = new Date(dnow-dthen);
29		} else {
30			var ddiff = new Date(dthen-dnow);
31		}
32		var gsecs = Math.floor(ddiff.valueOf()/1000); 
33		this.CountBack(gsecs, this);
34	};
35	$.apusCountDown.fn = $.apusCountDown.prototype;
36    $.apusCountDown.fn.extend = $.apusCountDown.extend = $.extend;
37	$.apusCountDown.fn.extend({
38		calculateDate:function( secs, num1, num2 ){
39			var s = ((Math.floor(secs/num1))%num2).toString();
40			if ( this.options.LeadingZero && s.length < 2) {
41				s = "0" + s;
42			}
43			return "<span>" + s + "</span>";
44		},
45		CountBack:function( secs, self ){
46			if (secs < 0) {
47				self.element.innerHTML = '<div class="labelexpired"> '+self.options.FinishMessage+"</div>";
48				return;
49			}
50			clearInterval(self.timer);
51			var DisplayStr = self.options.DisplayFormat.replace(/%%D%%/g, self.calculateDate( secs,86400,100000) );
52			DisplayStr = DisplayStr.replace(/%%H%%/g, self.calculateDate(secs,3600,24));
53			DisplayStr = DisplayStr.replace(/%%M%%/g, self.calculateDate(secs,60,60));
54			DisplayStr = DisplayStr.replace(/%%S%%/g, self.calculateDate(secs,1,60));
55			self.element.innerHTML = DisplayStr;
56			if (self.options.CountActive) {
57				self.timer = null;
58				self.timer =  setTimeout( function(){
59					self.CountBack((secs+self.CountStepper),self);
60				},( self.SetTimeOutPeriod ) );
61			}
62		}
63	});
64
65	jQuery(document).ready(function($) {
66		$('[data-time="timmer"]').each(function(index, el) {
67            var $this = $(this);
68            var $date = $this.data('date').split("-");
69            var format = "<div class=\"times\"><div class=\"day\">%%D%% "+ "<span class=\"title\">" + educrat_countdown_opts.days + "</span>" +"</div><div class=\"hours\">%%H%% "+ "<span class=\"title\">" + educrat_countdown_opts.hours + "</span>" +"</div><div class=\"minutes\">%%M%% "+ "<span class=\"title\">" + educrat_countdown_opts.mins + "</span>" +"</div><div class=\"seconds\">%%S%% "+ "<span class=\"title\">" + educrat_countdown_opts.secs + "</span>" +"</div></div>";
70            if ( $(this).data('format') ) {
71            	format = $(this).data('format');
72            }
73            $this.apusCountDown({
74                TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5],
75                DisplayFormat: format,
76                FinishMessage: "",
77            });
78        });
79	});
80
81	jQuery(window).on("elementor/frontend/init", function() {
82    	// General element
83
84        elementorFrontend.hooks.addAction( "frontend/element_ready/apus_element_countdown.default",
85            function($scope) {
86
87                $scope.find('[data-time="timmer-elementor"]').each(function(index, el) {
88                	
89		            var $this = $(this);
90		            var $date = $this.data('date').split("-");
91		            var format = "<div class=\"times\"><div class=\"day\">%%D%% "+ "<span class=\"title\">" + educrat_countdown_opts.days + "</span>" +"</div><div class=\"hours\">%%H%% "+ "<span class=\"title\">" + educrat_countdown_opts.hours + "</span>" +"</div><div class=\"minutes\">%%M%% "+ "<span class=\"title\">" + educrat_countdown_opts.mins + "</span>" +"</div><div class=\"seconds\">%%S%% "+ "<span class=\"title\">" + educrat_countdown_opts.secs + "</span>" +"</div></div>";
92		            if ( $(this).data('format') ) {
93		            	format = $(this).data('format');
94		            }
95		            $this.apusCountDown({
96		                TargetDate:$date[0]+"/"+$date[1]+"/"+$date[2]+" "+$date[3]+":"+$date[4]+":"+$date[5],
97		                DisplayFormat: format,
98		                FinishMessage: "",
99		            });
100		        });
101            }
102        );
103    });
104})(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.