Aknaproff/public/plugins/countdowntimer/countdowntimer.min.js

9 lines
18 KiB
JavaScript
Raw Permalink Normal View History

2023-09-21 12:45:08 +00:00
/*! CountdownTimer for jQuery @version2.0.0 (https://harshen.github.io/jQuery-countdownTimer/).
* Written by Harshen Pandey (https://remote.com/harshen) January 2014.
* @license MIT (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE.md)
* and GPLv3 (https://github.com/harshen/jQuery-countdownTimer/blob/master/LICENSE-GPL.md).
* @release - 27/10/2017
* Copyright (c) 2017 - 2020 Harshen Pandey
* Please attribute the author if you use it.
*/
!function(t){"use strict";function o(o,_){var M=t.extend({},t.fn.countdowntimer.defaults,_);t.extend(!0,M,t.fn.countdowntimer.regionalOptions,_),o.data("opts",{opts:M}),o.addClass("style");var S=M.size,v=M.borderColor,H=M.fontColor,p=M.backgroundColor;if(void 0!==_.regexpMatchFormat&&void 0!==_.regexpReplaceWith&&void 0===_.timeSeparator&&void 0===_.labelsFormat&&(window["regexpMatchFormat_"+o.attr("id")]=_.regexpMatchFormat,window["regexpReplaceWith_"+o.attr("id")]=_.regexpReplaceWith),void 0!==_.displayFormat){var h=[];h[0]=M.displayFormat.match("Y")?"!":"#",h[1]=M.displayFormat.match("O")?"!":"#",h[2]=M.displayFormat.match("D")?"!":"#",h[3]=M.displayFormat.match("H")?"!":"#",h[4]=M.displayFormat.match("M")?"!":"#",h[5]=M.displayFormat.match("S")?"!":"#",M.displayFormat=h.join("")}else M.displayFormat="###!!!";if(void 0!==_.borderColor||void 0!==_.fontColor||void 0!==_.backgroundColor){var f={background:p,color:H,"border-color":v};o.css(f)}else o.addClass("colorDefinition");if(!1===M.labelsFormat)if(void 0!==_.size)switch(S){case"xl":o.addClass("size_xl");break;case"lg":o.addClass("size_lg");break;case"md":o.addClass("size_md");break;case"sm":o.addClass("size_sm");break;case"xs":o.addClass("size_xs")}else"sm"===S&&o.addClass("size_sm");if(!0===M.isRTL&&o.addClass("lang-rtl"),void 0!==_.startDate||void 0!==_.dateAndTime||void 0!==_.currentTime||void 0===_.hours&&void 0===_.minutes&&void 0===_.seconds)if(void 0!==_.startDate&&void 0!==_.dateAndTime&&void 0===_.currentTime){window["startDate"+o.attr("id")]=new Date(M.startDate),window["endDate"+o.attr("id")]=null!==M.timeZone?e(new Date(M.dateAndTime),M.timeZone):new Date(M.dateAndTime);void 0!==_.beforeExpiryTime&&(window["beforeExpiry_withStart"+o.attr("id")]=M.beforeExpiryTime),c(o,M,"withStart"),window["timer_startDate"+o.attr("id")]=setInterval(function(){c(o,M,"withStart")},1e3*M.tickInterval)}else if(void 0===_.startDate&&void 0!==_.dateAndTime&&void 0===_.currentTime){var y=M.startDate.getHours(),x=M.startDate.getMinutes(),I=M.startDate.getSeconds(),g=M.startDate.getMonth()+1,b=M.startDate.getDate(),k=M.startDate.getFullYear(),D=new Date(k+"/"+g+"/"+b+" "+y+":"+x+":"+I);window["startTime"+o.attr("id")]=D,window["dateTime"+o.attr("id")]=null!==M.timeZone?e(new Date(M.dateAndTime),M.timeZone):new Date(M.dateAndTime);void 0!==_.beforeExpiryTime&&(window["beforeExpiry_withnoStart"+o.attr("id")]=M.beforeExpiryTime),c(o,M,"withnoStart"),window["timer_givenDate"+o.attr("id")]=setInterval(function(){c(o,M,"withnoStart")},1e3*M.tickInterval)}else void 0!==_.currentTime&&!0===M.currentTime?(l(o,M),window["timer_currentDate"+o.attr("id")]=setInterval(function(){l(o,M)},1e3*M.tickInterval)):(window["countSeconds"+o.attr("id")]=M.seconds,m(o,M),window["timer_secondsTimer"+o.attr("id")]=setInterval(function(){m(o,M)},1e3));else void 0!==_.hours&&void 0===_.minutes&&void 0===_.seconds?n(o,"H",M,i,_):void 0===_.hours&&void 0!==_.minutes&&void 0===_.seconds?n(o,"M",M,d,_):void 0===_.hours&&void 0===_.minutes&&void 0!==_.seconds?n(o,"S",M,s,_):void 0!==_.hours&&void 0!==_.minutes&&void 0===_.seconds?n(o,"HM",M,w,_):void 0===_.hours&&void 0!==_.minutes&&void 0!==_.seconds?n(o,"MS",M,r,_):void 0!==_.hours&&void 0===_.minutes&&void 0!==_.seconds?n(o,"HS",M,a,_):void 0!==_.hours&&void 0!==_.minutes&&void 0!==_.seconds&&n(o,"HMS",M,u,_)}function n(t,o,n,e,i){t.data("typefunc",{type:o,func:e}),window["hours_"+o+t.attr("id")]=n.hours,window["minutes_"+o+t.attr("id")]=n.minutes,window["seconds_"+o+t.attr("id")]=n.seconds,void 0!==i.beforeExpiryTime&&(window["beforeExpiry_"+o+t.attr("id")]=n.beforeExpiryTime),void 0!==i.pauseButton&&H(t,o,n,e),void 0!==i.stopButton&&p(t,o,n,e),e(t,n),window["timer_"+o+t.attr("id")]=setInterval(function(){e(t,n)},1e3*n.tickInterval)}function e(t,o){return new Date(t.getTime()+6e4*t.getTimezoneOffset()+6e4*(Math.abs(o)<30?60*o:o))}function i(t,o){var n=t.attr("id"),e="";window["minutes_H"+n]===o.minutes&&window["seconds_H"+n]===o.seconds&&window["hours_H"+n]===o.hours?(v(t,e=S(t,o,0,0,0,window["hours_H"+n],0,0),o),void 0!==window["beforeExpiry_H"+n]&&M(t,o,e