From 187a90ce40f45af12360b03cc97d46d80ecf5e45 Mon Sep 17 00:00:00 2001 From: YenkyK Date: Mon, 25 Mar 2013 15:56:55 +0100 Subject: [PATCH] fixed incorrect rounded portal levels adjusted viewport to be closer --- plugins/portal-counts.user.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/portal-counts.user.js b/plugins/portal-counts.user.js index 3b105cae..8d59f214 100644 --- a/plugins/portal-counts.user.js +++ b/plugins/portal-counts.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @id iitc-plugin-portals-count@yenky // @name IITC plugin: Show total counts of portals -// @version 0.0.2.20130325.135610 +// @version 0.0.3.20130325.155511 // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ @@ -13,6 +13,8 @@ // ==/UserScript== /* whatsnew +* 0.0.3 : fixed incorrect rounded portal levels, adjusted viewport +* 0.0.2 : fixed counts to be reset after scrolling * 0.0.1 : initial release, show count of portals * todo : */ @@ -25,11 +27,12 @@ if(typeof window.plugin !== 'function') window.plugin = function() {}; // use own namespace for plugin window.plugin.portalcounts = function() {}; - + window.VIEWPORT_PAD_RATIO = 0.1; //count portals for each level avalaible on the map window.plugin.portalcounts.getPortals = function(){ //console.log('** getPortals'); + // just count portals in viewport, default: 0.3 var retval=false; window.plugin.portalcounts.enlP = 0; window.plugin.portalcounts.resP = 0; @@ -59,7 +62,7 @@ window.plugin.portalcounts.getPortals = function(){ retval=true; var d = portal.options.details; var team = portal.options.team; - var level = getPortalLevel(d).toFixed(); + var level = Math.floor(getPortalLevel(d)); switch (team){ case 1 : window.plugin.portalcounts.resP++;