Added debug menu option and started tidying up 'window' handling

This commit is contained in:
Jon Benson
2013-05-07 14:09:30 +10:00
parent d97b78fafb
commit 0108d1b49c
11 changed files with 62 additions and 30 deletions

View File

@ -522,10 +522,11 @@ window.chat.chooseAnchor = function(t) {
chat.needMoreMessages();
}
window.chat.choose = function(name) {
$('#chat, #chatinput, #updatestatus').show();
window.chat.show = function(name) {
if (!window.isSmartphone) $('#updatestatus').show();
$('#chat, #chatinput').show();
$('#map').css('visibility', 'hidden');
var t = $('<a>'+name+'</a>');
window.chat.chooseAnchor(t);
}

View File

@ -48,16 +48,23 @@ window.debug.console = function() {
$('#debugconsole').text();
}
window.debug.console.create = function() {
if($('#debugconsole').length) return;
$('#chatcontrols').append('<a>debug</a>');
$('#chatcontrols a:last').click(function() {
window.debug.console.show = function() {
$('#scrollwrapper, #updatestatus').hide();
// not displaying the map causes bugs in Leaflet
$('#map').css('visibility', 'hidden');
$('#chat, #chatinput').show();
window.debug.console.create();
$('#chatinput mark').css('cssText', 'color: #bbb !important').text('debug:');
$('#chat > div').hide();
$('#debugconsole').show();
$('#chatcontrols .active').removeClass('active');
$(this).addClass('active');
});
}
window.debug.console.create = function() {
if($('#debugconsole').length) return;
$('#chatcontrols').append('<a>debug</a>');
$('#chatcontrols a:last').click(window.debug.console.show);
$('#chat').append('<div style="display: none" id="debugconsole"><table></table></div>');
}

View File

@ -34,14 +34,6 @@ window.runOnSmartphonesBeforeBoot = function() {
+ '</style>');
}
// this also matches the expand button, but it is hidden via CSS
$('#chatcontrols a').click(function() {
$('#scrollwrapper, #updatestatus').hide();
// not displaying the map causes bugs in Leaflet
$('#map').css('visibility', 'hidden');
$('#chat, #chatinput').show();
});
window.smartphone.mapButton = $('<a>map</a>').click(function() {
$('#chat, #chatinput, #scrollwrapper').hide();
$('#map').css('visibility', 'visible');

30
code/window_management.js Normal file
View File

@ -0,0 +1,30 @@
// created to start cleaning up "window" interaction
//
window.show = function(id) {
switch(id) {
case 'full':
window.chat.show('full');
break;
case 'compact':
window.chat.show('compact');
break;
case 'public':
window.chat.show('public');
break;
case 'faction':
window.chat.show('faction');
break;
case 'debug':
window.debug.console.show();
break;
case 'map':
window.smartphone.mapButton.click();
break;
case 'info':
window.smartphone.sideButton.click();
break;
default:
window.smartphone.mapButton.Click();
break;
}
}