mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-14 06:16:46 +01:00
Added inactive component, which checks for inactivity of the user.
This commit is contained in:
parent
68cb59997e
commit
f05dfac0a4
@ -95,7 +95,13 @@ components:
|
||||
# type: logo
|
||||
# text: "Dynmap"
|
||||
# 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
|
||||
# type: regions
|
||||
# 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…
Reference in New Issue
Block a user