Initial commit
This commit is contained in:
21
Creative/dynmap/web/js/inactive.js
Normal file
21
Creative/dynmap/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;
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user