]>
git.datanom.net - qtadmin.git/blob - js/timer.js
1 /* vim: set ts=4 tw=4 sw=4 noet: */
2 var timerRef
=setInterval(function(){myTimer()}, 1000);
3 var timeStart
= new Date().getTime() + timeout
;
7 var elapsed
= new Date().getTime();
8 var expire
= timeStart
- elapsed
;
9 var timeLeft
= Math
.round(((expire
% 86400000) % 3600000) / 60000);
12 clearInterval(timerRef
);
13 console
.log('Session expired, reload page');
16 } else if (timeLeft
== 1) {
17 if (timeLeft
< last
|| last
== -1) {
19 timeLeft
= '< ' + timeLeft
+ ' min';
20 /*console.log('Session soon to expire');*/
21 document
.getElementById("time").style
.background
= "red";
22 document
.getElementById("timer").innerHTML
= timeLeft
;
25 if ((timeLeft
< last
&& timeLeft
> 0) || last
== -1) {
27 /*console.log('Session valid < ' + timeLeft);*/
28 timeLeft
= '< ' + timeLeft
+ ' min';
29 document
.getElementById("timer").innerHTML
= timeLeft
;
This page took 0.085323 seconds and 6 git commands to generate.