mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 21:25:46 +01:00
Add 'sidebaropened' option to auto-pin sidebar
This commit is contained in:
parent
c00bd077cb
commit
09e1ebc972
@ -95,6 +95,9 @@ updaterate: 2000
|
|||||||
|
|
||||||
showplayerfacesinmenu: true
|
showplayerfacesinmenu: true
|
||||||
|
|
||||||
|
# Set sidebaropened: true to pin menu sidebar opened
|
||||||
|
#sidebaropened: true
|
||||||
|
|
||||||
joinmessage: "%playername% joined"
|
joinmessage: "%playername% joined"
|
||||||
quitmessage: "%playername% quit"
|
quitmessage: "%playername% quit"
|
||||||
spammessage: "You may only chat once every %interval% seconds."
|
spammessage: "You may only chat once every %interval% seconds."
|
||||||
|
@ -20,6 +20,7 @@ public class ClientConfigurationComponent extends Component {
|
|||||||
s(t, "quitmessage", c.getString("quitmessage", "%playername% quit"));
|
s(t, "quitmessage", c.getString("quitmessage", "%playername% quit"));
|
||||||
s(t, "spammessage", c.getString("spammessage", "You may only chat once every %interval% seconds."));
|
s(t, "spammessage", c.getString("spammessage", "You may only chat once every %interval% seconds."));
|
||||||
s(t, "defaultzoom", c.getInteger("defaultzoom", 0));
|
s(t, "defaultzoom", c.getInteger("defaultzoom", 0));
|
||||||
|
s(t, "sidebaropened", c.getBoolean("sidebaropened", false));
|
||||||
|
|
||||||
DynmapWorld defaultWorld = null;
|
DynmapWorld defaultWorld = null;
|
||||||
for(DynmapWorld world : plugin.mapManager.getWorlds()) {
|
for(DynmapWorld world : plugin.mapManager.getWorlds()) {
|
||||||
|
@ -165,21 +165,35 @@ DynMap.prototype = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Sidebar
|
// Sidebar
|
||||||
var sidebar = me.sidebar = $('<div/>')
|
var panel;
|
||||||
|
var sidebar;
|
||||||
|
var pinbutton;
|
||||||
|
if(!me.options.sidebaropened) {
|
||||||
|
sidebar = me.sidebar = $('<div/>')
|
||||||
.addClass('sidebar')
|
.addClass('sidebar')
|
||||||
.appendTo(container);
|
.appendTo(container);
|
||||||
|
|
||||||
var panel = $('<div/>')
|
panel = $('<div/>')
|
||||||
.addClass('panel')
|
.addClass('panel')
|
||||||
.appendTo(sidebar);
|
.appendTo(sidebar);
|
||||||
|
|
||||||
// Pin button.
|
// Pin button.
|
||||||
var pinbutton = $('<div/>')
|
pinbutton = $('<div/>')
|
||||||
.addClass('pin')
|
.addClass('pin')
|
||||||
.click(function() {
|
.click(function() {
|
||||||
sidebar.toggleClass('pinned');
|
sidebar.toggleClass('pinned');
|
||||||
})
|
})
|
||||||
.appendTo(panel);
|
.appendTo(panel);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sidebar = me.sidebar = $('<div/>')
|
||||||
|
.addClass('sidebar pinned')
|
||||||
|
.appendTo(container);
|
||||||
|
|
||||||
|
panel = $('<div/>')
|
||||||
|
.addClass('panel')
|
||||||
|
.appendTo(sidebar);
|
||||||
|
}
|
||||||
|
|
||||||
// Worlds
|
// Worlds
|
||||||
var worldlist;
|
var worldlist;
|
||||||
@ -275,10 +289,11 @@ DynMap.prototype = {
|
|||||||
.append(link=$('<input type="text" />'))
|
.append(link=$('<input type="text" />'))
|
||||||
.data('link', link)
|
.data('link', link)
|
||||||
.appendTo(container);*/
|
.appendTo(container);*/
|
||||||
|
if(!me.options.sidebaropened) {
|
||||||
$('<div/>')
|
$('<div/>')
|
||||||
.addClass('hitbar')
|
.addClass('hitbar')
|
||||||
.appendTo(panel);
|
.appendTo(panel);
|
||||||
|
}
|
||||||
|
|
||||||
var alertbox = me.alertbox = $('<div/>')
|
var alertbox = me.alertbox = $('<div/>')
|
||||||
.addClass('alertbox')
|
.addClass('alertbox')
|
||||||
@ -378,15 +393,6 @@ DynMap.prototype = {
|
|||||||
me.serverday = true;
|
me.serverday = true;
|
||||||
else
|
else
|
||||||
me.serverday = false;
|
me.serverday = false;
|
||||||
if(me.serverday != oldday) {
|
|
||||||
var mtid = me.map.mapTypeId;
|
|
||||||
if(me.map.mapTypes[mtid].nightandday) {
|
|
||||||
me.map.setMapTypeId('none');
|
|
||||||
window.setTimeout(function() {
|
|
||||||
me.map.setMapTypeId(mtid);
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var newplayers = {};
|
var newplayers = {};
|
||||||
$.each(update.players, function(index, playerUpdate) {
|
$.each(update.players, function(index, playerUpdate) {
|
||||||
@ -430,6 +436,16 @@ DynMap.prototype = {
|
|||||||
//divs.filter(function(i){return parseInt(divs[i].attr('rel')) > timestamp+me.options.messagettl;}).remove();
|
//divs.filter(function(i){return parseInt(divs[i].attr('rel')) > timestamp+me.options.messagettl;}).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(me.serverday != oldday) {
|
||||||
|
var mtid = me.map.mapTypeId;
|
||||||
|
if(me.map.mapTypes[mtid].nightandday) {
|
||||||
|
me.map.setMapTypeId('none');
|
||||||
|
window.setTimeout(function() {
|
||||||
|
me.map.setMapTypeId(mtid);
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(me).trigger('worldupdated', [ update ]);
|
$(me).trigger('worldupdated', [ update ]);
|
||||||
|
|
||||||
me.lasttimestamp = update.timestamp;
|
me.lasttimestamp = update.timestamp;
|
||||||
|
Loading…
Reference in New Issue
Block a user