Added inactive component, which checks for inactivity of the user.
This commit is contained in:
parent
cb81ef649f
commit
b472583319
3 changed files with 47 additions and 1 deletions
21
web/js/inactive.js
Normal file
21
web/js/inactive.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
componentconstructors['inactive'] = function(dynmap, configuration) {
|
||||
var me = this;
|
||||
var inactivetimer = null;
|
||||
$(document)
|
||||
.ready(onactivity)
|
||||
.mousemove(onactivity)
|
||||
.mouseup(onactivity)
|
||||
.keypress(onactivity);
|
||||
function onactivity() {
|
||||
clearTimeout(inactivetimer);
|
||||
inactivetimer = setTimeout(oninactive, (configuration.timeout || 1800)*1000);
|
||||
}
|
||||
function oninactive() {
|
||||
if (configuration.showmessage) {
|
||||
alert(configuration.showmessage);
|
||||
}
|
||||
if (configuration.redirecturl) {
|
||||
window.location = configuration.redirecturl;
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue