diff --git a/code/chat.js b/code/chat.js index 71d0196c..fc88c670 100644 --- a/code/chat.js +++ b/code/chat.js @@ -680,7 +680,18 @@ window.chat.postMsg = function() { var msg = $.trim($('#chatinput input').val()); if(!msg || msg === '') return; - if(c === 'debug') return new Function (msg)(); + if(c === 'debug') { + var result; + try { + result = eval(msg); + } catch(e) { + if(e.stack) console.error(e.stack); + throw e; // to trigger native error message + } + if(result !== undefined) + console.log(result.toString()); + return result; + } var publik = c === 'public'; var latlng = map.getCenter(); diff --git a/code/debugging.js b/code/debugging.js index b1d2bbe8..c72b3163 100644 --- a/code/debugging.js +++ b/code/debugging.js @@ -84,10 +84,20 @@ window.debug.console.error = function(text) { window.debug.console.overwriteNative = function() { window.debug.console.create(); - window.console = function() {} - window.console.log = window.debug.console.log; - window.console.warn = window.debug.console.warn; - window.console.error = window.debug.console.error; + + var nativeConsole = window.console; + window.console = {}; + + function overwrite(which) { + window.console[which] = function() { + nativeConsole[which].apply(nativeConsole, arguments); + window.debug.console[which].apply(window.debug.console, arguments); + } + } + + overwrite("log"); + overwrite("warn"); + overwrite("error"); } window.debug.console.overwriteNativeIfRequired = function() { diff --git a/code/panes.js b/code/panes.js index 5fd037fe..4c3898d4 100644 --- a/code/panes.js +++ b/code/panes.js @@ -1,65 +1,45 @@ // created to start cleaning up "window" interaction // window.show = function(id) { - if (typeof android !== 'undefined' && android && android.switchToPane) { - android.switchToPane(id); - } - /* - * disable all map properties when switching to another pane - * because sometimes (bug?) touch events are passed to the map when - * other panes are focussed - */ - window.disableMapProperties(); - window.hideall(); + window.hideall(); - 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.enableMapProperties(); - window.smartphone.mapButton.click(); - $('#portal_highlight_select').show(); - $('#farm_level_select').show(); - break; - case 'info': - window.smartphone.sideButton.click(); - break; - default: - window.smartphone.mapButton.click(); - break; - } -} + 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(); + $('#portal_highlight_select').show(); + $('#farm_level_select').show(); + break; + case 'info': + window.smartphone.sideButton.click(); + break; + default: + window.smartphone.mapButton.click(); + break; + } -window.enableMapProperties = function() { - window.map.tap.enable(); - window.map.dragging.enable(); - window.map.touchZoom.enable(); - window.map.doubleClickZoom.enable(); -} - -window.disableMapProperties = function() { - window.map.tap.disable(); - window.map.dragging.disable(); - window.map.touchZoom.disable(); - window.map.doubleClickZoom.disable(); + if (typeof android !== 'undefined' && android && android.switchToPane) { + android.switchToPane(id); + } } window.hideall = function() { - $('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide(); - $('#farm_level_select').hide(); - $('#map').css('visibility', 'hidden'); - $('.ui-tooltip').remove(); + $('#chatcontrols, #chat, #chatinput, #sidebartoggle, #scrollwrapper, #updatestatus, #portal_highlight_select').hide(); + $('#farm_level_select').hide(); + $('#map').css('visibility', 'hidden'); + $('.ui-tooltip').remove(); } diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js index 5004ce1c..47967e57 100644 --- a/code/portal_detail_display.js +++ b/code/portal_detail_display.js @@ -90,6 +90,17 @@ window.renderPortalDetails = function(guid) { portalDetailedDescription += ''; } + var levelDetails = getPortalLevel(d); + if(levelDetails != 8) { + if(levelDetails==Math.ceil(levelDetails)) + levelDetails += "\n8"; + else + levelDetails += "\n" + (Math.ceil(levelDetails) - levelDetails)*8; + levelDetails += " resonator level(s) needed for next portal level"; + } else { + levelDetails += "\nfully upgraded"; + } + levelDetails = "Level " + levelDetails; $('#portaldetails') .attr('class', TEAM_TO_CSS[getTeam(d)]) @@ -98,7 +109,7 @@ window.renderPortalDetails = function(guid) { + 'X' // help cursor via ".imgpreview img" + '