portals list plugin only includes portals in the view - to match portals-count

This commit is contained in:
Jon Atkins 2013-05-22 14:31:08 +01:00
parent 8a6ef065c0
commit 5e4e8fee6b

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @id iitc-plugin-portals-list@teo96 // @id iitc-plugin-portals-list@teo96
// @name IITC plugin: show list of portals // @name IITC plugin: show list of portals
// @version 0.0.12.@@DATETIMEVERSION@@ // @version 0.0.13.@@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@@
@ -54,9 +54,13 @@ window.plugin.portalslist.getPortals = function() {
//console.log('** getPortals'); //console.log('** getPortals');
var retval=false; var retval=false;
var displayBounds = map.getBounds();
window.plugin.portalslist.listPortals = []; window.plugin.portalslist.listPortals = [];
//get portals informations from IITC //get portals informations from IITC
$.each(window.portals, function(i, portal) { $.each(window.portals, function(i, portal) {
// eliminate offscreen portals (selected, and in padding)
if(!displayBounds.contains(portal.getLatLng())) return true;
retval=true; retval=true;
var d = portal.options.details; var d = portal.options.details;