| Server IP : 14.225.216.240 / Your IP : 216.73.216.26 Web Server : nginx/1.20.1 System : Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64 User : taidh ( 1001) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/taidh/papacafe.vn/wp-content/themes/papacafe/assets/js/ |
Upload File : |
/*!
* Countdown v0.1.0
* https://github.com/fengyuanchen/countdown
*
* Copyright 2014 Fengyuan Chen
* Released under the MIT license
*/
(function (n) { typeof define == "function" && define.amd ? define(["jquery"], n) : n(jQuery) })(function (n) { "use strict"; var t = function (i, r) { this.$element = n(i); this.defaults = n.extend({}, t.defaults, this.$element.data(), n.isPlainObject(r) ? r : {}); this.init() }; t.prototype = { constructor: t, init: function () { var n = this.$element.html(), t = new Date(this.defaults.date || n); t.getTime() && (this.content = n, this.date = t, this.find(), this.defaults.autoStart && this.start()) }, find: function () { var n = this.$element; this.$days = n.find("[data-days]"); this.$hours = n.find("[data-hours]"); this.$minutes = n.find("[data-minutes]"); this.$seconds = n.find("[data-seconds]"); this.$days.length + this.$hours.length + this.$minutes.length + this.$seconds.length > 0 && (this.found = !0) }, reset: function () { this.found ? (this.output("days"), this.output("hours"), this.output("minutes"), this.output("seconds")) : this.output() }, ready: function () { var i = this.date, r = 1e3, u = 6e4, f = 36e5, e = 864e5, n = {}, t; return i ? (t = i.getTime() - (new Date).getTime(), t <= 0) ? (this.end(), !1) : (n.days = t, n.hours = n.days % e, n.minutes = n.hours % f, n.seconds = n.minutes % u, n.milliseconds = n.seconds % r, this.days = Math.floor(n.days / e), this.hours = Math.floor(n.hours / f), this.minutes = Math.floor(n.minutes / u), this.seconds = Math.floor(n.seconds / r), this.deciseconds = Math.floor(n.milliseconds / 100), !0) : !1 }, start: function () { !this.active && this.ready() && (this.active = !0, this.reset(), this.autoUpdate = this.defaults.fast ? setInterval(n.proxy(this.fastUpdate, this), 100) : setInterval(n.proxy(this.update, this), 1e3)) }, stop: function () { this.active && (this.active = !1, clearInterval(this.autoUpdate)) }, end: function () { this.date && (this.stop(), this.days = 0, this.hours = 0, this.minutes = 0, this.seconds = 0, this.deciseconds = 0, this.reset(), this.defaults.end()) }, destroy: function () { this.date && (this.stop(), this.$days = null, this.$hours = null, this.$minutes = null, this.$seconds = null, this.$element.empty().html(this.content), this.$element.removeData("data-countdown")) }, fastUpdate: function () { --this.deciseconds >= 0 ? this.output("deciseconds") : (this.deciseconds = 9, this.update()) }, update: function () { --this.seconds >= 0 ? this.output("seconds") : (this.seconds = 59, --this.minutes >= 0 ? this.output("minutes") : (this.minutes = 59, --this.hours >= 0 ? this.output("hours") : (this.hours = 23, --this.days >= 0 ? this.output("days") : this.end()))) }, output: function (n) { if (!this.found) { this.$element.empty().html(this.template()); return } switch (n) { case "deciseconds": this.$seconds.text(this.getSecondsText()); break; case "seconds": this.$seconds.text(this.seconds); break; case "minutes": this.$minutes.text(this.minutes); break; case "hours": this.$hours.text(this.hours); break; case "days": this.$days.text(this.days) } }, template: function () { return this.defaults.text.replace("%s", this.days).replace("%s", this.hours).replace("%s", this.minutes).replace("%s", this.getSecondsText()) }, getSecondsText: function () { return this.active && this.defaults.fast ? this.seconds + "." + this.deciseconds : this.seconds } }; t.defaults = { autoStart: !0, date: null, fast: !1, end: n.noop, text: "%s days, %s hours, %s minutes, %s seconds" }; t.setDefaults = function (i) { n.extend(t.defaults, i) }; n.fn.countdown = function (i) { return this.each(function () { var u = n(this), r = u.data("date-countdown"); r || u.data("data-countdown", r = new t(this, i)); typeof i == "string" && n.isFunction(r[i]) && r[i]() }) }; n.fn.countdown.constructor = t; n.fn.countdown.setDefaults = t.setDefaults; n(function () { n("[data-countdown]").countdown() }) });