You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
993 B
40 lines
993 B
(function($){
|
|
$.fn.yomi=function(){
|
|
var data="";
|
|
var _DOM=null;
|
|
var TIMER;
|
|
createdom =function(dom){
|
|
_DOM=dom;
|
|
data=$(dom).attr("data-time");
|
|
data = data.replace(/-/g,"/");
|
|
data = Math.round((new Date(data)).getTime()/1000);
|
|
reflash();
|
|
};
|
|
reflash=function(){
|
|
var range = data-Math.round((new Date()).getTime()/1000),
|
|
secday = 86400, sechour = 3600,
|
|
days = parseInt(range/secday),
|
|
hours = parseInt((range%secday)/sechour),
|
|
min = parseInt(((range%secday)%sechour)/60),
|
|
sec = ((range%secday)%sechour)%60;
|
|
|
|
$(_DOM).find(".days").html(nol(days));
|
|
$(_DOM).find(".hours").html(nol(hours));
|
|
$(_DOM).find(".minutes").html(nol(min));
|
|
$(_DOM).find(".seconds").html(nol(sec));
|
|
};
|
|
TIMER = setInterval( reflash,1000 );
|
|
nol = function(h){
|
|
if(h<0){
|
|
h='0'+'0';
|
|
}else if(h<10){
|
|
h='0'+h;
|
|
}
|
|
return h;
|
|
}
|
|
return this.each(function(){
|
|
var $box = $(this);
|
|
createdom($box);
|
|
});
|
|
}
|
|
})(jQuery);
|