diff --git a/plugins/ap-list.user.js b/plugins/ap-list.user.js new file mode 100644 index 00000000..f2af503a --- /dev/null +++ b/plugins/ap-list.user.js @@ -0,0 +1,399 @@ +// ==UserScript== +// @id iitc-plugin-ap-list@xelio +// @name iitc: AP List +// @version 0.3 +// @namespace https://github.com/breunigs/ingress-intel-total-conversion +// @updateURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/ap-list.user.js +// @downloadURL https://raw.github.com/breunigs/ingress-intel-total-conversion/gh-pages/plugins/ap-list.user.js +// @description List top 10 portals by AP of either faction. Hover over AP will show breakdown of AP. Click on portal name will select the portal. Double click on portal name will zoom to and select portal. Portals before zooming in will be cached and count in top portal. They will be cleared if you click the "↻ R" or move out of the area. +// @include https://www.ingress.com/intel* +// @match https://www.ingress.com/intel* +// ==/UserScript== + +function wrapper() { +// ensure plugin framework is there, even if iitc is not yet loaded +if(typeof window.plugin !== 'function') window.plugin = function() {}; + + +// PLUGIN START //////////////////////////////////////////////////////// + +// use own namespace for plugin +window.plugin.apList = function() { +}; + +window.plugin.apList.cachedPortals = {}; +window.plugin.apList.SIDE_FRIENDLY = 0; +window.plugin.apList.SIDE_ENEMY = 1; +window.plugin.apList.displaySide = window.plugin.apList.SIDE_ENEMY; +window.plugin.apList.sides = new Array(2); +window.plugin.apList.sortedPortals = new Array(2); +window.plugin.apList.playerApGainFunc = new Array(2); + +window.plugin.apList.topMaxCount = 10; +window.plugin.apList.sideLabelClass = {}; + +window.plugin.apList.useCachedPortals = false; +window.plugin.apList.cacheBounds; +window.plugin.apList.cacheActiveZoomLevel; + + +window.plugin.apList.handleUpdate = function() { + if(!requests.isLastRequest('getThinnedEntitiesV2')) return; + plugin.apList.updateSortedPortals(); + plugin.apList.updatePortalTable(plugin.apList.displaySide); +} + +// Generate html table from top portals +window.plugin.apList.updatePortalTable = function(side) { + var content = '
' + + (portal ? plugin.apList.getPortalApText(portal) : ' ') + + ' | ' + + '