Add URL 'nopanel' option to remove sidebar, remove layer control if no layers

This commit is contained in:
Mike Primm 2011-10-02 10:32:57 +08:00 committed by mikeprimm
parent b98ccb8c94
commit 3f2ee0fc76

View File

@ -138,13 +138,11 @@ DynMap.prototype = {
me.followPlayer(null);
});*/
me.layercontrol = new DynmapLayerControl();
map.addControl(me.layercontrol);
// Sidebar
var panel;
var sidebar;
var pinbutton;
var nopanel = (me.getParameterByName('nopanel') == 'true');
if(me.options.sidebaropened != 'true') { // false or pinned
var pincls = 'pinned'
@ -152,8 +150,7 @@ DynMap.prototype = {
pincls = '';
sidebar = me.sidebar = $('<div/>')
.addClass('sidebar ' + pincls)
.appendTo(container);
.addClass('sidebar ' + pincls);
panel = $('<div/>')
.addClass('panel')
@ -169,13 +166,14 @@ DynMap.prototype = {
}
else {
sidebar = me.sidebar = $('<div/>')
.addClass('sidebar pinned')
.appendTo(container);
.addClass('sidebar pinned');
panel = $('<div/>')
.addClass('panel')
.appendTo(sidebar);
}
if(!nopanel)
sidebar.appendTo(container);
// Worlds
var worldlist;
@ -704,6 +702,12 @@ DynMap.prototype = {
addToLayerSelector: function(layer, name, priority) {
var me = this;
if(!me.layercontrol) {
me.layercontrol = new DynmapLayerControl();
map.addControl(me.layercontrol);
}
var i;
for(i = 0; i < me.layersetlist.length; i++) {
if(me.layersetlist[i].layer === layer) {