From 8c539078cb6473bad72c79b80ebbd5944baa3c9a Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Fri, 20 Sep 2013 08:03:46 +0100 Subject: [PATCH] new portal highlighter to mark inactive unclaimed portals (and also help track down portals that fail to decay) --- plugins/portal-highlighter-forgotten.user.js | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 plugins/portal-highlighter-forgotten.user.js diff --git a/plugins/portal-highlighter-forgotten.user.js b/plugins/portal-highlighter-forgotten.user.js new file mode 100644 index 00000000..72d8281b --- /dev/null +++ b/plugins/portal-highlighter-forgotten.user.js @@ -0,0 +1,49 @@ +// ==UserScript== +// @id iitc-plugin-highlight-forgotten@jonatkins +// @name IITC plugin: Inactive portals. Hightlight unclaimed portals with no recent activity +// @category Highlighter +// @version 0.1.0.@@DATETIMEVERSION@@ +// @namespace https://github.com/jonatkins/ingress-intel-total-conversion +// @updateURL @@UPDATEURL@@ +// @downloadURL @@DOWNLOADURL@@ +// @description [@@BUILDNAME@@-@@BUILDDATE@@] Highlight unclaimed portals with no recent activity. Shades of red from one week to one month, then tinted to purple for longer. (May also highlight captured portals that are stuck and fail to decay every 24 hours) +// @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 //////////////////////////////////////////////////////// + +// use own namespace for plugin +window.plugin.portalHighligherInactive = function() {}; + +window.plugin.portalHighligherInactive.highlight = function(data) { + + var daysUnmodified = (new Date().getTime() - data.portal.options.timestamp) / (24*60*60*1000); + + if (daysUnmodified >= 7) { + + var fill_opacity = Math.min(1,((daysUnmodified-7)/24)*.85 + .15); + + var blue = Math.max(0,Math.min(255,Math.round((daysUnmodified-31)/62*255))); + + var colour = 'rgb(255,0,'+blue+')'; + + var params = {fillColor: colour, fillOpacity: fill_opacity}; + + data.portal.setStyle(params); + } + +} + +var setup = function() { + window.addPortalHighlighter('Inactive Portals', window.plugin.portalHighligherInactive.highlight); +} + +// PLUGIN END ////////////////////////////////////////////////////////// + +@@PLUGINEND@@