Update Plugin Keys and Keys On Map to work with Plugin Sync

This commit is contained in:
Xelio
2013-05-08 20:43:56 +08:00
parent 13d1ff9aaa
commit 85ce464728
2 changed files with 113 additions and 11 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @id iitc-plugin-keys-on-map@xelio
// @name IITC plugin: Keys on map
// @version 0.2.0.@@DATETIMEVERSION@@
// @version 0.2.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -55,6 +55,13 @@ window.plugin.keysOnMap.keyUpdate = function(data) {
plugin.keysOnMap.renderKey(data.guid, latLng)
}
window.plugin.keysOnMap.refreshAllKeys = function() {
plugin.keysOnMap.keyLayerGroup.clearLayers();
$.each(plugin.keys.keys, function(key, count) {
plugin.keysOnMap.keyUpdate({guid: key});
});
}
window.plugin.keysOnMap.renderKey = function(guid,latLng) {
plugin.keysOnMap.removeKey(guid);
@ -117,9 +124,12 @@ var setup = function() {
// Avoid error if this plugin load first
if($.inArray('pluginKeysUpdateKey', window.VALID_HOOKS) < 0)
window.VALID_HOOKS.push('pluginKeysUpdateKey');
if($.inArray('pluginKeysRefreshAll', window.VALID_HOOKS) < 0)
window.VALID_HOOKS.push('pluginKeysRefreshAll');
window.addHook('portalAdded', window.plugin.keysOnMap.portalAdded);
window.addHook('pluginKeysUpdateKey', window.plugin.keysOnMap.keyUpdate);
window.addHook('pluginKeysRefreshAll', window.plugin.keysOnMap.refreshAllKeys);
}
// PLUGIN END //////////////////////////////////////////////////////////