From 0e118af51ef51b53f02f1f0c1a92c029c1dc09bb Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Tue, 22 Nov 2011 01:36:44 +0800 Subject: [PATCH] Add support for 'webpage-title' setting, default title to server-name --- src/main/java/org/dynmap/ClientConfigurationComponent.java | 4 ++++ src/main/resources/configuration.txt | 3 +++ web/js/map.js | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/main/java/org/dynmap/ClientConfigurationComponent.java b/src/main/java/org/dynmap/ClientConfigurationComponent.java index b5152d81..46389fcc 100644 --- a/src/main/java/org/dynmap/ClientConfigurationComponent.java +++ b/src/main/java/org/dynmap/ClientConfigurationComponent.java @@ -24,6 +24,10 @@ public class ClientConfigurationComponent extends Component { s(t, "sidebaropened", c.getString("sidebaropened", "false")); s(t, "dynmapversion", plugin.getDescription().getVersion()); s(t, "cyrillic", c.getBoolean("cyrillic-support", false)); + String sn = plugin.getServer().getServerName(); + if(sn.equals("Unknown Server")) + sn = "Minecraft Dynamic Map"; + s(t, "title", c.getString("webpage-title", sn)); DynmapWorld defaultWorld = null; String defmap = null; diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt index d6b99e73..999879c0 100644 --- a/src/main/resources/configuration.txt +++ b/src/main/resources/configuration.txt @@ -304,6 +304,9 @@ render-triggers: - pistonmoved - explosion +# Title for the web page - if not specified, defaults to the server's name (unless it is the default of 'Unknown Server') +#webpage-title: "My Awesome Server Map" + # The path where the tile-files are placed. tilespath: web/tiles diff --git a/web/js/map.js b/web/js/map.js index c74d7f1a..5a42d877 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -101,6 +101,9 @@ DynMap.prototype = { .addClass('map') .appendTo(container); + if(me.options.title) + document.title = me.options.title; + var urlzoom = me.getIntParameterByName('zoom'); if(urlzoom != null) me.options.defaultzoom = urlzoom;