Plugin Keys On Map: Show message when the plugin disabled.

This commit is contained in:
Xelio 2013-03-27 11:39:29 +08:00
parent 6cef4d99e4
commit 3caaaf5164

View File

@ -28,8 +28,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)
if(!plugin.keys) {
plugin.keysOnMap.disableMessage();
return;
}
data.portal.on('add', function() {
plugin.keysOnMap.renderKey(this.options.guid, this.getLatLng());
@ -42,9 +44,10 @@ window.plugin.keysOnMap.portalAdded = function(data) {
window.plugin.keysOnMap.keyUpdate = function(data) {
// Disable if Plugin Keys is not there
if(!plugin.keys)
if(!plugin.keys) {
plugin.keysOnMap.disableMessage();
return;
}
var portal = window.portals[data.guid];
if(!portal) return;
var latLng = portal.getLatLng();
@ -80,6 +83,13 @@ window.plugin.keysOnMap.removeKey = function(guid) {
}
}
window.plugin.keysOnMap.disableMessage = function() {
if(!plugin.keysOnMap.messageShown) {
alert('Plugin "Keys On Map" need plugin "Keys" to run!');
plugin.keysOnMap.messageShown = true;
}
}
var setup = function() {
$("<style>")
.prop("type", "text/css")