diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt index eba3d881..e1a888d9 100644 --- a/src/main/resources/configuration.txt +++ b/src/main/resources/configuration.txt @@ -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 diff --git a/web/inactive.html b/web/inactive.html new file mode 100644 index 00000000..69ee1776 --- /dev/null +++ b/web/inactive.html @@ -0,0 +1,19 @@ + +Minecraft Dynamic Map - Inactive + + +
+

Map disabled due to inactivity.

+Click here to go back +
+ + diff --git a/web/js/inactive.js b/web/js/inactive.js new file mode 100644 index 00000000..cd9dfcf6 --- /dev/null +++ b/web/js/inactive.js @@ -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; + } + } +};