From 308cea39f87ea4d76cf866817153a7f83edffa0e Mon Sep 17 00:00:00 2001 From: Xelio Date: Wed, 27 Mar 2013 11:15:18 +0800 Subject: [PATCH] Plugin Keys On Map: Disable if Plugin Keys is not there --- plugins/keys-on-map.user.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/keys-on-map.user.js b/plugins/keys-on-map.user.js index 91a26e47..54e0a5f3 100644 --- a/plugins/keys-on-map.user.js +++ b/plugins/keys-on-map.user.js @@ -27,6 +27,10 @@ window.plugin.keysOnMap.keyLayerGroup = new L.LayerGroup(); // Use portal add and remove event to control render of keys window.plugin.keysOnMap.portalAdded = function(data) { + // Disable if Plugin Keys is not there + if(!plugin.keys) + return; + data.portal.on('add', function() { plugin.keysOnMap.renderKey(this.options.guid, this.getLatLng()); }); @@ -37,6 +41,10 @@ window.plugin.keysOnMap.portalAdded = function(data) { } window.plugin.keysOnMap.keyUpdate = function(data) { + // Disable if Plugin Keys is not there + if(!plugin.keys) + return; + var portal = window.portals[data.guid]; if(!portal) return; var latLng = portal.getLatLng();