fix comparing of PLAYER.team with team in portal data (#929)
also, fix portals-list plugin from defaulting to the wrong sort column when bookmnarks plugin is active, and changed default sort order to decending for several columns
This commit is contained in:
parent
bfdedaa642
commit
634c0fd0e0
@ -237,7 +237,7 @@ window.getAttackApGainText = function(d,fieldCount,linkCount) {
|
||||
|
||||
function tt(text) {
|
||||
var t = '';
|
||||
if (PLAYER.team == d.team) {
|
||||
if (teamStringToId(PLAYER.team) == teamStringToId(d.team)) {
|
||||
totalGain = breakdown.friendlyAp;
|
||||
t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n';
|
||||
t += ' Deploy ' + breakdown.deployCount + ', ';
|
||||
|
@ -2,7 +2,7 @@
|
||||
// @id iitc-plugin-portals-list@teo96
|
||||
// @name IITC plugin: show list of portals
|
||||
// @category Info
|
||||
// @version 0.2.0.@@DATETIMEVERSION@@
|
||||
// @version 0.2.1.@@DATETIMEVERSION@@
|
||||
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
|
||||
// @updateURL @@UPDATEURL@@
|
||||
// @downloadURL @@DOWNLOADURL@@
|
||||
@ -84,7 +84,8 @@ window.plugin.portalslist.fields = [
|
||||
$(cell)
|
||||
.addClass("alignR")
|
||||
.text(portal.options.team===TEAM_NONE ? '-' : value+'%');
|
||||
}
|
||||
},
|
||||
defaultOrder: -1,
|
||||
},
|
||||
{
|
||||
title: "Res",
|
||||
@ -93,7 +94,8 @@ window.plugin.portalslist.fields = [
|
||||
$(cell)
|
||||
.addClass("alignR")
|
||||
.text(value);
|
||||
}
|
||||
},
|
||||
defaultOrder: -1,
|
||||
},
|
||||
{
|
||||
title: "Links",
|
||||
@ -105,7 +107,8 @@ window.plugin.portalslist.fields = [
|
||||
.addClass('help')
|
||||
.attr('title', 'In:\t' + value.in.length + '\nOut:\t' + value.out.length)
|
||||
.text(value.in.length+value.out.length);
|
||||
}
|
||||
},
|
||||
defaultOrder: -1,
|
||||
},
|
||||
{
|
||||
title: "Fields",
|
||||
@ -114,7 +117,8 @@ window.plugin.portalslist.fields = [
|
||||
$(cell)
|
||||
.addClass("alignR")
|
||||
.text(value);
|
||||
}
|
||||
},
|
||||
defaultOrder: -1,
|
||||
},
|
||||
{
|
||||
title: "AP",
|
||||
@ -126,7 +130,7 @@ window.plugin.portalslist.fields = [
|
||||
sortValue: function(value, portal) { return value.enemyAp; },
|
||||
format: function(cell, portal, value) {
|
||||
var title = '';
|
||||
if (PLAYER.team == portal.options.data.team) {
|
||||
if (teamStringToId(PLAYER.team) == portal.options.team) {
|
||||
title += 'Friendly AP:\t'+value.friendlyAp+'\n'
|
||||
+ '- deploy '+(8-portal.options.data.resCount)+' resonator(s)\n'
|
||||
+ '- upgrades/mods unknown\n';
|
||||
@ -140,7 +144,8 @@ window.plugin.portalslist.fields = [
|
||||
.addClass('help')
|
||||
.prop('title', title)
|
||||
.html(digits(value.enemyAp));
|
||||
}
|
||||
},
|
||||
defaultOrder: -1,
|
||||
},
|
||||
];
|
||||
|
||||
@ -202,7 +207,8 @@ window.plugin.portalslist.getPortals = function() {
|
||||
|
||||
window.plugin.portalslist.displayPL = function() {
|
||||
var list;
|
||||
window.plugin.portalslist.sortBy = 1;
|
||||
// plugins (e.g. bookmarks) can insert fields before the standard ones - so we need to search for the 'level' column
|
||||
window.plugin.portalslist.sortBy = window.plugin.portalslist.fields.map(function(f){return f.title;}).indexOf('Level');
|
||||
window.plugin.portalslist.sortOrder = -1;
|
||||
window.plugin.portalslist.enlP = 0;
|
||||
window.plugin.portalslist.resP = 0;
|
||||
@ -245,6 +251,9 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
|
||||
return sortOrder * sortField.sort(valueA, valueB, a.portal, b.portal);
|
||||
}
|
||||
|
||||
//FIXME: sort isn't stable, so re-sorting identical values can change the order of the list.
|
||||
//fall back to something constant (e.g. portal name?, portal GUID?),
|
||||
//or switch to a stable sort so order of equal items doesn't change
|
||||
return sortOrder *
|
||||
(valueA < valueB ? -1 :
|
||||
valueA > valueB ? 1 :
|
||||
|
Loading…
x
Reference in New Issue
Block a user