Switch chat name URL parm to 'chatname', add 'playername' URL part for initial player follow selection

This commit is contained in:
Mike Primm 2011-12-26 13:10:08 +08:00 committed by mikeprimm
parent ca00a84dc5
commit bd92cc37bf
2 changed files with 10 additions and 1 deletions

View File

@ -19,7 +19,7 @@ componentconstructors['chat'] = function(dynmap, configuration) {
});
var pname = null;
if(configuration.allowurlname) {
pname = dynmap.getParameterByName("playername");
pname = dynmap.getParameterByName("chatname");
if(pname == "") pname = null;
}

View File

@ -40,6 +40,7 @@ DynMap.prototype = {
serverday: false,
inittime: new Date().getTime(),
followingPlayer: '',
initfollow: null,
missedupdates: 0,
layercontrol: undefined,
formatUrl: function(name, options) {
@ -115,6 +116,10 @@ DynMap.prototype = {
if(typeof me.options.defaultzoom == 'undefined')
me.options.defaultzoom = 1;
var initfollowplayer = me.getParameterByName('playername');
if(initfollowplayer != "")
me.initfollow = initfollowplayer;
var map = this.map = new L.Map(mapContainer.get(0), {
zoom: me.options.defaultzoom,
center: new L.LatLng(0, 0),
@ -556,6 +561,10 @@ DynMap.prototype = {
me.updatePlayer(player, playerUpdate);
} else {
me.addPlayer(playerUpdate);
if(me.initfollow && me.initfollow == name) {
me.followPlayer(me.players[name]);
me.initfollow = null;
}
}
newplayers[name] = player;
});