Merge branch 'master' into layerChooser
This commit is contained in:
commit
77420407c4
@ -173,16 +173,17 @@ window.handlePortalsRender = function(portals) {
|
|||||||
// Preserve selectedPortal because it will get lost on re-rendering
|
// Preserve selectedPortal because it will get lost on re-rendering
|
||||||
// the portal
|
// the portal
|
||||||
var oldSelectedPortal = selectedPortal;
|
var oldSelectedPortal = selectedPortal;
|
||||||
|
|
||||||
runHooks('portalDataLoaded', {portals : portals});
|
runHooks('portalDataLoaded', {portals : portals});
|
||||||
$.each(portals, function(ind, portal) {
|
$.each(portals, function(ind, portal) {
|
||||||
//~ if(selectedPortal === portal[0]) portalUpdateAvailable = true;
|
//~ if(selectedPortal === portal[0]) portalUpdateAvailable = true;
|
||||||
if(urlPortal && portal[0] === urlPortal) portalInUrlAvailable = true;
|
|
||||||
if(urlPortalLL && urlPortalLL[0] === portal[2].locationE6.latE6/1E6 && urlPortalLL[1] === portal[2].locationE6.lngE6/1E6) {
|
if(urlPortalLL && urlPortalLL[0] === portal[2].locationE6.latE6/1E6 && urlPortalLL[1] === portal[2].locationE6.lngE6/1E6) {
|
||||||
urlPortal = portal[0];
|
urlPortal = portal[0];
|
||||||
portalInUrlAvailable = true;
|
portalInUrlAvailable = true;
|
||||||
urlPortalLL = null;
|
urlPortalLL = null;
|
||||||
}
|
}
|
||||||
|
if(window.portals[portal[0]]) {
|
||||||
|
highlightPortal(window.portals[portal[0]]);
|
||||||
|
}
|
||||||
renderPortal(portal);
|
renderPortal(portal);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -285,7 +286,7 @@ window.renderPortal = function(ent) {
|
|||||||
// do nothing if portal did not change
|
// do nothing if portal did not change
|
||||||
var layerGroup = portalsLayers[parseInt(portalLevel)];
|
var layerGroup = portalsLayers[parseInt(portalLevel)];
|
||||||
var old = findEntityInLeaflet(layerGroup, window.portals, ent[0]);
|
var old = findEntityInLeaflet(layerGroup, window.portals, ent[0]);
|
||||||
if(old) {
|
if(!changing_highlighters && old) {
|
||||||
var oo = old.options;
|
var oo = old.options;
|
||||||
|
|
||||||
// Default checks to see if a portal needs to be re-rendered
|
// Default checks to see if a portal needs to be re-rendered
|
||||||
@ -333,6 +334,7 @@ window.renderPortal = function(ent) {
|
|||||||
clickable: true,
|
clickable: true,
|
||||||
level: portalLevel,
|
level: portalLevel,
|
||||||
team: team,
|
team: team,
|
||||||
|
ent: ent,
|
||||||
details: ent[2],
|
details: ent[2],
|
||||||
guid: ent[0]});
|
guid: ent[0]});
|
||||||
|
|
||||||
@ -370,7 +372,7 @@ window.renderPortal = function(ent) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.renderResonators(ent, null);
|
window.renderResonators(ent, null);
|
||||||
|
highlightPortal(p);
|
||||||
window.runHooks('portalAdded', {portal: p});
|
window.runHooks('portalAdded', {portal: p});
|
||||||
p.addTo(layerGroup);
|
p.addTo(layerGroup);
|
||||||
}
|
}
|
||||||
|
64
code/portal_highlighter.js
Normal file
64
code/portal_highlighter.js
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// Portal Highlighter //////////////////////////////////////////////////////////
|
||||||
|
// these functions handle portal highlighters
|
||||||
|
|
||||||
|
|
||||||
|
window._highlighters = null;
|
||||||
|
window._current_highlighter = localStorage.portal_highlighter;
|
||||||
|
window.changing_highlighters = false;
|
||||||
|
window._no_highlighter = 'No Highlights';
|
||||||
|
|
||||||
|
window.addPortalHighlighter = function(name, callback) {
|
||||||
|
if(_highlighters === null) {
|
||||||
|
_highlighters = {};
|
||||||
|
}
|
||||||
|
_highlighters[name] = callback;
|
||||||
|
if(localStorage.portal_highlighter === undefined) {
|
||||||
|
_current_highlighter = name;
|
||||||
|
localStorage.portal_highlighter = name;
|
||||||
|
}
|
||||||
|
portalHighlighterControl();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.portalHighlighterControl = function() {
|
||||||
|
if(_highlighters !== null) {
|
||||||
|
if($('#portal_highlight_select').length === 0) {
|
||||||
|
$("body").append("<select id='portal_highlight_select'></select>");
|
||||||
|
}
|
||||||
|
$("#portal_highlight_select").html('');
|
||||||
|
$("#portal_highlight_select").append($("<option>").attr('value',_no_highlighter).text(_no_highlighter));
|
||||||
|
var h_names = Object.keys(_highlighters).sort();
|
||||||
|
|
||||||
|
$.each(h_names, function(i, name) {
|
||||||
|
$("#portal_highlight_select").append($("<option>").attr('value',name).text(name));
|
||||||
|
});
|
||||||
|
$("#portal_highlight_select").val(_current_highlighter);
|
||||||
|
$("#portal_highlight_select").change(function(){ changePortalHighlights($(this).val());});
|
||||||
|
$(".leaflet-top.leaflet-left").css('padding-top','25px');
|
||||||
|
$(".leaflet-control-scale-line").css('margin-top','25px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.changePortalHighlights = function(name) {
|
||||||
|
changing_highlighters = true;
|
||||||
|
_current_highlighter = name;
|
||||||
|
resetHighlightedPortals();
|
||||||
|
changing_highlighters = false;
|
||||||
|
localStorage.portal_highlighter = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.highlightPortal = function(p) {
|
||||||
|
|
||||||
|
if(_highlighters !== null && _highlighters[_current_highlighter] !== undefined) {
|
||||||
|
p.options.highligher = _current_highlighter;
|
||||||
|
_highlighters[_current_highlighter]({portal: p});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.resetHighlightedPortals = function() {
|
||||||
|
$.each(portals, function(ind, portal) {
|
||||||
|
try {
|
||||||
|
renderPortal(portal.options.ent);
|
||||||
|
}
|
||||||
|
catch(e) {}
|
||||||
|
});
|
||||||
|
}
|
@ -117,3 +117,43 @@ window.getAttackApGain = function(d) {
|
|||||||
captureAp: captureAp
|
captureAp: captureAp
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This function will return the potential level a player can upgrade it to
|
||||||
|
window.potentialPortalLevel = function(d) {
|
||||||
|
var current_level = getPortalLevel(d);
|
||||||
|
var potential_level = current_level;
|
||||||
|
|
||||||
|
if(PLAYER.team === d.controllingTeam.team) {
|
||||||
|
var resonators_on_portal = d.resonatorArray.resonators;
|
||||||
|
var resonator_levels = new Array();
|
||||||
|
// figure out how many of each of these resonators can be placed by the player
|
||||||
|
var player_resontators = new Array();
|
||||||
|
for(var i=1;i<=MAX_PORTAL_LEVEL; i++) {
|
||||||
|
player_resontators[i] = i > PLAYER.level ? 0 : MAX_RESO_PER_PLAYER[i];
|
||||||
|
}
|
||||||
|
$.each(resonators_on_portal, function(ind, reso) {
|
||||||
|
if(reso !== null && reso.ownerGuid === window.PLAYER.guid) {
|
||||||
|
player_resontators[reso.level]--;
|
||||||
|
}
|
||||||
|
resonator_levels.push(reso === null ? 0 : reso.level);
|
||||||
|
});
|
||||||
|
|
||||||
|
resonator_levels.sort(function(a, b) {
|
||||||
|
return(a - b);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Max out portal
|
||||||
|
var install_index = 0;
|
||||||
|
for(var i=MAX_PORTAL_LEVEL;i>=1; i--) {
|
||||||
|
for(var install = player_resontators[i]; install>0; install--) {
|
||||||
|
if(resonator_levels[install_index] < i) {
|
||||||
|
resonator_levels[install_index] = i;
|
||||||
|
install_index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log(resonator_levels);
|
||||||
|
potential_level = resonator_levels.reduce(function(a, b) {return a + b;}) / 8;
|
||||||
|
}
|
||||||
|
return(potential_level);
|
||||||
|
}
|
||||||
|
@ -133,3 +133,15 @@ body {
|
|||||||
.leaflet-control-attribution {
|
.leaflet-control-attribution {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#portal_highlight_select{
|
||||||
|
position: absolute;
|
||||||
|
top:42px;
|
||||||
|
left:310px;
|
||||||
|
z-index: 9999;
|
||||||
|
font-size:11px;
|
||||||
|
font-family: "coda",arial,helvetica,sans-serif;
|
||||||
|
background-color:#0E3C46;
|
||||||
|
color:#ffce00;
|
||||||
|
|
||||||
|
}
|
||||||
|
92
plugins/portal-highlighter-can-make-level.user.js
Normal file
92
plugins/portal-highlighter-can-make-level.user.js
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-upgrade@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals you can upgrade to a specific level
|
||||||
|
// @version 0.1.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 to a specific level.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalsCanMakeLevel = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsCanMakeLevel.highlight = function(data,highlight_level) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var current_level = Math.floor(getPortalLevel(d));
|
||||||
|
var potential_level = Math.floor(window.potentialPortalLevel(d));
|
||||||
|
var opacity = .7;
|
||||||
|
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});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
//determines the level of poral a user can make all on their own
|
||||||
|
window.plugin.portalHighligherPortalsCanMakeLevel.playerCanSoloLevel = function(lvl) {
|
||||||
|
var renators_total = 0;
|
||||||
|
var renators_placed = 0;
|
||||||
|
var resonator_level = PLAYER.level
|
||||||
|
while(renators_placed < 8) {
|
||||||
|
for(var i = 0; i<MAX_RESO_PER_PLAYER[resonator_level]; i++) {
|
||||||
|
if(renators_placed < 8) {
|
||||||
|
renators_total += resonator_level;
|
||||||
|
renators_placed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resonator_level--;
|
||||||
|
}
|
||||||
|
return(Math.floor(renators_total/8));
|
||||||
|
}
|
||||||
|
window.plugin.portalHighligherPortalsCanMakeLevel.getHighlighter = function(lvl) {
|
||||||
|
return(function(data){
|
||||||
|
window.plugin.portalHighligherPortalsCanMakeLevel.highlight(data,lvl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
// This is the maximum level of a portal a user can be the "last peice of"
|
||||||
|
// yes, even a level 1 can be the difference in bumping a portal up to level 7
|
||||||
|
var max_can_complete = 7;
|
||||||
|
if(PLAYER.level === 8) {
|
||||||
|
max_can_complete = 8;
|
||||||
|
}
|
||||||
|
// The rational behind the "minimum" level below is that showing a level 7 player, for example, all the portals they can make
|
||||||
|
// a level 5 would be silly, as they can make ANY portal a level 5.
|
||||||
|
for(var ptl_lvl = window.plugin.portalHighligherPortalsCanMakeLevel.playerCanSoloLevel()+1; ptl_lvl<=max_can_complete; ptl_lvl++) {
|
||||||
|
window.addPortalHighlighter('Can Make Level ' + ptl_lvl, window.plugin.portalHighligherPortalsCanMakeLevel.getHighlighter(ptl_lvl));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
51
plugins/portal-highlighter-level-color.user.js
Normal file
51
plugins/portal-highlighter-level-color.user.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-level-color@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals by level color
|
||||||
|
// @version 0.1.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 level color.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
// use own namespace for plugin
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsLevelColor = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsLevelColor.colorLevel = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var portal_level = Math.floor(getPortalLevel(d));
|
||||||
|
var opacity = .6;
|
||||||
|
data.portal.setStyle({fillColor: COLORS_LVL[portal_level], fillOpacity: opacity});
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('Level Color', window.plugin.portalHighligherPortalsLevelColor.colorLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
77
plugins/portal-highlighter-missing-resonators.user.js
Normal file
77
plugins/portal-highlighter-missing-resonators.user.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-missing-resonators@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals missing resonators
|
||||||
|
// @version 0.1.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 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*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalsMissingResonators = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalsMissingResonators.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var portal_weakness = 0;
|
||||||
|
if(getTeam(d) !== 0) {
|
||||||
|
//Ding the portal for every missing resonator.
|
||||||
|
var resCount = 0;
|
||||||
|
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||||
|
if(reso === null) {
|
||||||
|
portal_weakness += .125;
|
||||||
|
} else {
|
||||||
|
resCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(portal_weakness > 0) {
|
||||||
|
var fill_opacity = portal_weakness*.85 + .15;
|
||||||
|
var color = 'red';
|
||||||
|
fill_opacity = Math.round(fill_opacity*100)/100;
|
||||||
|
var params = {fillColor: color, fillOpacity: fill_opacity};
|
||||||
|
if(resCount < 8) {
|
||||||
|
// Hole per missing resonator
|
||||||
|
var dash = new Array(8-resCount + 1).join("1,4,") + "100,0"
|
||||||
|
params["dashArray"] = dash;
|
||||||
|
}
|
||||||
|
data.portal.setStyle(params);
|
||||||
|
} else {
|
||||||
|
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
|
||||||
|
fillOpacity: 0.5,
|
||||||
|
dashArray: null});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('Portals Missing Resonators', window.plugin.portalsMissingResonators.highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
87
plugins/portal-highlighter-my-portals.user.js
Normal file
87
plugins/portal-highlighter-my-portals.user.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-my-portals@vita10gy
|
||||||
|
// @name IITC plugin: highlight my portals
|
||||||
|
// @version 0.1.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 denote portals you have a hand in. Orange is just ownership. Yellow is sheilds. Red is Resonators. Red trumps both, yellow trumps orange.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherMyPortals = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherMyPortals.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var portal_weakness = 0;
|
||||||
|
if(getTeam(d) !== 0) {
|
||||||
|
var color = '';
|
||||||
|
var opacity = .7;
|
||||||
|
if(PLAYER.guid === d.captured.capturingPlayerId) {
|
||||||
|
color = 'orange';
|
||||||
|
}
|
||||||
|
|
||||||
|
var modCount = 0;
|
||||||
|
$.each(d.portalV2.linkedModArray, function(ind, mod) {
|
||||||
|
if(mod !== null && mod.installingUser === PLAYER.guid) {
|
||||||
|
color = 'yellow';
|
||||||
|
modCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(modCount > 0) {
|
||||||
|
opacity = modCount*.25*.7 + .3;
|
||||||
|
}
|
||||||
|
|
||||||
|
var resCount = 0;
|
||||||
|
$.each(d.resonatorArray.resonators, function(ind, reso) {
|
||||||
|
if(reso !== null && reso.ownerGuid === PLAYER.guid) {
|
||||||
|
color = 'red';
|
||||||
|
resCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(resCount > 0) {
|
||||||
|
opacity = resCount*.125*.7 + .3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(color !== '') {
|
||||||
|
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
|
||||||
|
} else {
|
||||||
|
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
|
||||||
|
fillOpacity: 0.5});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('My Portals', window.plugin.portalHighligherMyPortals.highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
118
plugins/portal-highlighter-portal-ap-energy-relative.user.js
Normal file
118
plugins/portal-highlighter-portal-ap-energy-relative.user.js
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-by-ap-by-energy-relative@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals by ap/energy (relative)
|
||||||
|
// @version 0.1.1.@@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 denote AP/Energy value relative to what's currently on the screen. Brighter is better. Orange means your standard 8 down 8 up swap.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = null;
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = null;
|
||||||
|
//This is the AP for a run of the mill takedown/putback
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.baseSwapAP = 2350;
|
||||||
|
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var color = 'red';
|
||||||
|
|
||||||
|
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP == null ||
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP == null) {
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.calculateAPLevels();
|
||||||
|
}
|
||||||
|
var minApE = window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP;
|
||||||
|
var maxApE = window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP;
|
||||||
|
|
||||||
|
if(PLAYER.team !== d.controllingTeam.team) {
|
||||||
|
var ap = getAttackApGain(d);
|
||||||
|
var energy = getCurrentPortalEnergy(d);
|
||||||
|
if(energy < 1) {
|
||||||
|
energy = 1;
|
||||||
|
}
|
||||||
|
portal_ap = ap.enemyAp;
|
||||||
|
|
||||||
|
var opacity = 1;
|
||||||
|
if(minApE !== maxApE) {
|
||||||
|
opacity = ((ap.enemyAp / energy) - minApE) / (maxApE - minApE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(opacity < 0) {
|
||||||
|
opacity = 0;
|
||||||
|
}
|
||||||
|
if(opacity > 1) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.resetAPLevels = function() {
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = null;
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.calculateAPLevels = function() {
|
||||||
|
var displayBounds = map.getBounds();
|
||||||
|
$.each(window.portals, function(qk, portal) {
|
||||||
|
if(displayBounds.contains(portal.getLatLng())) {
|
||||||
|
if(PLAYER.team !== portal.options.details.controllingTeam.team) {
|
||||||
|
var ap = getAttackApGain(portal.options.details);
|
||||||
|
var energy = getCurrentPortalEnergy(portal.options.details);
|
||||||
|
if(energy < 1) {
|
||||||
|
energy = 1;
|
||||||
|
}
|
||||||
|
var portal_ap = ap.enemyAp / energy;
|
||||||
|
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP === null ||
|
||||||
|
portal_ap < window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP) {
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.minAP = portal_ap;
|
||||||
|
}
|
||||||
|
if(window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP === null ||
|
||||||
|
portal_ap > window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP) {
|
||||||
|
window.plugin.portalHighligherPortalAPPerEnergyRelative.maxAP = portal_ap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('AP/Energy (Relative)', window.plugin.portalHighligherPortalAPPerEnergyRelative.highlight);
|
||||||
|
window.addHook('requestFinished', window.plugin.portalHighligherPortalAPPerEnergyRelative.resetAPLevels);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
113
plugins/portal-highlighter-portal-ap-relative.user.js
Normal file
113
plugins/portal-highlighter-portal-ap-relative.user.js
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-by-ap-relative@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals by ap relative
|
||||||
|
// @version 0.1.1.@@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 denote AP value relative to what's currently on the screen. Brighter is better. Orange means your standard 8 down 8 up swap.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalAPRelative = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.minAP = null;
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.maxAP = null;
|
||||||
|
//This is the AP for a run of the mill takedown/putback
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.baseSwapAP = 2350;
|
||||||
|
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var color = 'red';
|
||||||
|
|
||||||
|
if(window.plugin.portalHighligherPortalAPRelative.minAP == null ||
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.maxAP == null) {
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.calculateAPLevels();
|
||||||
|
}
|
||||||
|
var minAp = window.plugin.portalHighligherPortalAPRelative.minAP;
|
||||||
|
var maxAp = window.plugin.portalHighligherPortalAPRelative.maxAP;
|
||||||
|
|
||||||
|
var ap = getAttackApGain(d);
|
||||||
|
var portal_ap = ap.friendlyAp;
|
||||||
|
|
||||||
|
if(PLAYER.team !== d.controllingTeam.team) {
|
||||||
|
portal_ap = ap.enemyAp;
|
||||||
|
if(portal_ap === window.plugin.portalHighligherPortalAPRelative.baseSwapAP) {
|
||||||
|
color = 'orange';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var opacity = 1;
|
||||||
|
if(minAp !== maxAp) {
|
||||||
|
opacity = (portal_ap - minAp) / (maxAp - minAp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(opacity < 0) {
|
||||||
|
opacity = 0;
|
||||||
|
}
|
||||||
|
if(opacity > 1) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.resetAPLevels = function() {
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.minAP = null;
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.maxAP = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.calculateAPLevels = function() {
|
||||||
|
var displayBounds = map.getBounds();
|
||||||
|
$.each(window.portals, function(qk, portal) {
|
||||||
|
if(displayBounds.contains(portal.getLatLng())) {
|
||||||
|
var ap = getAttackApGain(portal.options.details);
|
||||||
|
var portal_ap = ap.friendlyAp;
|
||||||
|
if(PLAYER.team !== portal.options.details.controllingTeam.team) {
|
||||||
|
portal_ap = ap.enemyAp;
|
||||||
|
}
|
||||||
|
if(window.plugin.portalHighligherPortalAPRelative.minAP === null ||
|
||||||
|
portal_ap < window.plugin.portalHighligherPortalAPRelative.minAP) {
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.minAP = portal_ap;
|
||||||
|
}
|
||||||
|
if(window.plugin.portalHighligherPortalAPRelative.maxAP === null ||
|
||||||
|
portal_ap > window.plugin.portalHighligherPortalAPRelative.maxAP) {
|
||||||
|
window.plugin.portalHighligherPortalAPRelative.maxAP = portal_ap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('AP (Relative)', window.plugin.portalHighligherPortalAPRelative.highlight);
|
||||||
|
window.addHook('requestFinished', window.plugin.portalHighligherPortalAPRelative.resetAPLevels);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
74
plugins/portal-highlighter-portal-ap.user.js
Normal file
74
plugins/portal-highlighter-portal-ap.user.js
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-by-ap@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals by ap
|
||||||
|
// @version 0.1.1.@@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 denote AP value. Brighter is better. Orange means your standard 8 down 8 up swap.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalAP = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAP.minAP = 65;
|
||||||
|
//Anything over max AP will be 100% opacity.
|
||||||
|
window.plugin.portalHighligherPortalAP.maxAP = 6000;
|
||||||
|
//This is the AP for a run of the mill takedown/putback
|
||||||
|
window.plugin.portalHighligherPortalAP.baseSwapAP = 2350;
|
||||||
|
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalAP.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var color = 'red';
|
||||||
|
var ap = getAttackApGain(d);
|
||||||
|
var portal_ap = ap.friendlyAp;
|
||||||
|
|
||||||
|
if(PLAYER.team !== d.controllingTeam.team) {
|
||||||
|
portal_ap = ap.enemyAp;
|
||||||
|
if(portal_ap === window.plugin.portalHighligherPortalAP.baseSwapAP) {
|
||||||
|
color = 'orange';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var opacity = (portal_ap - window.plugin.portalHighligherPortalAP.minAP) / window.plugin.portalHighligherPortalAP.maxAP;
|
||||||
|
if(opacity < 0) {
|
||||||
|
opacity = 0;
|
||||||
|
}
|
||||||
|
if(opacity > 1) {
|
||||||
|
opacity = 1;
|
||||||
|
}
|
||||||
|
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('AP (Static)', window.plugin.portalHighligherPortalAP.highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
68
plugins/portal-highlighter-portals-my-level.user.js
Normal file
68
plugins/portal-highlighter-portals-my-level.user.js
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-my-level@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals by my level
|
||||||
|
// @version 0.1.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 above or below your level
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel.belowLevel = function(data) {
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel.colorLevel(true,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel.aboveLevel = function(data) {
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel.colorLevel(false,data);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsMyLevel.colorLevel = function(below,data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var portal_level = Math.floor(getPortalLevel(d));
|
||||||
|
var player_level = PLAYER.level;
|
||||||
|
var opacity = .6;
|
||||||
|
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});
|
||||||
|
}
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('Below My Level', window.plugin.portalHighligherPortalsMyLevel.belowLevel);
|
||||||
|
window.addPortalHighlighter('Above My Level', window.plugin.portalHighligherPortalsMyLevel.aboveLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
71
plugins/portal-highlighter-portals-upgrade.user.js
Normal file
71
plugins/portal-highlighter-portals-upgrade.user.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @id iitc-plugin-highlight-portals-upgrade@vita10gy
|
||||||
|
// @name IITC plugin: highlight portals you can upgrade
|
||||||
|
// @version 0.1.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.
|
||||||
|
// @include https://www.ingress.com/intel*
|
||||||
|
// @include http://www.ingress.com/intel*
|
||||||
|
// @match https://www.ingress.com/intel*
|
||||||
|
// @match http://www.ingress.com/intel*
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
function wrapper() {
|
||||||
|
// ensure plugin framework is there, even if iitc is not yet loaded
|
||||||
|
if(typeof window.plugin !== 'function') window.plugin = function() {};
|
||||||
|
|
||||||
|
|
||||||
|
// PLUGIN START ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// use own namespace for plugin
|
||||||
|
window.plugin.portalHighligherPortalsUpgrade = function() {};
|
||||||
|
|
||||||
|
window.plugin.portalHighligherPortalsUpgrade.highlight = function(data) {
|
||||||
|
var d = data.portal.options.details;
|
||||||
|
var current_level = getPortalLevel(d);
|
||||||
|
var potential_level = window.potentialPortalLevel(d);
|
||||||
|
var player_level = PLAYER.level;
|
||||||
|
var opacity = .7;
|
||||||
|
|
||||||
|
if( potential_level > current_level) {
|
||||||
|
potential_level = Math.floor(potential_level);
|
||||||
|
current_level = Math.floor(current_level);
|
||||||
|
//console.log(potential_level + '>' + current_level);
|
||||||
|
var color = 'yellow';
|
||||||
|
if(potential_level > current_level) {
|
||||||
|
color = 'orange';
|
||||||
|
if(potential_level >= player_level) {
|
||||||
|
color = 'red';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.portal.setStyle({fillColor: color, fillOpacity: opacity});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
data.portal.setStyle({color: COLORS[getTeam(data.portal.options.details)],
|
||||||
|
fillOpacity: 0.5});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setup = function() {
|
||||||
|
window.addPortalHighlighter('Upgradable', window.plugin.portalHighligherPortalsUpgrade.highlight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if(window.iitcLoaded && typeof setup === 'function') {
|
||||||
|
setup();
|
||||||
|
} else {
|
||||||
|
if(window.bootPlugins)
|
||||||
|
window.bootPlugins.push(setup);
|
||||||
|
else
|
||||||
|
window.bootPlugins = [setup];
|
||||||
|
}
|
||||||
|
} // wrapper end
|
||||||
|
// inject code into site context
|
||||||
|
var script = document.createElement('script');
|
||||||
|
script.appendChild(document.createTextNode('('+ wrapper +')();'));
|
||||||
|
(document.body || document.head || document.documentElement).appendChild(script);
|
@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @id iitc-plugin-show-portal-weakness@vita10gy
|
// @id iitc-plugin-show-portal-weakness@vita10gy
|
||||||
// @name IITC plugin: show portal weakness
|
// @name IITC plugin: show portal weakness
|
||||||
// @version 0.6.2.@@DATETIMEVERSION@@
|
// @version 0.7.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@@
|
||||||
@ -22,8 +22,7 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
|
|||||||
// use own namespace for plugin
|
// use own namespace for plugin
|
||||||
window.plugin.portalWeakness = function() {};
|
window.plugin.portalWeakness = function() {};
|
||||||
|
|
||||||
window.plugin.portalWeakness.portalAdded = function(data) {
|
window.plugin.portalWeakness.highlightWeakness = function(data) {
|
||||||
|
|
||||||
var d = data.portal.options.details;
|
var d = data.portal.options.details;
|
||||||
var portal_weakness = 0;
|
var portal_weakness = 0;
|
||||||
if(getTeam(d) !== 0) {
|
if(getTeam(d) !== 0) {
|
||||||
@ -82,20 +81,11 @@ window.plugin.portalWeakness.portalAdded = function(data) {
|
|||||||
dashArray: null});
|
dashArray: null});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
window.COLOR_SELECTED_PORTAL = '#f0f';
|
||||||
|
|
||||||
window.plugin.portalWeakness.portalDataLoaded = function(data) {
|
|
||||||
$.each(data.portals, function(ind, portal) {
|
|
||||||
if(window.portals[portal[0]]) {
|
|
||||||
window.plugin.portalWeakness.portalAdded({portal: window.portals[portal[0]]});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var setup = function() {
|
var setup = function() {
|
||||||
window.addHook('portalAdded', window.plugin.portalWeakness.portalAdded);
|
window.addPortalHighlighter('Portal Weakness', window.plugin.portalWeakness.highlightWeakness);
|
||||||
window.addHook('portalDataLoaded', window.plugin.portalWeakness.portalDataLoaded);
|
|
||||||
window.COLOR_SELECTED_PORTAL = '#f0f';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLUGIN END //////////////////////////////////////////////////////////
|
// PLUGIN END //////////////////////////////////////////////////////////
|
||||||
|
18
style.css
18
style.css
@ -121,7 +121,7 @@ a:hover {
|
|||||||
background: rgba(8, 48, 78, 0.9);
|
background: rgba(8, 48, 78, 0.9);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 3001;
|
z-index: 99999;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
padding-left:1px;
|
padding-left:1px;
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ a:hover {
|
|||||||
width: 708px;
|
width: 708px;
|
||||||
bottom: 23px;
|
bottom: 23px;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 3000;
|
z-index: 99999;
|
||||||
background: rgba(8, 48, 78, 0.9);
|
background: rgba(8, 48, 78, 0.9);
|
||||||
font-size: 12.6px;
|
font-size: 12.6px;
|
||||||
color: #eee;
|
color: #eee;
|
||||||
@ -833,3 +833,17 @@ td + td {
|
|||||||
.ALIENS {
|
.ALIENS {
|
||||||
color: #28f428;
|
color: #28f428;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#portal_highlight_select{
|
||||||
|
position: absolute;
|
||||||
|
top:5px;
|
||||||
|
left:10px;
|
||||||
|
z-index: 9999;
|
||||||
|
font-size:11px;
|
||||||
|
font-family: "coda",arial,helvetica,sans-serif;
|
||||||
|
background-color:#0E3C46;
|
||||||
|
color:#ffce00;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user