Merge pull request #553 from vita10gy/highlighter_fix

Fix color resetting in plugins
This commit is contained in:
Jon Atkins 2013-09-12 20:00:08 -07:00
commit 7b12e0bcc2
5 changed files with 37 additions and 26 deletions

View File

@ -29,9 +29,6 @@ window.plugin.portalHighligherPortalsCanMakeLevel.highlight = function(data,high
if( potential_level > current_level && potential_level === highlight_level) { if( potential_level > current_level && potential_level === highlight_level) {
color = 'red'; color = 'red';
data.portal.setStyle({fillColor: color, fillOpacity: opacity}); data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
} }
} }

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-highlight-portals-missing-resonators@vita10gy // @id iitc-plugin-highlight-portals-missing-resonators@vita10gy
// @name IITC plugin: highlight portals missing resonators // @name IITC plugin: highlight portals missing resonators
// @category Highlighter // @category Highlighter
// @version 0.1.0.@@DATETIMEVERSION@@ // @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -46,10 +46,6 @@ window.plugin.portalsMissingResonators.highlight = function(data) {
params["dashArray"] = dash; params["dashArray"] = dash;
} }
data.portal.setStyle(params); data.portal.setStyle(params);
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5,
dashArray: null});
} }
} }
} }

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-highlight-portals-my-portals@vita10gy // @id iitc-plugin-highlight-portals-my-portals@vita10gy
// @name IITC plugin: highlight my portals // @name IITC plugin: highlight my portals
// @category Highlighter // @category Highlighter
// @version 0.1.0.@@DATETIMEVERSION@@ // @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
@ -57,9 +57,6 @@ window.plugin.portalHighligherMyPortals.highlight = function(data) {
if(color !== '') { if(color !== '') {
data.portal.setStyle({fillColor: color, fillOpacity: opacity}); data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
} }
} }
} }

View File

@ -38,9 +38,6 @@ window.plugin.portalHighligherPortalsMyLevel.colorLevel = function(below,data) {
if((below && portal_level <= player_level) || if((below && portal_level <= player_level) ||
(!below && portal_level >= player_level)) { (!below && portal_level >= player_level)) {
data.portal.setStyle({fillColor: 'red', fillOpacity: opacity}); data.portal.setStyle({fillColor: 'red', fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
} }
} }

View File

@ -1,12 +1,12 @@
// ==UserScript== // ==UserScript==
// @id iitc-plugin-highlight-portals-upgrade@vita10gy // @id iitc-plugin-highlight-portals-upgrade@vita10gy
// @name IITC plugin: highlight portals you can upgrade // @name IITC plugin: highlight portals you can upgrade at all and to eilte level (6,7 or 8)
// @category Highlighter // @category Highlighter
// @version 0.1.0.@@DATETIMEVERSION@@ // @version 0.2.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@ // @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@ // @downloadURL @@DOWNLOADURL@@
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Uses the fill color of the portals to highlight portals you can upgrade. Yellow means you can upgrade it at all. Orange means you can change the level. Red means you can make it your level or higher. // @description [@@BUILDNAME@@-@@BUILDDATE@@] Upgradable - Yellow: you can upgrade it at all. Orange: you can change the level. Red: you can make it your level or higher. To Elite: Yellow - To Level 6. Orange - To Level 7. Red - To Level 8.
// @include https://www.ingress.com/intel* // @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel* // @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel* // @match https://www.ingress.com/intel*
@ -41,14 +41,38 @@ window.plugin.portalHighligherPortalsUpgrade.highlight = function(data) {
} }
data.portal.setStyle({fillColor: color, fillOpacity: opacity}); data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else { }
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)], }
fillOpacity: 0.5});
window.plugin.portalHighligherPortalsUpgrade.highlight_elite = function(data) {
var d = data.portal.options.details;
var current_level = getPortalLevel(d);
var potential_level = window.potentialPortalLevel(d);
var opacity = .8;
var color = '';
potential_level = Math.floor(potential_level);
current_level = Math.floor(current_level);
if( potential_level > current_level && potential_level >= 6) {
switch(potential_level) {
case 6:
color = 'yellow';
break;
case 7:
color = 'orange';
break;
case 8:
color = 'red';
opacity = .9;
break;
}
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} }
} }
var setup = function() { var setup = function() {
window.addPortalHighlighter('Upgradable', window.plugin.portalHighligherPortalsUpgrade.highlight); window.addPortalHighlighter('Upgradable', window.plugin.portalHighligherPortalsUpgrade.highlight);
window.addPortalHighlighter('Upgradable to Elite', window.plugin.portalHighligherPortalsUpgrade.highlight_elite);
} }
// PLUGIN END ////////////////////////////////////////////////////////// // PLUGIN END //////////////////////////////////////////////////////////