From 17d25f2d6bbb9abe18cbb82731dc4cffe803f696 Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Thu, 25 Jul 2013 10:52:52 +0200 Subject: [PATCH 1/2] Add simplified, gray Version of Google Maps as Plugin --- plugins/basemap-gmaps-gray.js | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 plugins/basemap-gmaps-gray.js diff --git a/plugins/basemap-gmaps-gray.js b/plugins/basemap-gmaps-gray.js new file mode 100644 index 00000000..1dfa6fd5 --- /dev/null +++ b/plugins/basemap-gmaps-gray.js @@ -0,0 +1,49 @@ +// ==UserScript== +// @id iitc-plugin-basemap-gmaps-gray@jacob1123 +// @name IITC plugin: Gray Google Roads +// @category Map Tiles +// @version 0.1.0.20130724.0 +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @description Add a simplified gray Version of Google 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.grayGMaps = function() {}; + window.plugin.grayGMaps.addLayer = function() { + var grayGMaps = new L.Google('ROADMAPS',{maxZoom:20}); + grayGMaps._styles = [{featureType:"landscape.natural",stylers:[{visibility:"simplified"},{saturation:-100},{lightness:-80},{gamma:2.44}]},{featureType:"road",stylers:[{visibility:"simplified"},{color:"#bebebe"},{weight:.6}]},{featureType:"poi",stylers:[{saturation:-100},{visibility:"on"},{gamma:.14}]},{featureType:"water",stylers:[{color:"#32324f"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi"},{featureType:"landscape.man_made",stylers:[{saturation:-100},{gamma:.13}]},{featureType:"water",elementType:"labels",stylers:[{visibility:"off"}]}] + + layerChooser.addBaseLayer(grayGMaps, "Google Gray"); + }; + + var setup = window.plugin.grayGMaps.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); + From bcf1c44f02be70ee7dd52678920a7cd18874058f Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Thu, 25 Jul 2013 16:37:42 +0200 Subject: [PATCH 2/2] Use @@ Macros --- plugins/basemap-gmaps-gray.js | 47 ++++++++++++----------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/plugins/basemap-gmaps-gray.js b/plugins/basemap-gmaps-gray.js index 1dfa6fd5..361f2137 100644 --- a/plugins/basemap-gmaps-gray.js +++ b/plugins/basemap-gmaps-gray.js @@ -2,9 +2,11 @@ // @id iitc-plugin-basemap-gmaps-gray@jacob1123 // @name IITC plugin: Gray Google Roads // @category Map Tiles -// @version 0.1.0.20130724.0 +// @version 0.1.0.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion -// @description Add a simplified gray Version of Google map tiles as an optional layer +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Add a simplified gray Version of Google map tiles as an optional layer // @include https://www.ingress.com/intel* // @include http://www.ingress.com/intel* // @match https://www.ingress.com/intel* @@ -12,38 +14,21 @@ // @grant none // ==/UserScript== +@@PLUGINSTART@@ -function wrapper() { - // ensure plugin framework is there, even if iitc is not yet loaded - if(typeof window.plugin !== 'function') window.plugin = function() {}; +// PLUGIN START //////////////////////////////////////////////////////// - // PLUGIN START //////////////////////////////////////////////////////// - - // use own namespace for plugin - window.plugin.grayGMaps = function() {}; - window.plugin.grayGMaps.addLayer = function() { - var grayGMaps = new L.Google('ROADMAPS',{maxZoom:20}); - grayGMaps._styles = [{featureType:"landscape.natural",stylers:[{visibility:"simplified"},{saturation:-100},{lightness:-80},{gamma:2.44}]},{featureType:"road",stylers:[{visibility:"simplified"},{color:"#bebebe"},{weight:.6}]},{featureType:"poi",stylers:[{saturation:-100},{visibility:"on"},{gamma:.14}]},{featureType:"water",stylers:[{color:"#32324f"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi"},{featureType:"landscape.man_made",stylers:[{saturation:-100},{gamma:.13}]},{featureType:"water",elementType:"labels",stylers:[{visibility:"off"}]}] +// use own namespace for plugin +window.plugin.grayGMaps = function() {}; +window.plugin.grayGMaps.addLayer = function() { + var grayGMaps = new L.Google('ROADMAPS',{maxZoom:20}); + grayGMaps._styles = [{featureType:"landscape.natural",stylers:[{visibility:"simplified"},{saturation:-100},{lightness:-80},{gamma:2.44}]},{featureType:"road",stylers:[{visibility:"simplified"},{color:"#bebebe"},{weight:.6}]},{featureType:"poi",stylers:[{saturation:-100},{visibility:"on"},{gamma:.14}]},{featureType:"water",stylers:[{color:"#32324f"}]},{featureType:"transit",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi"},{featureType:"landscape.man_made",stylers:[{saturation:-100},{gamma:.13}]},{featureType:"water",elementType:"labels",stylers:[{visibility:"off"}]}] - layerChooser.addBaseLayer(grayGMaps, "Google Gray"); - }; + layerChooser.addBaseLayer(grayGMaps, "Google Gray"); +}; - var setup = window.plugin.grayGMaps.addLayer; +var setup = window.plugin.grayGMaps.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); +// PLUGIN END ////////////////////////////////////////////////////////// +@@PLUGINEND@@ \ No newline at end of file