Created
April 9, 2021 09:21
-
-
Save psahalot/6c6a39d955e7a2b81f9cf3640a08e358 to your computer and use it in GitHub Desktop.
Oxy Ultimate Countdown JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!(function (t) { | |
(OUCountdown = function (e) { | |
if ( | |
((this.params = e), | |
(this.id = e.id), | |
(this.timertype = e.timertype), | |
(this.timerid = "#countdown-" + e.id), | |
(this.timer_date = e.timer_date), | |
(this.timer_format = e.timer_format), | |
(this.timer_layout = e.timer_layout), | |
(this.timer_labels = e.timer_labels), | |
(this.timer_labels_singular = e.timer_labels_singular), | |
(this.redirect_link = e.redirect_link), | |
(this.redirect_link_target = e.redirect_link_target), | |
(this.fixed_timer_action = e.fixed_timer_action), | |
(this.evergreen_timer_action = e.evergreen_timer_action), | |
(this.evergreen_date_days = e.evergreen_date_days), | |
(this.evergreen_date_hours = e.evergreen_date_hours), | |
(this.evergreen_date_minutes = e.evergreen_date_minutes), | |
(this.evergreen_date_seconds = e.evergreen_date_seconds), | |
(this.timezone = e.time_zone), | |
(this.timer_exp_text = ""), | |
"NULL" == this.timezone && (this.timezone = null), | |
e.timer_exp_text && (this.timer_exp_text = e.timer_exp_text), | |
"fixed" == this.timertype && this._initFixedTimer(), | |
"evergreen" == this.timertype) | |
) { | |
var i, | |
r = ""; | |
null == t.cookie("countdown-" + e.id) && | |
(t.cookie("countdown-" + e.id, !0), | |
t.cookie("countdown-" + e.id + "-currdate", new Date()), | |
t.cookie("countdown-" + e.id + "-day", this.evergreen_date_days), | |
t.cookie("countdown-" + e.id + "-hour", this.evergreen_date_hours), | |
t.cookie("countdown-" + e.id + "-min", this.evergreen_date_minutes), | |
t.cookie("countdown-" + e.id + "-sec", this.evergreen_date_seconds)), | |
(r = new Date(t.cookie("countdown-" + e.id + "-currdate"))), | |
(i = 1e3 * (parseFloat(24 * this.evergreen_date_days * 60 * 60) + parseFloat(60 * this.evergreen_date_hours * 60) + parseFloat(60 * this.evergreen_date_minutes) + parseFloat(this.evergreen_date_seconds))), | |
r.setTime(r.getTime() + i), | |
(this.timer_date = r), | |
this._initEverGreenTimer(); | |
} | |
this._initCountdown(); | |
}), | |
(OUCountdown.prototype = { | |
_initCountdown: function () { | |
(fixed_timer_action = this.fixed_timer_action), (params = this.params); | |
var e = ""; | |
(e = "fixed" == this.timertype ? this.fixed_timer_action : this.evergreen_timer_action), | |
t.cookie("countdown-" + params.id + "expiremsg", null), | |
t.cookie("countdown-" + params.id + "redirect", null), | |
t.cookie("countdown-" + params.id + "redirectwindow", null), | |
t.cookie("countdown-" + params.id + "hide", null), | |
t.cookie("countdown-" + params.id + "reset", null), | |
t.removeCookie("countdown-" + params.id + "expiremsg"), | |
t.removeCookie("countdown-" + params.id + "redirect"), | |
t.removeCookie("countdown-" + params.id + "redirectwindow"), | |
t.removeCookie("countdown-" + params.id + "hide"), | |
t.removeCookie("countdown-" + params.id + "reset"), | |
"msg" == e | |
? t.cookie("countdown-" + params.id + "expiremsg", params.expire_message, { expires: 365 }) | |
: "redirect" == e | |
? (t.cookie("countdown-" + params.id + "redirect", params.redirect_link, { expires: 365 }), t.cookie("countdown-" + params.id + "redirectwindow", params.redirect_link_target, { expires: 365 })) | |
: "hide" == e | |
? t.cookie("countdown-" + params.id + "hide", "yes", { expires: 365 }) | |
: "reset" == e && t.cookie("countdown-" + params.id + "reset", "yes", { expires: 365 }); | |
}, | |
_initFixedTimer: function () { | |
new Date().getTime() - this.timer_date.getTime() > 0 | |
? "msg" == this.fixed_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).append(this.timer_exp_text) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
}) | |
: "redirect" == this.fixed_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? window.open(this.redirect_link, this.redirect_link_target) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
}) | |
: "hide" == this.fixed_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).countdown("destroy") | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
}) | |
: "msg" == this.fixed_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
}) | |
: "redirect" == this.fixed_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
onExpiry: this._redirectCounter, | |
}) | |
: "hide" == this.fixed_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
onExpiry: this._destroyCounter, | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: this.timer_exp_text, | |
}); | |
}, | |
_destroyCounter: function () { | |
parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) && t(this).countdown("destroy"); | |
}, | |
_redirectCounter: function () { | |
(redirect_link = t.cookie(t(this)[0].id + "redirect")), | |
(redirect_link_target = t.cookie(t(this)[0].id + "redirectwindow")), | |
parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) && window.open(redirect_link, redirect_link_target); | |
}, | |
_initEverGreenTimer: function () { | |
new Date().getTime() - this.timer_date.getTime() > 0 | |
? "msg" == this.evergreen_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).append(this.timer_exp_text) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: t.cookie("countdown-" + this.params.id + "expiremsg"), | |
}) | |
: "redirect" == this.evergreen_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? window.open(this.redirect_link, this.redirect_link_target) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._redirectCounter, | |
}) | |
: "hide" == this.evergreen_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).countdown("destroy") | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._destroyCounter, | |
}) | |
: "reset" == this.evergreen_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._restartCountdown, | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
}) | |
: "msg" == this.evergreen_timer_action | |
? parseInt(window.location.href.toLowerCase().indexOf("?ct_builder")) === parseInt(-1) | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
expiryText: t.cookie("countdown-" + this.params.id + "expiremsg"), | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
}) | |
: "redirect" == this.evergreen_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._redirectCounter, | |
}) | |
: "hide" == this.evergreen_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._destroyCounter, | |
}) | |
: "reset" == this.evergreen_timer_action | |
? t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
onExpiry: this._restartCountdown, | |
}) | |
: t(this.timerid).countdown({ | |
until: this.timer_date, | |
format: this.timer_format, | |
layout: this.timer_layout, | |
labels: this.timer_labels.split(","), | |
timezone: this.timezone, | |
labels1: this.timer_labels_singular.split(","), | |
}); | |
}, | |
_restartCountdown: function () { | |
t.cookie("countdown-" + params.id + "-currdate", new Date()), (currdate = new Date(t.cookie("countdown-" + params.id + "-currdate"))); | |
var e = t.cookie("countdown-" + params.id + "-day"), | |
i = t.cookie("countdown-" + params.id + "-hour"), | |
r = t.cookie("countdown-" + params.id + "-min"), | |
s = t.cookie("countdown-" + params.id + "-sec"), | |
o = 1e3 * (parseFloat(24 * e * 60 * 60) + parseFloat(60 * i * 60) + parseFloat(60 * r) + parseFloat(s)); | |
currdate.setTime(currdate.getTime() + o), (this.timer_date = currdate), t(this).countdown("option", { until: this.timer_date }); | |
}, | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment