From 199a9f15dd7dd7d59669b33ccb75460d1f118f9b Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Sat, 8 Nov 2014 14:36:00 +0000 Subject: [PATCH] plugin done-links: a companion to cross-links - highlights any links that match any drawn lines/polygons --- plugins/done-links.user.js | 194 +++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 plugins/done-links.user.js diff --git a/plugins/done-links.user.js b/plugins/done-links.user.js new file mode 100644 index 00000000..264c74fb --- /dev/null +++ b/plugins/done-links.user.js @@ -0,0 +1,194 @@ +// ==UserScript== +// @id iitc-plugin-done-links@jonatkins +// @name IITC plugin: done links +// @category Layer +// @version 0.0.1.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] A companion to the Cross Links plugin. Highlights any links that match existing draw-tools line/polygon edges +// @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== + +@@PLUGINSTART@@ + +// PLUGIN START //////////////////////////////////////////////////////// + + +window.plugin.doneLinks = function() {}; + +window.plugin.doneLinks.sameLink = function(a0, a1, b0, b1) { + if (a0.equals(b0) && a1.equals(b1)) return true; + if (a0.equals(b1) && a1.equals(b0)) return true; + return false; +} + + +window.plugin.doneLinks.testPolyLine = function (polyline, link,closed) { + + var a = link.getLatLngs(); + var b = polyline.getLatLngs(); + + for (var i=0;i