plugins: show-more/less portals

updated to take account of the new map data tile sizes
- show-more-portals no longer causes unfriendly request tile sizes. unclaimed are now visible one level further out, but l1+ is no longer available one level further in (i.e. it jumps directly from l2+ to all portals)
- slow-less-portals-when-zoomed-out - major reductions in portal visibility levels - works around the daft tile size/zoom level combinations used in the current stock intel site
This commit is contained in:
Jon Atkins
2013-10-16 07:11:50 +01:00
parent 34410bd047
commit 4883eb5a4e
2 changed files with 28 additions and 44 deletions

View File

@ -2,11 +2,11 @@
// @id iitc-plugin-show-more-portals@jonatkins
// @name IITC plugin: Show more portals
// @category Tweaks
// @version 0.1.4.@@DATETIMEVERSION@@
// @version 0.1.5.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Boost the detail level of portals shown on the map by one zoom level when zoomed in close (L2+ portals or closer)
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Boost the detail level of portals shown so that unclaimed portals are visible when normally L1+ portals would be shown, and L2+ are visible when normally L3+ are shown
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@ -32,36 +32,22 @@ window.plugin.showMorePortals.setup = function() {
window.getPortalDataZoom = function() {
var mapZoom = map.getZoom();
// this plugin only cares about close in zoom levels (zoom 12 and higher) - run the original
// code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
if (mapZoom < 12) {
return origGetPortalDataZoom();
// as of 2013-10-16...
// the stock site uses the same tile size for both L1+ portals and all portals
// therefore, changing the L1+ zoom levels into all portals zoom level is not unfriendly to the servers
// (in some ways it's nicer, as IITC caches better)
if (mapZoom >= 15) {
return 17;
}
// make sure we're dealing with an integer here
// (mobile: a float somehow gets through in some cases!)
var z = parseInt(mapZoom);
// boost data zoom level by one
z += 1;
// not recommended on anything other than the very smallest of screens
// // show unclaimed portals at an additional zoom level further than by default
// if (mapZoom >= 15) z += 1;
// limiting the mazimum zoom level for data retrieval reduces the number of requests at high zoom levels
// (as all portal data is retrieved at z=17, why retrieve multiple z=18 tiles when fewer z=17 would do?)
// very effective along with the new cache code
if (z > 17) z=17;
// if the data zoom is above the map zoom we can step back if the detail level is the same
// with the new cache code this works rather well
while (z > mapZoom && getMinPortalLevelForZoom(z) == getMinPortalLevelForZoom(z-1)) {
z = z-1;
// and, the same scale for L2+ and L3+ portals. again, forcing the level down isn't unfriendly to the servers
// (ditto on the cacheing)
if (mapZoom >= 12) {
return 13;
}
return z;
return origGetPortalDataZoom();
}