]> git.datanom.net - qtadmin.git/blame - js/timer.js
Fix indentation, hopefully;-)
[qtadmin.git] / js / timer.js
CommitLineData
6df4b805
MR
1/* vim: set ts=4 tw=0 sw=4 noet: */
2var timerRef=setInterval(function(){myTimer()},1000);
3var timeStart = new Date().getTime() + timeout;
4
5function myTimer() {
b95d1cdb
MR
6 var elapsed = new Date().getTime();
7 var expire = timeStart - elapsed;
8 var timeLeft = Math.round(((expire % 86400000) % 3600000) / 60000);
6df4b805 9
b95d1cdb
MR
10 if (timeLeft < 0) {
11 timeLeft = 'Expired';
12 document.getElementById("time").style.background = "red";
13 clearInterval(timerRef);
14 } else {
15 timeLeft += 1;
16 timeLeft = '< ' + timeLeft + ' min';
17 }
6df4b805
MR
18
19 document.getElementById("timer").innerHTML = timeLeft;
20}
This page took 0.029516 seconds and 5 git commands to generate.