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:
parent
34410bd047
commit
4883eb5a4e
@ -2,11 +2,11 @@
|
|||||||
// @id iitc-plugin-show-less-portals@jonatkins
|
// @id iitc-plugin-show-less-portals@jonatkins
|
||||||
// @name IITC plugin: Show less portals when zoomed out
|
// @name IITC plugin: Show less portals when zoomed out
|
||||||
// @category Tweaks
|
// @category Tweaks
|
||||||
// @version 0.1.3.@@DATETIMEVERSION@@
|
// @version 0.1.4.@@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@@
|
||||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Decrease the portal detail level used when zoomed out. This can speed up map loading, decrease the amount of data used, and result in faster display. Only applies when zoomed out to show no closer than L3 portals. May stop display of the smaller links/fields.
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Decrease the portal detail level used when zoomed out. This can speed up map loading, decrease the amount of data used, and solve excessive request issues. Only applies when zoomed out to show no closer than L3 portals. May stop display of the smaller links/fields.
|
||||||
// @include https://www.ingress.com/intel*
|
// @include https://www.ingress.com/intel*
|
||||||
// @include http://www.ingress.com/intel*
|
// @include http://www.ingress.com/intel*
|
||||||
// @match https://www.ingress.com/intel*
|
// @match https://www.ingress.com/intel*
|
||||||
@ -32,23 +32,21 @@ window.plugin.showLessPortals.setup = function() {
|
|||||||
window.getPortalDataZoom = function() {
|
window.getPortalDataZoom = function() {
|
||||||
var mapZoom = map.getZoom();
|
var mapZoom = map.getZoom();
|
||||||
|
|
||||||
// this plugin only cares about close in zoom levels (zoom 13 and higher) - run the original
|
// the latest intel site update, as of 2013-10-16, requests a silly number of map tiles at the larger zoom levels
|
||||||
// code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
|
// IITC matches the behaviour by default, but it makes sense to reduce the detail level sooner
|
||||||
if (mapZoom >= 13) {
|
|
||||||
return origGetPortalDataZoom();
|
// at the largest scale zooms - move back two levels
|
||||||
|
if (mapZoom <= 7) {
|
||||||
|
return Math.max(mapZoom-2,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure we're dealing with an integer here
|
// intermediate zoom levels - move back one
|
||||||
// (mobile: a float somehow gets through in some cases!)
|
if (mapZoom <= 11) {
|
||||||
var z = parseInt(mapZoom);
|
return Math.max(mapZoom-1,0);
|
||||||
|
}
|
||||||
|
|
||||||
// reduce the portal zoom level by one
|
// otherwise revert to default behaviour
|
||||||
z -= 1;
|
return origGetPortalDataZoom();
|
||||||
|
|
||||||
// ensure we're not too far out
|
|
||||||
if (z < 0) z=0;
|
|
||||||
|
|
||||||
return z;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
// @id iitc-plugin-show-more-portals@jonatkins
|
// @id iitc-plugin-show-more-portals@jonatkins
|
||||||
// @name IITC plugin: Show more portals
|
// @name IITC plugin: Show more portals
|
||||||
// @category Tweaks
|
// @category Tweaks
|
||||||
// @version 0.1.4.@@DATETIMEVERSION@@
|
// @version 0.1.5.@@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@@
|
||||||
// @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 https://www.ingress.com/intel*
|
||||||
// @include http://www.ingress.com/intel*
|
// @include http://www.ingress.com/intel*
|
||||||
// @match https://www.ingress.com/intel*
|
// @match https://www.ingress.com/intel*
|
||||||
@ -32,36 +32,22 @@ window.plugin.showMorePortals.setup = function() {
|
|||||||
window.getPortalDataZoom = function() {
|
window.getPortalDataZoom = function() {
|
||||||
var mapZoom = map.getZoom();
|
var mapZoom = map.getZoom();
|
||||||
|
|
||||||
// this plugin only cares about close in zoom levels (zoom 12 and higher) - run the original
|
// as of 2013-10-16...
|
||||||
// code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
|
|
||||||
if (mapZoom < 12) {
|
// the stock site uses the same tile size for both L1+ portals and all portals
|
||||||
return origGetPortalDataZoom();
|
// 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
|
// and, the same scale for L2+ and L3+ portals. again, forcing the level down isn't unfriendly to the servers
|
||||||
// (mobile: a float somehow gets through in some cases!)
|
// (ditto on the cacheing)
|
||||||
var z = parseInt(mapZoom);
|
if (mapZoom >= 12) {
|
||||||
|
return 13;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return z;
|
return origGetPortalDataZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user