54 lines
1.9 KiB
JavaScript
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://*.ingress.com/intel*
|
|
// @include http://*.ingress.com/intel*
|
|
// @match https://*.ingress.com/intel*
|
|
// @match http://*.ingress.com/intel*
|
|
// @include https://*.ingress.com/mission/*
|
|
// @include http://*.ingress.com/mission/*
|
|
// @match https://*.ingress.com/mission/*
|
|
// @match http://*.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 !== undefined && 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@@
|