You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
JavaScript
49 lines
1.0 KiB
JavaScript
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
|
|
var userdata = [];
|
|
|
|
var timeout = 120;
|
|
|
|
function setuser(username) {
|
|
userdata["username"] = username;
|
|
}
|
|
|
|
function getuser() {
|
|
return userdata["username"];
|
|
}
|
|
|
|
function setname(realname) {
|
|
userdata["name"] = realname;
|
|
}
|
|
|
|
function setuid(uid) {
|
|
userdata["uid"] = uid;
|
|
}
|
|
|
|
/**
|
|
* Start a timer to reset the application when the user is idle.
|
|
* @returns {undefined}
|
|
*/
|
|
function startSessionTimeout() {
|
|
var maxtime = 120;
|
|
timeout = maxtime;
|
|
$('*').bind('mousemove keydown scroll', function () {
|
|
timeout = maxtime;
|
|
});
|
|
setInterval(function () {
|
|
timeout--;
|
|
if (timeout <= 100) {
|
|
$("#timeout-bar").animate({width: Math.round((timeout / 100) * 100) + "%"}, 1000, "linear");
|
|
} else {
|
|
$("#timeout-bar").css("width", "100%");
|
|
}
|
|
if (timeout == 0) {
|
|
document.location.href = "index.html";
|
|
}
|
|
}, 1000);
|
|
} |