mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-26 18:47:40 +01:00
Added ability to set each url individually.
This commit is contained in:
parent
f0cdd5614b
commit
d1a8c40248
@ -1,9 +1,33 @@
|
|||||||
var config = {
|
var config = {
|
||||||
|
// For internal server or proxying webserver.
|
||||||
|
url: {
|
||||||
|
configuration: 'up/configuration',
|
||||||
|
update: 'up/world/{world}/{timestamp}',
|
||||||
|
sendmessage: 'up/sendmessage'
|
||||||
|
},
|
||||||
|
|
||||||
|
// For proxying webserver through php.
|
||||||
|
//url: {
|
||||||
|
// configuration: 'up.php?path=configuration',
|
||||||
|
// update: 'up.php?path=world/{world}/?{timestamp}',
|
||||||
|
// sendmessage: 'up.php?path=sendmessage'
|
||||||
|
//},
|
||||||
|
|
||||||
|
// For proxying webserver through aspx.
|
||||||
|
//url: {
|
||||||
|
// configuration: 'up.aspx?path=configuration',
|
||||||
|
// update: 'up.aspx?path=world/{world}/?{timestamp}',
|
||||||
|
// sendmessage: 'up.aspx?path=sendmessage'
|
||||||
|
//},
|
||||||
|
|
||||||
|
// For standalone (jsonfile) webserver.
|
||||||
|
//url: {
|
||||||
|
// configuration: 'standalone/dynmap_config.json',
|
||||||
|
// update: 'standalone/dynmap_{world}.json',
|
||||||
|
// sendmessage: 'standalone/sendmessage.php'
|
||||||
|
//},
|
||||||
|
|
||||||
tileUrl: 'tiles/',
|
tileUrl: 'tiles/',
|
||||||
updateUrl: 'up/', // For Apache and lighttpd
|
tileWidth: 128,
|
||||||
// updateUrl: 'up.php?path=', // For Apache and lighttpd without ability to natively proxy
|
tileHeight: 128
|
||||||
// updateUrl: 'up.aspx?path=', // For IIS
|
|
||||||
// configurationUrl: 'standalone/dynmap_config.json', // For some standalone setups.
|
|
||||||
tileWidth: 128,
|
|
||||||
tileHeight: 128
|
|
||||||
};
|
};
|
@ -78,7 +78,7 @@ function Location(world, x, y, z) {
|
|||||||
function DynMap(options) {
|
function DynMap(options) {
|
||||||
var me = this;
|
var me = this;
|
||||||
me.options = options;
|
me.options = options;
|
||||||
$.getJSON(me.options.configurationUrl || (me.options.updateUrl + 'configuration'), function(configuration) {
|
$.getJSON(me.options.url.configuration, function(configuration) {
|
||||||
me.configure(configuration);
|
me.configure(configuration);
|
||||||
me.initialize();
|
me.initialize();
|
||||||
}, function(status, statusMessage) {
|
}, function(status, statusMessage) {
|
||||||
@ -92,6 +92,13 @@ DynMap.prototype = {
|
|||||||
players: {},
|
players: {},
|
||||||
lasttimestamp: '0',
|
lasttimestamp: '0',
|
||||||
followingPlayer: '',
|
followingPlayer: '',
|
||||||
|
formatUrl: function(name, options) {
|
||||||
|
var url = this.options.url[name];
|
||||||
|
$.each(options, function(n,v) {
|
||||||
|
url = url.replace("{" + n + "}", v);
|
||||||
|
});
|
||||||
|
return url;
|
||||||
|
},
|
||||||
configure: function(configuration) {
|
configure: function(configuration) {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.extend(me.options, configuration);
|
$.extend(me.options, configuration);
|
||||||
@ -352,7 +359,7 @@ DynMap.prototype = {
|
|||||||
var me = this;
|
var me = this;
|
||||||
|
|
||||||
$(me).trigger('worldupdating');
|
$(me).trigger('worldupdating');
|
||||||
$.getJSON(me.options.updateUrl + "world/" + me.world.name + "/" + me.lasttimestamp, function(update) {
|
$.getJSON(me.formatUrl('update', { world: me.world.name, timestamp: me.lasttimestamp }), function(update) {
|
||||||
if (!update) {
|
if (!update) {
|
||||||
setTimeout(function() { me.update(); }, me.options.updaterate);
|
setTimeout(function() { me.update(); }, me.options.updaterate);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user