From: Michael Rasmussen Date: Wed, 3 Jun 2015 23:09:10 +0000 (+0200) Subject: Fix timer X-Git-Url: http://git.datanom.net/qtadmin.git/commitdiff_plain/e0ed91d70278c4492826a04f65aa6aaefd8043b0 Fix timer --- diff --git a/js/timer.js b/js/timer.js index 45883c6..d166ffd 100644 --- a/js/timer.js +++ b/js/timer.js @@ -8,16 +8,16 @@ function myTimer() { var expire = timeStart - elapsed; var timeLeft = Math.round(((expire % 86400000) % 3600000) / 60000); - if (timeLeft < 0) { + if (timeLeft < 1) { clearInterval(timerRef); console.log('Session expired, reload page'); last = -1; location.reload(); - } else if (timeLeft < 1) { + } else if (timeLeft < 2) { if (timeLeft < last || last == -1) { last = timeLeft; timeLeft = 'Expired'; - console.log('Session valid < 1'); + console.log('Session soon to expire'); document.getElementById("time").style.background = "red"; document.getElementById("timer").innerHTML = timeLeft; }