Skip to content

Instantly share code, notes, and snippets.

@johnd0e
Last active August 25, 2019 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnd0e/588f58172ee45ca07f89e5c3a7503cb2 to your computer and use it in GitHub Desktop.
Save johnd0e/588f58172ee45ca07f89e5c3a7503cb2 to your computer and use it in GitHub Desktop.
// ==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