Last active
August 25, 2019 11:20
-
-
Save johnd0e/588f58172ee45ca07f89e5c3a7503cb2 to your computer and use it in GitHub Desktop.
Test of https://github.com/IITC-CE/Leaflet.Geodesic/pull/4; install: https://cdn.staticaly.com/gist/johnd0e/588f58172ee45ca07f89e5c3a7503cb2/raw/simplergeodesic.user.js?env=dev
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== | |
// @id simplergeodesic | |
// @name IITC plugin: Simpler geodesic | |
// @category Test | |
// @version 0.2.0 | |
// @description test | |
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion | |
// @include https://intel.ingress.com/* | |
// @grant none | |
// ==/UserScript== | |
if (typeof window.plugin !== 'function') window.plugin = function() {}; | |
(function wrapper (plugin_info) { | |
function fix (Class) { | |
Class.include({ | |
_projectLatlngs: function (latlngs, result, projectedBounds) { | |
latlngs = this._defaultShape(); | |
var geo_latlngs = this._geodesicConvertLines(latlngs); | |
L.Polyline.prototype._projectLatlngs.call(this, geo_latlngs, result, projectedBounds); | |
} | |
}); | |
['_geodesicConvert','initialize','getLatLngs','_setLatLngs','_defaultShape','redraw'].forEach(function (method) { | |
delete Class.prototype[method]; | |
}); | |
} | |
function setup () { | |
fix(L.GeodesicPolyline); | |
fix(L.GeodesicPolygon); | |
L.GeodesicPolygon.include({ | |
getLatLngs: function () { return this._latlngs[0]; }, // compatibility workaround for iitc | |
}); | |
} | |
setup.priority = 'high'; | |
setup.info = plugin_info; //add the script info data to the function as a property | |
if (!window.bootPlugins) window.bootPlugins = []; | |
window.bootPlugins.push(setup); | |
if (window.iitcLoaded && typeof setup === 'function') setup(); | |
})({ script: typeof GM_info !== 'undefined' && GM_info.script && { | |
version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description | |
}})// wrapper end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment