46 lines
1.0 KiB
Plaintext
Executable File
46 lines
1.0 KiB
Plaintext
Executable File
var t = 0;
|
|
var timerInterval;
|
|
|
|
function showTimer(timeInMillis){
|
|
if(timerInterval != undefined){
|
|
clearInterval(timerInterval);
|
|
}
|
|
t = timeInMillis;
|
|
timerInterval = setInterval(function (){calculateTime()}, 1000);
|
|
}
|
|
|
|
function calculateTime(){
|
|
t = t - 1000;
|
|
//console.log(t);
|
|
if(t >= 0){
|
|
//document.title = formatTime(t);
|
|
}else{
|
|
// console.log(t);
|
|
clearInterval(timerInterval);
|
|
document.title = "Sesi\xf3n Expirada";
|
|
showPopupTimeout();
|
|
}
|
|
}
|
|
|
|
function pad(number, length) {
|
|
var str = '' + number;
|
|
while (str.length < length) {str = '0' + str;}
|
|
return str;
|
|
}
|
|
|
|
function showPopupTimeout(){
|
|
$.ajax({
|
|
url: "closeSessionMaia",
|
|
async: false
|
|
}).done(function() {});
|
|
PF('popupTimeout').show();
|
|
|
|
}
|
|
function formatTime(time) {
|
|
time = time / 10;
|
|
var min = parseInt(time / 6000),
|
|
sec = parseInt(time / 100) - (min * 60),
|
|
hundredths = pad(time - (sec * 100) - (min * 6000), 2);
|
|
return (min > 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2) ;
|
|
}
|