]>
iEval git - gruntmaster-page.git/blob - js/90-timers.js
4 function update_timer(timer
){
5 var start
= parseInt(timer
.dataset
.start
);
6 var stop
= parseInt(timer
.dataset
.stop
);
7 var value
= parseInt(timer
.dataset
.value
);
8 var now
= Math
.floor(Date
.now() / 1000);
10 var left
= stop
- now
;
11 var total
= stop
- start
;
16 value
= Math
.max(value
* 3 / 10, value
* left
/ total
);
17 timer
.innerHTML
= Math
.floor(value
);
19 var hours
= left
/ 60 / 60;
20 var minutes
= left
/ 60 % 60;
21 var seconds
= left
% 60;
22 timer
.innerHTML
= sprintf('%02d:%02d:%02d', hours
, minutes
, seconds
);
26 $( document
).ready(function() {
27 $('.timer').each(function(index
, item
){
29 setInterval(function(){update_timer(item
)}, 1000);
This page took 0.042363 seconds and 4 git commands to generate.