]>
iEval git - gruntmaster-page.git/blob - js/90-timers.js
1 function update_timer(timer
){
2 var start
= parseInt(timer
.dataset
.start
);
3 var stop
= parseInt(timer
.dataset
.stop
);
4 var value
= parseInt(timer
.dataset
.value
);
5 var now
= Math
.floor(Date
.now() / 1000);
8 var total
= stop
- start
;
13 value
= Math
.max(value
* 3 / 10, value
* left
/ total
);
14 timer
.innerHTML
= Math
.floor(value
);
16 var hours
= left
/ 60 / 60;
17 hours
= hours
< 10 ? '0' + hours
: hours
;
18 var minutes
= left
/ 60 % 60;
19 minutes
= minutes
< 10 ? '0' + minutes
: minutes
;
20 var seconds
= left
% 60;
21 seconds
= seconds
< 10 ? '0' + seconds
: seconds
;
22 timer
.innerHTML
= hours
+ ':' + minutes
+ ':' + seconds
;
27 $('.timer').each(function(item
){
29 setInterval(function(){update_timer(item
)}, 1000);
This page took 0.0468 seconds and 4 git commands to generate.