// Enter this in browser console on the ingress intel map. Requires IITC.
let getAllPortals = () => Object.entries(window.portals).map(([uid, portal]) => {
return {
uid,
title: portal.options.data.title,
lat: portal._latlng.lat,
lng: portal._latlng.lng,
team: portal.options.data.team === "R" ? "Resistance" : portal.options.data.team === "E" ? "Enlightened" : "unclaimed",
level: portal.options.data.level
};
});
let isPortalInBounds = (lat1, lat2, lng1, lng2, portal) => {
return portal.lat >= lat1 && portal.lat <= lat2 && portal.lng >= lng1 && portal.lng <= lng2;
}
let getPortalsInBounds = (lat1, lat2, lng1, lng2) => {
return getAllPortals().filter(portal => isPortalInBounds(lat1, lat2, lng1, lng2, portal));
}