moved favorite-portals and ipas-link to broken plugin folder - created dummy deleted files
fix show-linked-portals fix portal-highlighter-portals-my-level changed hook on portal detail display to only run when the details are loaded - fixes a few plugins
This commit is contained in:
parent
70030998bf
commit
a77a31ac07
173
plugins/broken/favorite-portals.user.js
Normal file
173
plugins/broken/favorite-portals.user.js
Normal file
@ -0,0 +1,173 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-favorite-portals@soulBit
|
||||
// @name IITC plugin: Favorite Portals
|
||||
// @category Obsolete
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] DEPRECATED. Please use "Bookmarks for maps and portals" instead.
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
window.plugin.favoritePortals = function() {};
|
||||
|
||||
window.plugin.favoritePortals.portalList = {};
|
||||
window.plugin.favoritePortals.LOCAL_STORAGE_KEY = "plugin-favorite-portals";
|
||||
window.plugin.favoritePortals.hasLocalStorage = ('localStorage' in window && window['localStorage'] !== null);
|
||||
|
||||
window.plugin.favoritePortals.onDetailsUpdated = function(data) {
|
||||
$('.linkdetails').prepend("<div title='Favorite this portal' class='toggle-favorite-portal' onclick='window.plugin.favoritePortals.togglePortal()' />");
|
||||
if(window.plugin.favoritePortals.portalList[window.selectedPortal]) {
|
||||
$('.toggle-favorite-portal').addClass( 'portal-on' );
|
||||
window.plugin.favoritePortals.portalList[window.selectedPortal] = window.portals[window.selectedPortal].options;
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.display = function() {
|
||||
var output = '';
|
||||
|
||||
if (!window.plugin.favoritePortals.hasLocalStorage) {
|
||||
output += "Favorite portals cannot save any data, please try another browser that supports 'localStorage'.";
|
||||
} else {
|
||||
if ($.isEmptyObject(window.plugin.favoritePortals.portalList)) {
|
||||
output += "No portals have been marked as favorite, click the blue square in the bottom left corner of the portal details to save one.";
|
||||
} else {
|
||||
output += "<div class='header'>Portal list (values not current till portal on screen):</div>";
|
||||
output += "<div class='portal-list-container'>";
|
||||
|
||||
var portals = [], dataChanged = false, portalData;
|
||||
$.each( window.plugin.favoritePortals.portalList, function(i, portal) {
|
||||
if(window.portals[i]) {
|
||||
dataChanged = true;
|
||||
window.plugin.favoritePortals.portalList[ i ] = window.portals[i].options;
|
||||
}
|
||||
portalData = (window.portals[i]) ? window.portals[i].options : portal;
|
||||
portals.push({'guid': i, 'portalData': portalData});
|
||||
});
|
||||
if(dataChanged)
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
|
||||
portals.sort(function(a,b) {
|
||||
var nameA = a.portalData.details.portalV2.descriptiveText.TITLE.toLowerCase();
|
||||
var nameB = b.portalData.details.portalV2.descriptiveText.TITLE.toLowerCase();
|
||||
return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0;
|
||||
});
|
||||
|
||||
output += "<ol>";
|
||||
var teamName, energy;
|
||||
$.each(portals, function(i, portal) {
|
||||
portalData = portal.portalData;
|
||||
output += "<li name='" + portal.guid + "'>";
|
||||
|
||||
output += "<a class='delete-favorite-portal' title='Delete favorite?' onclick='window.plugin.favoritePortals.onDelete(" + '"' + portal.guid + '"' + ");return false'>X</a>";
|
||||
output += "<a onclick='window.plugin.favoritePortals.onPortalClicked(" + ' "' + portal.guid + '", [' + (portalData.details.locationE6.latE6 / 1000000) + "," + (portal.portalData.details.locationE6.lngE6 / 1000000) + "]);return false'>" + portalData.details.portalV2.descriptiveText.TITLE + "</a>";
|
||||
teamName = portalData.details.controllingTeam.team;
|
||||
output += " - L" + Math.floor( portalData.level );
|
||||
energy = Math.floor( window.getCurrentPortalEnergy(portalData.details) / window.getPortalEnergy(portalData.details) * 100 );
|
||||
if(!isNaN(energy))
|
||||
output += " @" + energy + "%";
|
||||
output += ": " + ( (teamName === "ALIENS") ? "Enlightened" : teamName[0] + teamName.slice(1).toLowerCase() );
|
||||
if(portalData.details.portalV2.linkedEdges.length > 0 || portalData.details.portalV2.linkedFields.length > 0)
|
||||
output += ", " + portalData.details.portalV2.linkedEdges.length + " links & " + portalData.details.portalV2.linkedFields.length + " fields";
|
||||
output += "</li>";
|
||||
});
|
||||
|
||||
output += "</ol>"
|
||||
output += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
window.dialog({'html': "<div id='favorite-portal-list'>" + output + "</div>", 'title': 'Favorite portals', 'id': 'favorite-portals'});
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.onDelete = function(guid) {
|
||||
delete window.plugin.favoritePortals.portalList[ guid ];
|
||||
if(window.selectedPortal && window.selectedPortal === guid)
|
||||
$('.toggle-favorite-portal').removeClass( 'portal-on' ).addClass( 'portal-off' );
|
||||
$("li[name='" + guid + "']").remove();
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.onPortalClicked = function(guid, coords) {
|
||||
window.zoomToAndShowPortal(guid, coords);
|
||||
$('#dialog-favorite-portals').dialog('close');
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.togglePortal = function() {
|
||||
if(window.plugin.favoritePortals.portalList[window.selectedPortal]) {
|
||||
$('.toggle-favorite-portal').removeClass('portal-on').addClass('portal-off');
|
||||
delete window.plugin.favoritePortals.portalList[ window.selectedPortal ];
|
||||
} else {
|
||||
$('.toggle-favorite-portal').removeClass('portal-off').addClass('portal-on');
|
||||
window.plugin.favoritePortals.portalList[window.selectedPortal] = window.portals[window.selectedPortal].options;
|
||||
}
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.savePortals = function() {
|
||||
var portalsObject = {'portals': window.plugin.favoritePortals.portalList};
|
||||
var portalListJSON = JSON.stringify(portalsObject);
|
||||
localStorage[window.plugin.favoritePortals.LOCAL_STORAGE_KEY] = portalListJSON;
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.loadPortals = function() {
|
||||
var portalListJSON = localStorage[window.plugin.favoritePortals.LOCAL_STORAGE_KEY];
|
||||
if(!portalListJSON) return;
|
||||
var portalsObject = JSON.parse(portalListJSON);
|
||||
window.plugin.favoritePortals.portalList = portalsObject.portals;
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.setup = function() {
|
||||
window.plugin.favoritePortals.loadPortals();
|
||||
window.addHook('portalDetailsUpdated', window.plugin.favoritePortals.onDetailsUpdated);
|
||||
$('#toolbox').append("<a onclick='window.plugin.favoritePortals.display()' title='Create a list of favorite portals'>Favorite Portals</a>");
|
||||
$("<style>").prop("type", "text/css").html(".toggle-favorite-portal {\
|
||||
width: 13px;\
|
||||
height: 13px;\
|
||||
margin-left: 10px;\
|
||||
vertical-align: middle;\
|
||||
display: inline-block;\
|
||||
cursor: pointer;\
|
||||
border: 1px solid #20A8B1;\
|
||||
}\
|
||||
.portal-on {\
|
||||
background-color: #20A8B1;\
|
||||
}\
|
||||
.portal-off {\
|
||||
}\
|
||||
.linkdetails {\
|
||||
margin-bottom: 5px;\
|
||||
}\
|
||||
.delete-favorite-portal {\
|
||||
width: 10px;\
|
||||
height: 10px;\
|
||||
color: #FFCC00;\
|
||||
border: 2px solid #20A8B1;\
|
||||
margin-right: 10px;\
|
||||
padding-left: 3px;\
|
||||
padding-right: 3px;\
|
||||
font-weight: bolder;\
|
||||
}\
|
||||
#favorite-portal-list {\
|
||||
padding: 5px;\
|
||||
}\
|
||||
#favorite-portal-list li {\
|
||||
line-height: 1.8;\
|
||||
}").appendTo("head");
|
||||
};
|
||||
|
||||
var setup = window.plugin.favoritePortals.setup;
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
111
plugins/broken/ipas-link.user.js
Normal file
111
plugins/broken/ipas-link.user.js
Normal file
@ -0,0 +1,111 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-ipas-link@graphracer
|
||||
// @name IITC Plugin: simulate an attack on portal
|
||||
// @category Portal Info
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/xosofox/IPAS
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Adds a link to the portal details to open the portal in IPAS - Ingress Portal Attack Simulator on http://ipas.graphracer.com
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
// use own namespace for plugin
|
||||
window.plugin.ipasLink = function() {};
|
||||
|
||||
window.plugin.ipasLink.setupCallback = function() {
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.addLink = function(d) {
|
||||
$('.linkdetails').append('<aside><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow" title="Use IPAS to simulate an attack on this portal">Simulate attack</a></aside>');
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.getHash = function (d) {
|
||||
var hashParts = [];
|
||||
$.each(d.resonatorArray.resonators, function (ind, reso) {
|
||||
if (reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
} else {
|
||||
hashParts.push("1,20,0");
|
||||
}
|
||||
});
|
||||
var resos = hashParts.join(";");
|
||||
|
||||
hashParts = [];
|
||||
$.each(d.portalV2.linkedModArray, function (ind, mod) {
|
||||
// s - shields
|
||||
// h - heat sink
|
||||
// i - intentionally left in
|
||||
// t - turret
|
||||
//
|
||||
// f - force amp
|
||||
// m - multi-hack
|
||||
// l - link-amp
|
||||
//
|
||||
var modCodes = {
|
||||
"RES_SHIELD": "s",
|
||||
"HEATSINK": "h",
|
||||
"TURRET": "t",
|
||||
"FORCE_AMP": "f",
|
||||
"MULTIHACK": "m",
|
||||
"LINK_AMPLIFIER": "l"
|
||||
}
|
||||
|
||||
var mc = "0";
|
||||
if (mod) {
|
||||
if (mod.type in modCodes) {
|
||||
mc = modCodes[mod.type] + mod.rarity.charAt(0).toLowerCase();
|
||||
|
||||
//special for shields to distinguish old/new mitigation
|
||||
if (mod.type == "RES_SHIELD") {
|
||||
mc += mod.stats.MITIGATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
hashParts.push(mc);
|
||||
});
|
||||
var shields = hashParts.join(",");
|
||||
|
||||
var linkParts = [];
|
||||
var edges = d.portalV2.linkedEdges;
|
||||
|
||||
var portalL = new L.LatLng(d.locationE6.latE6 / 1E6, d.locationE6.lngE6 / 1E6)
|
||||
$.each(edges, function (ind, edge) {
|
||||
//calc distance in m here
|
||||
var distance = 1; //default to 1m, so a low level portal would support it
|
||||
|
||||
//Try to find other portals details
|
||||
var guid = edge.otherPortalGuid
|
||||
if (window.portals[guid] !== undefined) {
|
||||
//get other portals details as o
|
||||
var o = window.portals[guid].options.details;
|
||||
var otherPortalL = new L.LatLng(o.locationE6.latE6 / 1E6, o.locationE6.lngE6 / 1E6);
|
||||
var distance = Math.round(portalL.distanceTo(otherPortalL));
|
||||
}
|
||||
|
||||
if (!(edge.isOrigin)) {
|
||||
distance = distance * -1;
|
||||
}
|
||||
linkParts.push(distance);
|
||||
});
|
||||
var links = linkParts.join(",");
|
||||
|
||||
return resos + "/" + shields + "/" + links; //changed with IPAS 1.1 to / instead of |
|
||||
}
|
||||
|
||||
var setup = function () {
|
||||
window.plugin.ipasLink.setupCallback();
|
||||
}
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
@ -1,9 +1,9 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-favorite-portals@soulBit
|
||||
// @name IITC plugin: Favorite Portals
|
||||
// @category Obsolete
|
||||
// @category Deleted
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] DEPRECATED. Please use "Bookmarks for maps and portals" instead.
|
||||
// @description PLUGIN CURRENTLY UNAVAILABLE
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -13,161 +13,3 @@
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
window.plugin.favoritePortals = function() {};
|
||||
|
||||
window.plugin.favoritePortals.portalList = {};
|
||||
window.plugin.favoritePortals.LOCAL_STORAGE_KEY = "plugin-favorite-portals";
|
||||
window.plugin.favoritePortals.hasLocalStorage = ('localStorage' in window && window['localStorage'] !== null);
|
||||
|
||||
window.plugin.favoritePortals.onDetailsUpdated = function(data) {
|
||||
$('.linkdetails').prepend("<div title='Favorite this portal' class='toggle-favorite-portal' onclick='window.plugin.favoritePortals.togglePortal()' />");
|
||||
if(window.plugin.favoritePortals.portalList[window.selectedPortal]) {
|
||||
$('.toggle-favorite-portal').addClass( 'portal-on' );
|
||||
window.plugin.favoritePortals.portalList[window.selectedPortal] = window.portals[window.selectedPortal].options;
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.display = function() {
|
||||
var output = '';
|
||||
|
||||
if (!window.plugin.favoritePortals.hasLocalStorage) {
|
||||
output += "Favorite portals cannot save any data, please try another browser that supports 'localStorage'.";
|
||||
} else {
|
||||
if ($.isEmptyObject(window.plugin.favoritePortals.portalList)) {
|
||||
output += "No portals have been marked as favorite, click the blue square in the bottom left corner of the portal details to save one.";
|
||||
} else {
|
||||
output += "<div class='header'>Portal list (values not current till portal on screen):</div>";
|
||||
output += "<div class='portal-list-container'>";
|
||||
|
||||
var portals = [], dataChanged = false, portalData;
|
||||
$.each( window.plugin.favoritePortals.portalList, function(i, portal) {
|
||||
if(window.portals[i]) {
|
||||
dataChanged = true;
|
||||
window.plugin.favoritePortals.portalList[ i ] = window.portals[i].options;
|
||||
}
|
||||
portalData = (window.portals[i]) ? window.portals[i].options : portal;
|
||||
portals.push({'guid': i, 'portalData': portalData});
|
||||
});
|
||||
if(dataChanged)
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
|
||||
portals.sort(function(a,b) {
|
||||
var nameA = a.portalData.details.portalV2.descriptiveText.TITLE.toLowerCase();
|
||||
var nameB = b.portalData.details.portalV2.descriptiveText.TITLE.toLowerCase();
|
||||
return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0;
|
||||
});
|
||||
|
||||
output += "<ol>";
|
||||
var teamName, energy;
|
||||
$.each(portals, function(i, portal) {
|
||||
portalData = portal.portalData;
|
||||
output += "<li name='" + portal.guid + "'>";
|
||||
|
||||
output += "<a class='delete-favorite-portal' title='Delete favorite?' onclick='window.plugin.favoritePortals.onDelete(" + '"' + portal.guid + '"' + ");return false'>X</a>";
|
||||
output += "<a onclick='window.plugin.favoritePortals.onPortalClicked(" + ' "' + portal.guid + '", [' + (portalData.details.locationE6.latE6 / 1000000) + "," + (portal.portalData.details.locationE6.lngE6 / 1000000) + "]);return false'>" + portalData.details.portalV2.descriptiveText.TITLE + "</a>";
|
||||
teamName = portalData.details.controllingTeam.team;
|
||||
output += " - L" + Math.floor( portalData.level );
|
||||
energy = Math.floor( window.getCurrentPortalEnergy(portalData.details) / window.getPortalEnergy(portalData.details) * 100 );
|
||||
if(!isNaN(energy))
|
||||
output += " @" + energy + "%";
|
||||
output += ": " + ( (teamName === "ALIENS") ? "Enlightened" : teamName[0] + teamName.slice(1).toLowerCase() );
|
||||
if(portalData.details.portalV2.linkedEdges.length > 0 || portalData.details.portalV2.linkedFields.length > 0)
|
||||
output += ", " + portalData.details.portalV2.linkedEdges.length + " links & " + portalData.details.portalV2.linkedFields.length + " fields";
|
||||
output += "</li>";
|
||||
});
|
||||
|
||||
output += "</ol>"
|
||||
output += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
window.dialog({'html': "<div id='favorite-portal-list'>" + output + "</div>", 'title': 'Favorite portals', 'id': 'favorite-portals'});
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.onDelete = function(guid) {
|
||||
delete window.plugin.favoritePortals.portalList[ guid ];
|
||||
if(window.selectedPortal && window.selectedPortal === guid)
|
||||
$('.toggle-favorite-portal').removeClass( 'portal-on' ).addClass( 'portal-off' );
|
||||
$("li[name='" + guid + "']").remove();
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.onPortalClicked = function(guid, coords) {
|
||||
window.zoomToAndShowPortal(guid, coords);
|
||||
$('#dialog-favorite-portals').dialog('close');
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.togglePortal = function() {
|
||||
if(window.plugin.favoritePortals.portalList[window.selectedPortal]) {
|
||||
$('.toggle-favorite-portal').removeClass('portal-on').addClass('portal-off');
|
||||
delete window.plugin.favoritePortals.portalList[ window.selectedPortal ];
|
||||
} else {
|
||||
$('.toggle-favorite-portal').removeClass('portal-off').addClass('portal-on');
|
||||
window.plugin.favoritePortals.portalList[window.selectedPortal] = window.portals[window.selectedPortal].options;
|
||||
}
|
||||
window.plugin.favoritePortals.savePortals();
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.savePortals = function() {
|
||||
var portalsObject = {'portals': window.plugin.favoritePortals.portalList};
|
||||
var portalListJSON = JSON.stringify(portalsObject);
|
||||
localStorage[window.plugin.favoritePortals.LOCAL_STORAGE_KEY] = portalListJSON;
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.loadPortals = function() {
|
||||
var portalListJSON = localStorage[window.plugin.favoritePortals.LOCAL_STORAGE_KEY];
|
||||
if(!portalListJSON) return;
|
||||
var portalsObject = JSON.parse(portalListJSON);
|
||||
window.plugin.favoritePortals.portalList = portalsObject.portals;
|
||||
}
|
||||
|
||||
window.plugin.favoritePortals.setup = function() {
|
||||
window.plugin.favoritePortals.loadPortals();
|
||||
window.addHook('portalDetailsUpdated', window.plugin.favoritePortals.onDetailsUpdated);
|
||||
$('#toolbox').append("<a onclick='window.plugin.favoritePortals.display()' title='Create a list of favorite portals'>Favorite Portals</a>");
|
||||
$("<style>").prop("type", "text/css").html(".toggle-favorite-portal {\
|
||||
width: 13px;\
|
||||
height: 13px;\
|
||||
margin-left: 10px;\
|
||||
vertical-align: middle;\
|
||||
display: inline-block;\
|
||||
cursor: pointer;\
|
||||
border: 1px solid #20A8B1;\
|
||||
}\
|
||||
.portal-on {\
|
||||
background-color: #20A8B1;\
|
||||
}\
|
||||
.portal-off {\
|
||||
}\
|
||||
.linkdetails {\
|
||||
margin-bottom: 5px;\
|
||||
}\
|
||||
.delete-favorite-portal {\
|
||||
width: 10px;\
|
||||
height: 10px;\
|
||||
color: #FFCC00;\
|
||||
border: 2px solid #20A8B1;\
|
||||
margin-right: 10px;\
|
||||
padding-left: 3px;\
|
||||
padding-right: 3px;\
|
||||
font-weight: bolder;\
|
||||
}\
|
||||
#favorite-portal-list {\
|
||||
padding: 5px;\
|
||||
}\
|
||||
#favorite-portal-list li {\
|
||||
line-height: 1.8;\
|
||||
}").appendTo("head");
|
||||
};
|
||||
|
||||
var setup = window.plugin.favoritePortals.setup;
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
||||
|
@ -1,111 +1,15 @@
|
||||
// ==UserScript==
|
||||
// @id iitc-plugin-ipas-link@graphracer
|
||||
// @name IITC Plugin: simulate an attack on portal
|
||||
// @category Portal Info
|
||||
// @category Deleted
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/xosofox/IPAS
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
// @description [@@BUILDNAME@@-@@BUILDDATE@@] Adds a link to the portal details to open the portal in IPAS - Ingress Portal Attack Simulator on http://ipas.graphracer.com
|
||||
// @description PLUGIN CURRENTLY UNAVAILABLE
|
||||
// @include https://www.ingress.com/intel*
|
||||
// @include http://www.ingress.com/intel*
|
||||
// @match https://www.ingress.com/intel*
|
||||
// @match http://www.ingress.com/intel*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
@@PLUGINSTART@@
|
||||
|
||||
// PLUGIN START ////////////////////////////////////////////////////////
|
||||
|
||||
// use own namespace for plugin
|
||||
window.plugin.ipasLink = function() {};
|
||||
|
||||
window.plugin.ipasLink.setupCallback = function() {
|
||||
addHook('portalDetailsUpdated', window.plugin.ipasLink.addLink);
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.addLink = function(d) {
|
||||
$('.linkdetails').append('<aside><a href="http://ipas.graphracer.com/index.html#' + window.plugin.ipasLink.getHash(d.portalDetails) + '" target="ipaswindow" title="Use IPAS to simulate an attack on this portal">Simulate attack</a></aside>');
|
||||
}
|
||||
|
||||
window.plugin.ipasLink.getHash = function (d) {
|
||||
var hashParts = [];
|
||||
$.each(d.resonatorArray.resonators, function (ind, reso) {
|
||||
if (reso) {
|
||||
hashParts.push(reso.level + "," + reso.distanceToPortal + "," + reso.energyTotal);
|
||||
} else {
|
||||
hashParts.push("1,20,0");
|
||||
}
|
||||
});
|
||||
var resos = hashParts.join(";");
|
||||
|
||||
hashParts = [];
|
||||
$.each(d.portalV2.linkedModArray, function (ind, mod) {
|
||||
// s - shields
|
||||
// h - heat sink
|
||||
// i - intentionally left in
|
||||
// t - turret
|
||||
//
|
||||
// f - force amp
|
||||
// m - multi-hack
|
||||
// l - link-amp
|
||||
//
|
||||
var modCodes = {
|
||||
"RES_SHIELD": "s",
|
||||
"HEATSINK": "h",
|
||||
"TURRET": "t",
|
||||
"FORCE_AMP": "f",
|
||||
"MULTIHACK": "m",
|
||||
"LINK_AMPLIFIER": "l"
|
||||
}
|
||||
|
||||
var mc = "0";
|
||||
if (mod) {
|
||||
if (mod.type in modCodes) {
|
||||
mc = modCodes[mod.type] + mod.rarity.charAt(0).toLowerCase();
|
||||
|
||||
//special for shields to distinguish old/new mitigation
|
||||
if (mod.type == "RES_SHIELD") {
|
||||
mc += mod.stats.MITIGATION;
|
||||
}
|
||||
}
|
||||
}
|
||||
hashParts.push(mc);
|
||||
});
|
||||
var shields = hashParts.join(",");
|
||||
|
||||
var linkParts = [];
|
||||
var edges = d.portalV2.linkedEdges;
|
||||
|
||||
var portalL = new L.LatLng(d.locationE6.latE6 / 1E6, d.locationE6.lngE6 / 1E6)
|
||||
$.each(edges, function (ind, edge) {
|
||||
//calc distance in m here
|
||||
var distance = 1; //default to 1m, so a low level portal would support it
|
||||
|
||||
//Try to find other portals details
|
||||
var guid = edge.otherPortalGuid
|
||||
if (window.portals[guid] !== undefined) {
|
||||
//get other portals details as o
|
||||
var o = window.portals[guid].options.details;
|
||||
var otherPortalL = new L.LatLng(o.locationE6.latE6 / 1E6, o.locationE6.lngE6 / 1E6);
|
||||
var distance = Math.round(portalL.distanceTo(otherPortalL));
|
||||
}
|
||||
|
||||
if (!(edge.isOrigin)) {
|
||||
distance = distance * -1;
|
||||
}
|
||||
linkParts.push(distance);
|
||||
});
|
||||
var links = linkParts.join(",");
|
||||
|
||||
return resos + "/" + shields + "/" + links; //changed with IPAS 1.1 to / instead of |
|
||||
}
|
||||
|
||||
var setup = function () {
|
||||
window.plugin.ipasLink.setupCallback();
|
||||
}
|
||||
|
||||
// PLUGIN END //////////////////////////////////////////////////////////
|
||||
|
||||
@@PLUGINEND@@
|
||||
|
@ -31,8 +31,7 @@ window.plugin.portalHighligherPortalsMyLevel.aboveLevel = function(data) {
|
||||
}
|
||||
|
||||
window.plugin.portalHighligherPortalsMyLevel.colorLevel = function(below,data) {
|
||||
var d = data.portal.options.details;
|
||||
var portal_level = Math.floor(getPortalLevel(d));
|
||||
var portal_level = data.portal.options.level;
|
||||
var player_level = PLAYER.level;
|
||||
var opacity = .6;
|
||||
if((below && portal_level <= player_level) ||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// @id iitc-plugin-show-linked-portals@fstopienski
|
||||
// @name IITC plugin: Show linked portals
|
||||
// @category Portal Info
|
||||
// @version 0.1.0.@@DATETIMEVERSION@@
|
||||
// @version 0.1.1.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -35,6 +35,7 @@ window.plugin.showLinkedPortal.handleUpdate = function () {
|
||||
}
|
||||
|
||||
window.plugin.showLinkedPortal.portalDetail = function (data) {
|
||||
|
||||
// don't render linked portal data if portal is neutral.
|
||||
// (the data can remain sometimes - when a portal decays?)
|
||||
if (data.portalDetails.controllingTeam.team == 'NEUTRAL')
|
||||
@ -51,20 +52,17 @@ window.plugin.showLinkedPortal.portalDetail = function (data) {
|
||||
|
||||
$('.showLinkedPortalLink:not(.outOfRange)').bind('click', function () {
|
||||
var guid = $(this).attr('data-guid');
|
||||
if (window.portals[guid] !== undefined) {
|
||||
window.selectPortal($(this).attr('data-guid'));
|
||||
window.renderPortalDetails(window.selectedPortal);
|
||||
var portalDetails = window.portals[guid].options.details;
|
||||
var lat0 = portalDetails.locationE6.latE6 / 1E6;
|
||||
var lon0 = portalDetails.locationE6.lngE6 / 1E6;
|
||||
var Rlatlng = [lat0, lon0];
|
||||
map.setView(Rlatlng, map.getZoom());
|
||||
window.renderPortalDetails(guid);
|
||||
var latlng = findPortalLatLng(guid);
|
||||
if (latlng) {
|
||||
if (!map.getBounds().pad(-0.1).contains(latlng)) {
|
||||
map.panTo(latlng);
|
||||
}
|
||||
else {
|
||||
// TODO: instead of just zooming out one level, check the link data for the start+end coordinates,
|
||||
// and fit the map view to the bounding box
|
||||
map.setZoom((map.getZoom() - 1));
|
||||
} else {
|
||||
// no idea where this portal is(!) - so step back one zoom level
|
||||
map.setZoom(map.getZoom()-1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@ -74,23 +72,21 @@ window.plugin.showLinkedPortal.getPortalByGuid = function (guid,isorigin) {
|
||||
var portalInfoString;
|
||||
|
||||
if (window.portals[guid] !== undefined) {
|
||||
var portalDetails = window.portals[guid].options.details;
|
||||
var portalData = window.portals[guid].options.data;
|
||||
|
||||
var portalNameAdressAlt = "'" + portalDetails.portalV2.descriptiveText.TITLE + "' (" + portalDetails.portalV2.descriptiveText.ADDRESS + ")";
|
||||
var portalNameAdressTitle = $('<div/>').append($('<strong/>').text(portalDetails.portalV2.descriptiveText.TITLE))
|
||||
.append($('<br/>'))
|
||||
.append($('<em/>').text('(' + portalDetails.portalV2.descriptiveText.ADDRESS + ')'))
|
||||
var portalNameAdressAlt = "'" + portalData.title + "'";;
|
||||
var portalNameAdressTitle = $('<div/>').append($('<strong/>').text(portalData.title))
|
||||
.append($('<br/>'))
|
||||
.append(linkDirection)
|
||||
.html();
|
||||
var imageUrl = getPortalImageUrl(portalDetails);
|
||||
var imageUrl = fixPortalImageUrl(portalData.image);
|
||||
portalInfoString = $('<div/>').html($('<img/>').attr('src', imageUrl)
|
||||
.attr('class', 'minImg')
|
||||
.attr('alt', portalNameAdressAlt)
|
||||
.attr('title', portalNameAdressTitle))
|
||||
.html();
|
||||
} else {
|
||||
var title = $('<div/>').append($('<strong/>').text('Zoom out'))
|
||||
var title = $('<div/>').append($('<strong/>').text('Go to portal'))
|
||||
.append($('<br/>'))
|
||||
.append(linkDirection)
|
||||
.html();
|
||||
|
Loading…
x
Reference in New Issue
Block a user