Fix color resetting in plugins

Remove defaulting in highlighters, which isn't needed, and was setting
the wrong thing anyway.  Also a little new hightlighter
This commit is contained in:
vita10gy 2013-09-12 20:20:16 -05:00
parent e9d173402b
commit 7eaf196dee
5 changed files with 37 additions and 26 deletions

View File

@ -29,10 +29,7 @@ window.plugin.portalHighligherPortalsCanMakeLevel.highlight = function(data,high
if( potential_level > current_level && potential_level === highlight_level) {
color = 'red';
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
}
}
//determines the level of poral a user can make all on their own

View File

@ -2,7 +2,7 @@
// @id iitc-plugin-highlight-portals-missing-resonators@vita10gy
// @name IITC plugin: highlight portals missing resonators
// @category Highlighter
// @version 0.1.0.@@DATETIMEVERSION@@
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -46,11 +46,7 @@ window.plugin.portalsMissingResonators.highlight = function(data) {
params["dashArray"] = dash;
}
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
// @name IITC plugin: highlight my portals
// @category Highlighter
// @version 0.1.0.@@DATETIMEVERSION@@
// @version 0.1.1.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @downloadURL @@DOWNLOADURL@@
@ -57,10 +57,7 @@ window.plugin.portalHighligherMyPortals.highlight = function(data) {
if(color !== '') {
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
} else {
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
fillOpacity: 0.5});
}
}
}
}

View File

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

View File

@ -1,12 +1,12 @@
// ==UserScript==
// @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
// @version 0.1.0.@@DATETIMEVERSION@@
// @version 0.2.0.@@DATETIMEVERSION@@
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @updateURL @@UPDATEURL@@
// @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 http://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});
} 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() {
window.addPortalHighlighter('Upgradable', window.plugin.portalHighligherPortalsUpgrade.highlight);
window.addPortalHighlighter('Upgradable to Elite', window.plugin.portalHighligherPortalsUpgrade.highlight_elite);
}
// PLUGIN END //////////////////////////////////////////////////////////