From 61d83567a6f0ca771761bf1975ef761e519d1ab1 Mon Sep 17 00:00:00 2001 From: Xelio Date: Thu, 2 May 2013 14:30:44 +0800 Subject: [PATCH 1/5] Add function for plugin to add layerGroup and persist display status between session --- code/utils_misc.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/utils_misc.js b/code/utils_misc.js index dede2f01..c42d50b3 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -372,3 +372,8 @@ window.isLayerGroupDisplayed = function(name) { if(typeof(overlayStatus[name]) === 'undefined') return true; return overlayStatus[name]; } + +window.addLayerGroup = function(name, layerGroup, defaultDisplay) { + if(isLayerGroupDisplayed(name) || defaultDisplay) map.addLayer(layerGroup); + layerChooser.addOverlay(layerGroup, name); +} From 32c4e79d5f1f7e37862a98bec4123e41feb5482a Mon Sep 17 00:00:00 2001 From: Xelio Date: Thu, 2 May 2013 14:41:10 +0800 Subject: [PATCH 2/5] Plugin Keys On Map: Change to use window.addLayerGroup() to handle plugin layer --- plugins/keys-on-map.user.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/keys-on-map.user.js b/plugins/keys-on-map.user.js index 0cf301b5..43aa1338 100644 --- a/plugins/keys-on-map.user.js +++ b/plugins/keys-on-map.user.js @@ -106,9 +106,7 @@ window.plugin.keysOnMap.setupCSS = function() { } window.plugin.keysOnMap.setupLayer = function() { - window.layerChooser.addOverlay(window.plugin.keysOnMap.keyLayerGroup, 'Keys'); - if(isLayerGroupDisplayed('Keys')) - map.addLayer(window.plugin.keysOnMap.keyLayerGroup); + window.addLayerGroup('Keys', window.plugin.keysOnMap.keyLayerGroup, false); } var setup = function() { From 50f4004ac5378c0353ce5046f4a8b40e2eee279e Mon Sep 17 00:00:00 2001 From: Xelio Date: Fri, 3 May 2013 13:10:25 +0800 Subject: [PATCH 3/5] Fix logic bug in addLayerGroup --- code/utils_misc.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/utils_misc.js b/code/utils_misc.js index c42d50b3..987cb81d 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -360,20 +360,20 @@ window.updateDisplayedLayerGroup = function(name, display) { // Read layerGroup status from window.overlayStatus if it was added to map, // read from cookie if it has not added to map yet. // return true if both overlayStatus and cookie didn't have the record -window.isLayerGroupDisplayed = function(name) { +window.isLayerGroupDisplayed = function(name, defaultDisplay) { if(typeof(overlayStatus[name]) !== 'undefined') return overlayStatus[name]; var layersJSON = readCookie('ingress.intelmap.layergroupdisplayed'); - if(!layersJSON) return true; + if(!layersJSON) return defaultDisplay; var layers = JSON.parse(layersJSON); // keep latest overlayStatus overlayStatus = $.extend(layers, overlayStatus); - if(typeof(overlayStatus[name]) === 'undefined') return true; + if(typeof(overlayStatus[name]) === 'undefined') return defaultDisplay; return overlayStatus[name]; } window.addLayerGroup = function(name, layerGroup, defaultDisplay) { - if(isLayerGroupDisplayed(name) || defaultDisplay) map.addLayer(layerGroup); + if(isLayerGroupDisplayed(name, defaultDisplay)) map.addLayer(layerGroup); layerChooser.addOverlay(layerGroup, name); } From 917a538a1143753b3f0bf3e3746106b4a1ae475d Mon Sep 17 00:00:00 2001 From: Xelio Date: Fri, 3 May 2013 13:14:13 +0800 Subject: [PATCH 4/5] Fix comment --- code/utils_misc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/utils_misc.js b/code/utils_misc.js index 987cb81d..dc9c6a6f 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -359,7 +359,7 @@ window.updateDisplayedLayerGroup = function(name, display) { // Read layerGroup status from window.overlayStatus if it was added to map, // read from cookie if it has not added to map yet. -// return true if both overlayStatus and cookie didn't have the record +// return 'defaultDisplay' if both overlayStatus and cookie didn't have the record window.isLayerGroupDisplayed = function(name, defaultDisplay) { if(typeof(overlayStatus[name]) !== 'undefined') return overlayStatus[name]; From 42d5b8d8f99734ea2e6de7b20bae99590476f69f Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sun, 5 May 2013 19:15:15 +0100 Subject: [PATCH 5/5] reduce the sidebar height when no portal is selected - more useful now that the portal details now have a 'X' close button could perhaps reduce the hight further, but then the expand/colapse arrow gets a bit cramped towards the top (could look into centering this vertically though..?) also, moved the default right position of the sidebartoggle to offscreen. it's set in code anyway, and will look nicer on mobile app initialisation --- style.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/style.css b/style.css index 5ebfdb69..39264f66 100644 --- a/style.css +++ b/style.css @@ -45,7 +45,7 @@ body { margin-top: -31px; /* -(toggle height / 2) */ line-height: 10px; position: absolute; - top: 325px; /* (sidebar height / 2) */ + top: 108px; z-index: 3001; background-color: rgba(8, 48, 78, 0.9); color: #FFCE00; @@ -53,7 +53,7 @@ body { border-right: none; border-radius: 5px 0 0 5px; text-decoration: none; - right: 301px; /* overwritten later by the script with SIDEBAR_WIDTH */ + right: -50px; /* overwritten later by the script with SIDEBAR_WIDTH */ } .enl { @@ -652,7 +652,7 @@ h3 { * content when first selecting a portal) */ #portaldetails { - min-height: 485px; + min-height: 63px; position: relative; /* so the below '#portaldetails .close' is relative to this */ }