don't create layer groups until the setup function is called. if a plugin is processed before IITC core script, leaflet isn't available

fix #460
This commit is contained in:
Jon Atkins 2013-07-31 16:13:58 +01:00
parent d177c27a6d
commit 42316ca0e9

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-portal-level-numbers@rongou
// @name IITC plugin: Portal Level Numbers
// @category Layer
// @version 0.1.0.@@DATETIMEVERSION@@
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -22,7 +22,7 @@
window.plugin.portalLevelNumbers = function() {};
window.plugin.portalLevelNumbers.levelLayers = {};
window.plugin.portalLevelNumbers.levelLayerGroup = new L.LayerGroup();
window.plugin.portalLevelNumbers.levelLayerGroup = null;
// Use portal add and remove event to control render of portal level numbers
window.plugin.portalLevelNumbers.portalAdded = function(data) {
@ -76,6 +76,8 @@ var setup = function() {
}")
.appendTo("head");
window.plugin.portalLevelNumbers.levelLayerGroup = new L.LayerGroup();
window.addLayerGroup('Portal Levels', window.plugin.portalLevelNumbers.levelLayerGroup, true);
window.addHook('portalAdded', window.plugin.portalLevelNumbers.portalAdded);