base map plugins
- openstreetmap - not suitable for high load use, but an optional layer in an optional plugin should be ok for them - thunderforest opencyclemap, etc - free for use, no api key or notification required
This commit is contained in:
parent
d31d010c87
commit
f428e3037c
58
plugins/basemap-opencyclemap.user.js
Normal file
58
plugins/basemap-opencyclemap.user.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-basemap-opencyclepam@jonatkins
|
||||||
|
// @name IITC plugin: OpenCycleMap.org map tiles
|
||||||
|
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Add the OpenCycleMap.org map tiles as an optional layer
|
||||||
|
// @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==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.mapTileOpenCycleMap = function() {};
|
||||||
|
|
||||||
|
window.plugin.mapTileOpenCycleMap.addLayer = function() {
|
||||||
|
|
||||||
|
//the Thunderforest (OpenCycleMap) tiles are free to use - http://www.thunderforest.com/terms/
|
||||||
|
|
||||||
|
osmAttribution = 'Map data © OpenStreetMap';
|
||||||
|
var ocmOpt = {attribution: 'Tiles © OpenCycleMap, '+osmAttribution, maxZoom: 18};
|
||||||
|
var ocmCycle = new L.TileLayer('http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png', ocmOpt);
|
||||||
|
var ocmTransport = new L.TileLayer('http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png', ocmOpt);
|
||||||
|
var ocmLandscape = new L.TileLayer('http://{s}.tile3.opencyclemap.org/landscape/{z}/{x}/{y}.png', ocmOpt);
|
||||||
|
|
||||||
|
layerChooser.addBaseLayer(ocmCycle, "Thunderforest OpenCycleMap");
|
||||||
|
layerChooser.addBaseLayer(ocmTransport, "Thunderforest Transport");
|
||||||
|
layerChooser.addBaseLayer(ocmLandscape, "Thunderforest Landscape");
|
||||||
|
};
|
||||||
|
|
||||||
|
var setup = window.plugin.mapTileOpenCycleMap.addLayer;
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
55
plugins/basemap-openstreetmap.user.js
Normal file
55
plugins/basemap-openstreetmap.user.js
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-basemap-openstreetpam@jonatkins
|
||||||
|
// @name IITC plugin: OpenStreetMap.org map tiles
|
||||||
|
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||||
|
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||||
|
// @updateURL @@UPDATEURL@@
|
||||||
|
// @downloadURL @@DOWNLOADURL@@
|
||||||
|
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Add the native OpenStreetMap.org map tiles as an optional layer
|
||||||
|
// @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==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.mapTileOpenStreetMap = function() {};
|
||||||
|
|
||||||
|
window.plugin.mapTileOpenStreetMap.addLayer = function() {
|
||||||
|
|
||||||
|
//OpenStreetMap tiles - we shouldn't use these by default - https://wiki.openstreetmap.org/wiki/Tile_usage_policy
|
||||||
|
// "Heavy use (e.g. distributing an app that uses tiles from openstreetmap.org) is forbidden without prior permission from the System Administrators"
|
||||||
|
|
||||||
|
osmAttribution = 'Map data © OpenStreetMap contributors';
|
||||||
|
var osmOpt = {attribution: osmAttribution, maxZoom: 18};
|
||||||
|
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmOpt);
|
||||||
|
|
||||||
|
layerChooser.addBaseLayer(osm, "OpenStreetMap");
|
||||||
|
};
|
||||||
|
|
||||||
|
var setup = window.plugin.mapTileOpenStreetMap.addLayer;
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
Loading…
x
Reference in New Issue
Block a user