new plugin - to show less portals when zoomed out
modified show-more-portals so it works with other zoom-modification plugins
This commit is contained in:
parent
a8516d92ff
commit
883f0842fc
61
plugins/show-less-portals-zoomed-out.user.js
Normal file
61
plugins/show-less-portals-zoomed-out.user.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-show-less-portals@jonatkins
|
||||||
|
// @name IITC plugin: Show less portals when zoomed out
|
||||||
|
// @category Tweaks
|
||||||
|
// @version 0.1.3.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @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.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
@@PLUGINSTART@@
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.showLessPortals = function() {};
|
||||||
|
|
||||||
|
window.plugin.showLessPortals.setup = function() {
|
||||||
|
|
||||||
|
// save the original function - so we can chain to it for levels we don't modify
|
||||||
|
var origGetPortalDataZoom = window.getPortalDataZoom;
|
||||||
|
|
||||||
|
// replace the window.getPortalDataZoom function - modify behaviour when zoomed close
|
||||||
|
|
||||||
|
window.getPortalDataZoom = function() {
|
||||||
|
var mapZoom = map.getZoom();
|
||||||
|
|
||||||
|
// this plugin only cares about close in zoom levels (zoom 13 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 >= 13) {
|
||||||
|
return origGetPortalDataZoom();
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure we're dealing with an integer here
|
||||||
|
// (mobile: a float somehow gets through in some cases!)
|
||||||
|
var z = parseInt(mapZoom);
|
||||||
|
|
||||||
|
// reduce the portal zoom level by one
|
||||||
|
z -= 1;
|
||||||
|
|
||||||
|
// ensure we're not too far out
|
||||||
|
if (z < 0) z=0;
|
||||||
|
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var setup = window.plugin.showLessPortals.setup;
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@@PLUGINEND@@
|
@ -6,7 +6,7 @@
|
|||||||
// @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. Good for small screens. Likely to increase request failed errors on larger screens.
|
// @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)
|
||||||
// @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*
|
||||||
@ -24,18 +24,26 @@ window.plugin.showMorePortals = function() {};
|
|||||||
|
|
||||||
window.plugin.showMorePortals.setup = function() {
|
window.plugin.showMorePortals.setup = function() {
|
||||||
|
|
||||||
// replace the window.getPortalDataZoom function
|
// save the original function - so we can chain to it for levels we don't modify
|
||||||
|
var origGetPortalDataZoom = window.getPortalDataZoom;
|
||||||
|
|
||||||
|
// replace the window.getPortalDataZoom function - modify behaviour when zoomed close
|
||||||
|
|
||||||
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
|
||||||
|
// code when this isn't the case. (this way, multiple zoom-modifying plugins can exist at once - in theory)
|
||||||
|
if (mapZoom < 13) {
|
||||||
|
return origGetPortalDataZoom();
|
||||||
|
}
|
||||||
|
|
||||||
// make sure we're dealing with an integer here
|
// make sure we're dealing with an integer here
|
||||||
// (mobile: a float somehow gets through in some cases!)
|
// (mobile: a float somehow gets through in some cases!)
|
||||||
var z = parseInt(mapZoom);
|
var z = parseInt(mapZoom);
|
||||||
|
|
||||||
// boost data zoom level by one when reasonably close (past the zoom<=12 point of the smaller
|
// boost data zoom level by one
|
||||||
// getThinnedEntitiesV4 tiles, to avoid excessive requests further out)
|
z += 1;
|
||||||
if (mapZoom >= 13) z += 1;
|
|
||||||
|
|
||||||
// not recommended on anything other than the very smallest of screens
|
// not recommended on anything other than the very smallest of screens
|
||||||
// // show unclaimed portals at an additional zoom level further than by default
|
// // show unclaimed portals at an additional zoom level further than by default
|
||||||
@ -53,9 +61,6 @@ window.plugin.showMorePortals.setup = function() {
|
|||||||
z = z-1;
|
z = z-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sanity check - should never happen
|
|
||||||
if (z < 0) z=0;
|
|
||||||
|
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user