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