fixed incorrect rounded portal levels

adjusted viewport to be closer
This commit is contained in:
YenkyK 2013-03-25 15:56:55 +01:00
parent 29ad7ea301
commit 187a90ce40

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @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
// @version 0.0.2.20130325.135610 // @version 0.0.3.20130325.155511
// @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@@
@ -13,6 +13,8 @@
// ==/UserScript== // ==/UserScript==
/* whatsnew /* 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 * 0.0.1 : initial release, show count of portals
* todo : * todo :
*/ */
@ -25,11 +27,12 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
// use own namespace for plugin // use own namespace for plugin
window.plugin.portalcounts = function() {}; window.plugin.portalcounts = function() {};
window.VIEWPORT_PAD_RATIO = 0.1;
//count portals for each level avalaible on the map //count portals for each level avalaible on the map
window.plugin.portalcounts.getPortals = function(){ window.plugin.portalcounts.getPortals = function(){
//console.log('** getPortals'); //console.log('** getPortals');
// just count portals in viewport, default: 0.3
var retval=false; var retval=false;
window.plugin.portalcounts.enlP = 0; window.plugin.portalcounts.enlP = 0;
window.plugin.portalcounts.resP = 0; window.plugin.portalcounts.resP = 0;
@ -59,7 +62,7 @@ window.plugin.portalcounts.getPortals = function(){
retval=true; retval=true;
var d = portal.options.details; var d = portal.options.details;
var team = portal.options.team; var team = portal.options.team;
var level = getPortalLevel(d).toFixed(); var level = Math.floor(getPortalLevel(d));
switch (team){ switch (team){
case 1 : case 1 :
window.plugin.portalcounts.resP++; window.plugin.portalcounts.resP++;