ingress-intel-total-conversion/plugins/portal-highlighter-missing-resonators.user.js
fkloft eba7d388a0 Enable IITC on mission permalink
Hint: to change a lot of scripts, execute this:

    sed -r '/\/\/ @match\s+http:\/\/www.ingress.com\/intel/r /tmp/includefile' -i~ *.user.js

`/tmp/includefile` should contain these lines: (no trailing newline!)

    // @include        https://www.ingress.com/mission/*
    // @include        http://www.ingress.com/mission/*
    // @match          https://www.ingress.com/mission/*
    // @match          http://www.ingress.com/mission/*
2015-04-13 17:28:30 +02:00

54 lines
1.9 KiB
JavaScript

// ==UserScript==
// @id iitc-plugin-highlight-portals-missing-resonators@vita10gy
// @name IITC plugin: highlight portals missing resonators
// @category Highlighter
// @version 0.1.2.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Use the portal fill color to denote if the portal is missing resonators.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/mission/*
// @include http://www.ingress.com/mission/*
// @match https://www.ingress.com/mission/*
// @match http://www.ingress.com/mission/*
// @grant none
// ==/UserScript==
@@PLUGINSTART@@
// PLUGIN START ////////////////////////////////////////////////////////
// use own namespace for plugin
window.plugin.portalsMissingResonators = function() {};
window.plugin.portalsMissingResonators.highlight = function(data) {
if(data.portal.options.team != TEAM_NONE) {
var res_count = data.portal.options.data.resCount;
if(res_count < 8) {
var fill_opacity = ((8-res_count)/8)*.85 + .15;
var color = 'red';
var params = {fillColor: color, fillOpacity: fill_opacity};
// Hole per missing resonator
var dash = new Array((8 - res_count) + 1).join("1,4,") + "100,0"
params.dashArray = dash;
data.portal.setStyle(params);
}
}
}
var setup = function() {
window.addPortalHighlighter('Portals Missing Resonators', window.plugin.portalsMissingResonators.highlight);
}
// PLUGIN END //////////////////////////////////////////////////////////
@@PLUGINEND@@