plugin: portal-counts fixed

also reformatted the table a little - moved totals into the columns below the L8 to L1 lists, then neutral after that
This commit is contained in:
Jon Atkins 2013-12-01 02:11:52 +00:00
parent 436eefd44a
commit 24e11b483a

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-portals-count@yenky // @id iitc-plugin-portals-count@yenky
// @name IITC plugin: Show total counts of portals // @name IITC plugin: Show total counts of portals
// @category Info // @category Info
// @version 0.0.8.@@DATETIMEVERSION@@ // @version 0.0.9.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -50,9 +50,8 @@ window.plugin.portalcounts.getPortals = function(){
$.each(window.portals, function(i, portal) { $.each(window.portals, function(i, portal) {
retval=true; retval=true;
var d = portal.options.details; var level = portal.options.level;
var team = portal.options.team; var team = portal.options.team;
var level = Math.floor(getPortalLevel(d));
// just count portals in viewport // just count portals in viewport
if(!displayBounds.contains(portal.getLatLng())) return true; if(!displayBounds.contains(portal.getLatLng())) return true;
switch (team){ switch (team){
@ -84,15 +83,16 @@ window.plugin.portalcounts.getPortals = function(){
counts += '<td class="enl">'+window.plugin.portalcounts.PortalsEnl[level]+'</td><td class="res">'+window.plugin.portalcounts.PortalsRes[level]+'</td>'; counts += '<td class="enl">'+window.plugin.portalcounts.PortalsEnl[level]+'</td><td class="res">'+window.plugin.portalcounts.PortalsRes[level]+'</td>';
counts += '</tr>'; counts += '</tr>';
} }
counts += '<tr><td colspan="3">&nbsp</td></tr>';
counts += '<tr><th>Total:</th><td class="enl">'+window.plugin.portalcounts.enlP+'</td><td class="res">'+window.plugin.portalcounts.resP+'</td></tr>';
counts += '<tr><td>Neutral:</td><td colspan="2">'; counts += '<tr><td>Neutral:</td><td colspan="2">';
if(minlvl > 0) if(minlvl > 0)
counts += 'zoom in to see unclaimed'; counts += 'zoom in to see unclaimed portals';
else else
counts += window.plugin.portalcounts.neuP; counts += window.plugin.portalcounts.neuP;
counts += ' Portal(s)</td></tr>'; counts += '</td></tr>';
counts += '<tr class="enl"><th colspan="2">Enlightened:</th><td>'+window.plugin.portalcounts.enlP+' Portal(s)</td></tr>';
counts += '<tr class="res"><th colspan="2">Resistance:</th><td>'+window.plugin.portalcounts.resP+' Portal(s)</td></tr>';
} else } else
counts += '<tr><td>No Portals in range!</td></tr>'; counts += '<tr><td>No Portals in range!</td></tr>';
counts += '</table>'; counts += '</table>';