Merge pull request #215 from Xelio/patch-plugin-keysonmap-1

Plugin Keys On Map: Keys layer stay display/hide as previous session.
This commit is contained in:
Jon Atkins 2013-04-30 11:30:39 -07:00
commit 19638dfc39

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @id iitc-plugin-keys-on-map@xelio // @id iitc-plugin-keys-on-map@xelio
// @name IITC plugin: Keys on map // @name IITC plugin: Keys on map
// @version 0.1.0.@@DATETIMEVERSION@@ // @version 0.2.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -90,7 +90,7 @@ window.plugin.keysOnMap.disableMessage = function() {
} }
} }
var setup = function() { window.plugin.keysOnMap.setupCSS = function() {
$("<style>") $("<style>")
.prop("type", "text/css") .prop("type", "text/css")
.html(".plugin-keys-on-map-key {\ .html(".plugin-keys-on-map-key {\
@ -103,9 +103,18 @@ var setup = function() {
-webkit-text-size-adjust:none;\ -webkit-text-size-adjust:none;\
}") }")
.appendTo("head"); .appendTo("head");
}
window.plugin.keysOnMap.setupLayer = function() {
window.layerChooser.addOverlay(window.plugin.keysOnMap.keyLayerGroup, 'Keys'); window.layerChooser.addOverlay(window.plugin.keysOnMap.keyLayerGroup, 'Keys');
map.addLayer(window.plugin.keysOnMap.keyLayerGroup); if(isLayerGroupDisplayed('Keys'))
map.addLayer(window.plugin.keysOnMap.keyLayerGroup);
}
var setup = function() {
window.plugin.keysOnMap.setupCSS();
window.plugin.keysOnMap.setupLayer();
// Avoid error if this plugin load first // Avoid error if this plugin load first
if($.inArray('pluginKeysUpdateKey', window.VALID_HOOKS) < 0) if($.inArray('pluginKeysUpdateKey', window.VALID_HOOKS) < 0)