芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/dustinevents.com/assets/common/js/jquery.syotimer.min.js
/** * SyoTimer v.2.1.3 | under MIT licence * http://syomochkin.xyz/folio/syotimer/demo.html */ ! function(i, e) { "function" == typeof define && define.amd ? define(["jquery"], i) : "object" == typeof module && module.exports ? module.exports = function(e, t) { return void 0 === t && (t = "undefined" != typeof window ? require("jquery") : require("jquery")(e)), i(t), t } : i(e) }(function(l) { var m = "day", a = "hour", s = "min", r = "sec", n = { d: m, h: a, m: s, s: r }, d = { list: [r, s, a, m], next: function(e) { e = this.list.indexOf(e); return e < this.list.length && this.list[e + 1] }, prev: function(e) { e = this.list.indexOf(e); return 0 < e && this.list[e - 1] } }, o = { year: 2034, month: 7, day: 31, hour: 0, min: 0, sec: 0, timeZone: "local", ignoreTransferTime: !1, layout: "dhms", periodic: !1, periodInterval: 7, periodUnit: "d", doubleNumbers: !0, effectType: "none", lang: "eng", headTitle: "", footTitle: "", afterDeadline: function(e) { e.bodyBlock.html('
The countdown is finished!
') } }, u = { sec: !1, min: !1, hour: !1, day: !1 }, c = { init: function(e) { var t = l.extend({}, o, e || {}); t.itemTypes = y.getItemTypesByLayout(t.layout), t._itemsHas = l.extend({}, u); for (var i = 0; i < t.itemTypes.length; i++) t._itemsHas[t.itemTypes[i]] = !0; return this.each(function() { l(this).data("syotimer-options", t), c._render.apply(this, []), c._persecHandler.apply(this, []) }) }, _render: function() { for (var e = l(this), t = e.data("syotimer-options"), i = y.getTimerItem(), n = l("
", { class: "syotimer__head" }).html(t.headTitle), o = l("
", { class: "syotimer__body" }), r = l("
", { class: "syotimer__footer" }).html(t.footTitle), a = {}, s = 0; s < t.itemTypes.length; s++) { var d = i.clone(); d.addClass("syotimer-cell_type_" + t.itemTypes[s]), o.append(d), a[t.itemTypes[s]] = d } var u = { headBlock: n, bodyBlock: o, footBlock: r }; e.data("syotimer-blocks", u).data("syotimer-items", a).addClass("syotimer").append(n).append(o).append(r) }, _persecHandler: function() { var e = l(this), t = e.data("syotimer-options"); l(".syotimer-cell > .syotimer-cell__value", e).css("opacity", 1); var i = new Date, n = new Date(t.year, t.month - 1, t.day, t.hour, t.min, t.sec), n = y.getDifferenceWithTimezone(i, n, t), n = y.getsecsToDeadLine(n, t); 0 <= n ? (c._refreshUnitsDom.apply(this, [n]), c._applyEffectSwitch.apply(this, [t.effectType])) : (e = l.extend(e, e.data("syotimer-blocks")), t.afterDeadline(e)) }, _refreshUnitsDom: function(e) { var t = l(this), i = t.data("syotimer-options"), n = t.data("syotimer-items"), o = i.itemTypes, r = y.getUnitsToDeadLine(e); i._itemsHas.day || (r.hour += 24 * r.day), i._itemsHas.hour || (r.min += 60 * r.hour), i._itemsHas.min || (r.sec += 60 * r.min); for (var a = 0; a < o.length; a++) { var s = o[a], d = r[s], u = n[s]; u.data("syotimer-unit-value", d), l(".syotimer-cell__value", u).html(y.format2(d, s !== m && i.doubleNumbers)), l(".syotimer-cell__unit", u).html(l.syotimerLang.getNumeral(d, i.lang, s)) } }, _applyEffectSwitch: function(e, t) { t = t || r; var i, n = this, o = l(n); "none" === e ? setTimeout(function() { c._persecHandler.apply(n, []) }, 1e3) : "opacity" !== e || (i = o.data("syotimer-items")[t]) && (o = d.next(t), t = i.data("syotimer-unit-value"), l(".syotimer-cell__value", i).animate({ opacity: .1 }, 1e3, "linear", function() { c._persecHandler.apply(n, []) }), o && 0 === t && c._applyEffectSwitch.apply(n, [e, o])) } }, y = { getTimerItem: function() { var e = l("
", { class: "syotimer-cell__value", text: "0" }), t = l("
", { class: "syotimer-cell__unit" }), i = l("
", { class: "syotimer-cell" }); return i.append(e).append(t), i }, getItemTypesByLayout: function(e) { for (var t = [], i = 0; i < e.length; i++) t.push(n[e[i]]); return t }, getsecsToDeadLine: function(e, t) { var i, n, o = e / 1e3, o = Math.floor(o), o = t.periodic ? (e = e / (1e3 * (n = y.getPeriodUnit(t.periodUnit))), e = Math.ceil(e), e = Math.abs(e), 0 <= o ? (i = 0 === (i = e % t.periodInterval) ? t.periodInterval : i, --i) : i = t.periodInterval - e % t.periodInterval, 0 == (t = o % n) && o < 0 && i--, Math.abs(i * n + t)) : o; return o }, getUnitsToDeadLine: function(e) { var t = m, i = {}; do { var n = y.getPeriodUnit(t) } while (i[t] = Math.floor(e / n), e %= n, t = d.prev(t)); return i }, getPeriodUnit: function(e) { switch (e) { case "d": case m: return 86400; case "h": case a: return 3600; case "m": case s: return 60; case "s": case r: return 1 } }, getDifferenceWithTimezone: function(e, t, i) { var n = t.getTime() - e.getTime(), o = 0, r = 0; return "local" !== i.timeZone && (o = 1e3 * (parseFloat(i.timeZone) * y.getPeriodUnit(a) - -e.getTimezoneOffset() * y.getPeriodUnit(s))), i.ignoreTransferTime && (r = 1e3 * (-e.getTimezoneOffset() * y.getPeriodUnit(s) - -t.getTimezoneOffset() * y.getPeriodUnit(s))), n - (o + r) }, format2: function(e, t) { return t = !1 !== t, e <= 9 && t ? "0" + e : "" + e } }, i = { setOption: function(e, t) { var i = l(this), n = i.data("syotimer-options"); n.hasOwnProperty(e) && (n[e] = t, i.data("syotimer-options", n)) } }; l.fn.syotimer = function(e) { if ("string" == typeof e && "setOption" === e) { var t = Array.prototype.slice.call(arguments, 1); return this.each(function() { i[e].apply(this, t) }) } if (null == e || "object" == typeof e) return c.init.apply(this, [e]); l.error("SyoTimer. Error in call methods: methods is not exist") }, l.syotimerLang = { rus: { sec: ["секунда", "секунды", "секунд"], min: ["минута", "минуты", "минут"], hour: ["час", "часа", "часов"], day: ["день", "дня", "дней"], handler: "rusNumeral" }, eng: { sec: ["sec", "sec"], min: ["min", "min"], hour: ["hour", "hour"], day: ["day", "day"] }, por: { sec: ["segundo", "segundos"], min: ["minuto", "minutos"], hour: ["hora", "horas"], day: ["dia", "dias"] }, spa: { sec: ["segundo", "segundos"], min: ["minuto", "minutos"], hour: ["hora", "horas"], day: ["día", "días"] }, heb: { sec: ["שניה", "שניות"], min: ["דקה", "דקות"], hour: ["שעה", "שעות"], day: ["יום", "ימים"] }, universal: function(e) { return 1 === e ? 0 : 1 }, rusNumeral: function(e) { e = 4 < e % 100 && e % 100 < 20 ? 2 : [2, 0, 1, 1, 1, 2][e % 10 < 5 ? e % 10 : 5]; return e }, getNumeral: function(e, t, i) { e = this[l.syotimerLang[t].handler || "universal"](e); return l.syotimerLang[t][i][e] } } }, window.jQuery);