<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<script src="jq.js"></script>
<script>
function e(e) {
if (void 0 != e && null != e) {
var t = n.exec($.trim("" + e));
if (t[2]) {
var a = parseFloat(t[1]),
i = s[t[2]] || 1;
return a * i
}
return e
}
};
var t = 1,
a = [],
i = "$.timer",
n = /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
s = {
ms: 1,
cs: 10,
ds: 100,
s: 1e3,
das: 1e4,
hs: 1e5,
ks: 1e6
};
$.extend({
timer: {
add: function(n, s, o, r, l) {
var c = 0;
if ($.isFunction(o) && (l || (l = r), r = o, o = s), s = e(s), !("number" != typeof s || isNaN(s) || 0 > s)) {
("number" != typeof l || isNaN(l) || 0 > l) && (l = 0);
var d = $.data(n, i) || $.data(n, i, {});
d[o] || (d[o] = {}), r.timerID = r.timerID || t++;
var u = function() {
(++c > l && 0 !== l || r.call(n, c) === !1) && $.timer.remove(n, o, r)
};
u.timerID = r.timerID, d[o][r.timerID] || (d[o][r.timerID] = setInterval(u, s)), a.push(n)
}
},
remove: function(e, t, a) {
var n, s = $.data(e, i);
if (s) {
if (t) {
if (s[t]) {
if (a) a.timerID && (clearInterval(s[t][a.timerID]), delete s[t][a.timerID]);
else
for (var a in s[t]) clearInterval(s[t][a]), delete s[t][a];
for (n in s[t]) break;
n || (n = null, delete s[t])
}
} else
for (t in s) this.remove(e, t, a);
for (n in s) break;
n || $.removeData(e, i)
}
}
}
});
$.fn.extend({
everyTime: function(e, t, a, i) {
return this.each(function() {
$.timer.add(this, e, t, a, i)
})
},
oneTime: function(e, t, a) {
return this.each(function() {
$.timer.add(this, e, t, a, 1)
})
},
stopTime: function(e, t) {
return this.each(function() {
$.timer.remove(this, e, t)
})
}
})
function multiclock_channel_brand_teams(e) {
var t = parseInt($("#" + e).attr("diff"));
if (!(!t > 0)) {
var a = (new Date).getTime(),
i = function() {
var i = (new Date).getTime(),
n = t + a - i;
if (n > 0) {
var s = parseInt(n / 864e5);
n %= 864e5;
var o = parseInt(n / 36e5);
n %= 36e5;
var r, l = parseInt(n / 6e4),
n = parseInt(Math.round(n % 6e4) / 1e3);
r = s >= 3 ? "剩余时间3天以上" : 0 == s ? o > 0 ? "剩余时间" + o + "小时" + l + "分钟" + n + "秒" : l > 0 ? "剩余时间" + l + "分钟" + n + "秒" : "剩余时间" + n + "秒" : "剩余时间" + s + "天" + o + "小时" + l + "分钟" + n + "秒", $("#" + e).html(r)
}
};
$("#" + e).everyTime(996, e, i)
}
}
</script>
</head>
<body>
<div class="time" id="deal-timeleft124032758117a3e2-7c47-4c30-b000-561834182635" curtime="1405754547000" diff="151653000">剩余时间1天17小时22分钟28秒</div>
<script type="text/javascript">
jQuery.each($(".time"),function(){
multiclock_channel_brand_teams($(this).attr("id"));
});
</script>
</body>
</html>
京东倒计时
最新推荐文章于 2024-02-02 15:02:11 发布