ingress-intel-total-conversion/plugins/broken/portal-highlighter-mitigation.user.js

49 lines
1.6 KiB
JavaScript

// ==UserScript==
// @id iitc-plugin-highlight-mitigation@jonatkins
// @name IITC plugin: hightlight portals total mitigation
// @category Highlighter
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Use the portal fill color to denote mitigation. Shades of red to the maximum of 95, then tints towards purple for over 95.
// @include https://*.ingress.com/intel*
// @include http://*.ingress.com/intel*
// @match https://*.ingress.com/intel*
// @match http://*.ingress.com/intel*
// @grant none
// ==/UserScript==
@@PLUGINSTART@@
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.portalHighlighterMitigation = function() {};
window.plugin.portalHighlighterMitigation.highlight = function(data) {
var defense = window.getPortalMitigationDetails(data.portal.options.details);
if (defense.total > 0) {
var fill_opacity = (defense.total/95)*.85 + .15;
var blue = Math.max(0,Math.min(255,Math.round(defense.excess/80*255)));
var colour = 'rgb(255,0,'+blue+')';
var params = {fillColor: colour, fillOpacity: fill_opacity};
data.portal.setStyle(params);
}
}
var setup = function() {
window.addPortalHighlighter('Mitigation (defense)', window.plugin.portalHighlighterMitigation.highlight);
}
// PLUGIN END //////////////////////////////////////////////////////////
@@PLUGINEND@@