portals-list: more changes

- add AP column - destroy+capture AP, with tooltip showing details
- clean up handling of truncated portal names - removes unnecessary wrapper <div>
- shortened resonator column title
- add/remove tooltip and help cursor where it makes sense
- add % to health column
This commit is contained in:
Jon Atkins 2013-12-18 22:42:49 +00:00
parent ba33e28675
commit c96e6ab799

View File

@ -77,14 +77,15 @@ window.plugin.portalslist.getPortals = function() {
}
var l = window.getPortalLinks(i);
var f = window.getPortalFields(i);
var ap = portalApGainMaths(d.resCount, l.in.length+l.out.length, f.length);
var thisPortal = {
'portal': portal,
'guid': i,
'teamN': teamN,
'teamN': teamN, // TEAM_NONE, TEAM_RES or TEAM_ENL
'team': d.team, // "NEUTRAL", "RESISTANCE" or "ENLIGHTENED"
'name': d.title,
'nameLower': d.title.toLowerCase(),
'team': d.team,
'level': portal.options.level,
'health': d.health,
'resCount': d.resCount,
@ -92,7 +93,9 @@ window.plugin.portalslist.getPortals = function() {
'linkCount': l.in.length + l.out.length,
'link' : l,
'fieldCount': f.length,
'field' : f
'field' : f,
'enemyAp': ap.enemyAp,
'ap': ap,
};
window.plugin.portalslist.listPortals.push(thisPortal);
});
@ -165,9 +168,11 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
+ '<th ' + sortAttr('level', sortBy, -1) + '>Level</th>'
+ '<th ' + sortAttr('teamN', sortBy, 1) + '>Team</th>'
+ '<th ' + sortAttr('health', sortBy, -1) + '>Health</th>'
+ '<th ' + sortAttr('resCount', sortBy, -1) + '>Resonators</th>'
+ '<th ' + sortAttr('resCount', sortBy, -1) + '>Res</th>'
+ '<th ' + sortAttr('linkCount', sortBy, -1) + '>Links</th>'
+ '<th ' + sortAttr('fieldCount', sortBy, -1) + '>Fields</th>'
+ '<th ' + sortAttr('enemyAp', sortBy, -1) + '>AP</th>'
+ '</tr>\n';
var rowNum = 1;
@ -180,11 +185,23 @@ window.plugin.portalslist.portalTable = function(sortBy, sortOrder, filter) {
+ '<td class="L' + portal.level +'" style="background-color: '+COLORS_LVL[portal.level]+'">' + portal.level + '</td>'
+ '<td style="text-align:center;">' + portal.team.substr(0,3) + '</td>';
html += '<td style="cursor:help" title="'+ portal.health +'">' + portal.health + '</td>'
html += '<td>' + (portal.teamN!=TEAM_NONE?portal.health+'%':'-') + '</td>'
+ '<td>' + portal.resCount + '</td>'
+ '<td title="In: ' + portal.link.in.length + ' Out: ' + portal.link.out.length + '">' + (portal.linkCount?portal.linkCount:'-') + '</td>'
+ '<td class="help" title="In: ' + portal.link.in.length + ' Out: ' + portal.link.out.length + '">' + (portal.linkCount?portal.linkCount:'-') + '</td>'
+ '<td>' + (portal.fieldCount?portal.fieldCount:'-') + '</td>';
var apTitle = '';
if (PLAYER.team == portal.team) {
apTitle += 'Friendly AP:\t'+portal.ap.friendlyAp+'\n'
+ '- deploy '+(8-portal.resCount)+' resonator(s)\n'
+ '- upgrades/mods unknown\n';
}
apTitle += 'Enemy AP:\t'+portal.ap.enemyAp+'\n'
+ '- Destroy AP:\t'+portal.ap.destroyAp+'\n'
+ '- Capture AP:\t'+portal.ap.captureAp;
html += '<td class="help apGain" title="' + apTitle + '">' + digits(portal.ap.enemyAp) + '</td>';
html+= '</tr>';
rowNum++;
@ -229,15 +246,14 @@ window.plugin.portalslist.getPortalLink = function(portal,guid) {
//Use Jquery to create the link, which escape characters in TITLE and ADDRESS of portal
var a = $('<a>',{
"class": 'help',
text: portal.name,
title: portal.name,
href: perma,
onClick: jsSingleClick,
onDblClick: jsDoubleClick
})[0].outerHTML;
var div = '<div class="portalTitleTruncate">'+a+'</div>';
return div;
return a;
}
window.plugin.portalslist.onPaneChanged = function(pane) {
@ -257,7 +273,7 @@ var setup = function() {
$('head').append('<style>' +
'#portalslist.mobile {background: transparent; border: 0 none !important; height: 100% !important; width: 100% !important; left: 0 !important; top: 0 !important; position: absolute; overflow: auto; }' +
'#portalslist table {margin-top:5px; border-collapse: collapse; empty-cells: show; width:100%; clear: both;}' +
'#portalslist table { margin-top:5px; border-collapse: collapse; empty-cells: show; width: 100%; clear: both; }' +
'#portalslist table td, #portalslist table th {border-bottom: 1px solid #0b314e; padding:3px; color:white; background-color:#1b415e}' +
'#portalslist table tr.res td { background-color: #005684; }' +
'#portalslist table tr.enl td { background-color: #017f01; }' +
@ -267,12 +283,13 @@ var setup = function() {
'#portalslist table td.portalTitle { text-align: left;}' +
'#portalslist table th.sortable { cursor:pointer;}' +
'#portalslist table th.portalTitle { text-align: left;}' +
'#portalslist table .portalTitle { min-width: 160px !important; max-width: 240px !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }' +
'#portalslist table .apGain { text-align: right !important; }' +
'#portalslist .sorted { color:#FFCE00; }' +
'#portalslist .filterAll { margin-top: 10px;}' +
'#portalslist .filterRes { margin-top: 10px; background-color: #005684 }' +
'#portalslist .filterEnl { margin-top: 10px; background-color: #017f01 }' +
'#portalslist .disclaimer { margin-top: 10px; font-size:10px; }' +
'#portalslist .portalTitleTruncate { display: inline-block; width: 240px !important; min-width: 240px !important; max-width: 160px !important; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }' +
'</style>');
// Setup sorting