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
|
|
@ -95,7 +95,13 @@ components:
|
||||||
# type: logo
|
# type: logo
|
||||||
# text: "Dynmap"
|
# text: "Dynmap"
|
||||||
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
|
# linkurl: "http://forums.bukkit.org/threads/dynmap.489/"
|
||||||
|
|
||||||
|
#- class: org.dynmap.ClientComponent
|
||||||
|
# type: inactive
|
||||||
|
# timeout: 1800 # in seconds (1800 seconds = 30 minutes)
|
||||||
|
# redirecturl: inactive.html
|
||||||
|
# #showmessage: 'You were inactive for too long.'
|
||||||
|
|
||||||
#- class: org.dynmap.regions.RegionsComponent
|
#- class: org.dynmap.regions.RegionsComponent
|
||||||
# type: regions
|
# type: regions
|
||||||
# name: WorldGuard
|
# name: WorldGuard
|
||||||
|
|
|
||||||
19
web/inactive.html
Normal file
19
web/inactive.html
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<html>
|
||||||
|
<head><title>Minecraft Dynamic Map - Inactive</title></head>
|
||||||
|
<style>
|
||||||
|
body > div {
|
||||||
|
position:fixed;
|
||||||
|
top:50%;left:50%;margin:-.5em 0 0 -6.5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
color:#c33;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1>Map disabled due to inactivity.</h1>
|
||||||
|
<a href="./">Click here to go back</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
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