Last active
June 4, 2024 03:54
-
-
Save McBen/30761c55a8e409969c1eaab62c136537 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @author mcben | |
// @name IITC plugin: OpenStreetMap Transportation | |
// @category Map Tiles | |
// @version 1.0.1 | |
// @description Add the OpenStreetMap transporation map tiles | |
// @id basemap-opvn | |
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion | |
// @match https://intel.ingress.com/* | |
// @match https://intel-x.ingress.com/* | |
// @grant none | |
// ==/UserScript== | |
function wrapper(plugin_info) { | |
// ensure plugin framework is there, even if iitc is not yet loaded | |
if(typeof window.plugin !== 'function') window.plugin = function() {}; | |
//PLUGIN AUTHORS: writing a plugin outside of the IITC build environment? if so, delete these lines!! | |
//(leaving them in place might break the 'About IITC' page or break update checks) | |
plugin_info.buildName = 'local'; | |
plugin_info.dateTimeVersion = '2024-04-04-045100'; | |
plugin_info.pluginId = 'basemap-opvn'; | |
//END PLUGIN AUTHORS NOTE | |
/* exported setup, changelog --eslint */ | |
/* global L, layerChooser */ | |
// use own namespace for plugin | |
var mapOpnvMap = {}; | |
window.plugin.mapOpnvMap = mapOpnvMap; | |
var changelog = [ | |
]; | |
// https://www.xn--pnvkarte-m4a.de | |
// Common options | |
var osmOpt = { | |
attribution: 'Karte memomaps.de CC-BY-SA, © Openstreetmap ODbL', | |
maxNativeZoom: 18, | |
maxZoom: 21, | |
}; | |
mapOpnvMap.LAYERS = [ | |
{ | |
name: 'Transportation-Map', | |
url: 'https://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png', | |
options: Object.assign({}, osmOpt), | |
} | |
]; | |
function setup() { | |
for (var entry of mapOpnvMap.LAYERS) { | |
var layer = new L.TileLayer(entry.url, entry.options); | |
layerChooser.addBaseLayer(layer, entry.name); | |
} | |
} | |
setup.info = plugin_info; //add the script info data to the function as a property | |
if (typeof changelog !== 'undefined') setup.info.changelog = changelog; | |
if(!window.bootPlugins) window.bootPlugins = []; | |
window.bootPlugins.push(setup); | |
// if IITC has already booted, immediately run the 'setup' function | |
if(window.iitcLoaded && typeof setup === 'function') setup(); | |
} // wrapper end | |
// inject code into site context | |
var script = document.createElement('script'); | |
var info = {}; | |
if (typeof GM_info !== 'undefined' && GM_info && GM_info.script) info.script = { version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description }; | |
script.appendChild(document.createTextNode('('+ wrapper +')('+JSON.stringify(info)+');')); | |
(document.body || document.head || document.documentElement).appendChild(script); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I... must apologize. I simply forgot to turn it on. The original version works, so does the new one. This is embarassing.