From 3396cc7a2746d510e019e39415be308087a5788f Mon Sep 17 00:00:00 2001 From: fkloft Date: Tue, 23 Jun 2015 20:03:09 +0200 Subject: [PATCH] Set title in genFourColumnTable --- code/portal_detail_display_tools.js | 68 ++++++++++++----------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js index 849cb35ac..10daac5a4 100644 --- a/code/portal_detail_display_tools.js +++ b/code/portal_detail_display_tools.js @@ -12,14 +12,15 @@ window.getRangeText = function(d) { if(!range.isLinkable) title += '\nPortal is missing resonators,\nno new links can be made'; - return ['range', + return ['range', '' + + '>' + (range.range > 1000 ? Math.floor(range.range/1000) + ' km' : Math.floor(range.range) + ' m') - + '']; + + '', + title]; } // generates description text from details for portal @@ -151,9 +152,9 @@ window.getModDetails = function(d) { window.getEnergyText = function(d) { var currentNrg = getCurrentPortalEnergy(d); var totalNrg = getTotalPortalEnergy(d); - var inf = currentNrg + ' / ' + totalNrg; + var title = currentNrg + ' / ' + totalNrg; var fill = prettyEnergy(currentNrg) + ' / ' + prettyEnergy(totalNrg) - return ['energy', '' + fill + '']; + return ['energy', fill, title]; } @@ -237,22 +238,19 @@ window.getAttackApGainText = function(d,fieldCount,linkCount) { var breakdown = getAttackApGain(d,fieldCount,linkCount); var totalGain = breakdown.enemyAp; - function tt(text) { - var t = ''; - if (teamStringToId(PLAYER.team) == teamStringToId(d.team)) { - totalGain = breakdown.friendlyAp; - t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n'; - t += ' Deploy ' + breakdown.deployCount + ', '; - t += 'Upgrade ' + breakdown.upgradeCount + '\n'; - t += '\n'; - } - t += 'Enemy AP:\t' + breakdown.enemyAp + '\n'; - t += ' Destroy AP:\t' + breakdown.destroyAp + '\n'; - t += ' Capture AP:\t' + breakdown.captureAp + '\n'; - return '' + text + ''; + var t = ''; + if (teamStringToId(PLAYER.team) == teamStringToId(d.team)) { + totalGain = breakdown.friendlyAp; + t += 'Friendly AP:\t' + breakdown.friendlyAp + '\n'; + t += ' Deploy ' + breakdown.deployCount + ', '; + t += 'Upgrade ' + breakdown.upgradeCount + '\n'; + t += '\n'; } + t += 'Enemy AP:\t' + breakdown.enemyAp + '\n'; + t += ' Destroy AP:\t' + breakdown.destroyAp + '\n'; + t += ' Capture AP:\t' + breakdown.captureAp + '\n'; - return [tt('AP Gain'), tt(digits(totalGain))]; + return ['AP Gain', digits(totalGain), t]; } @@ -261,16 +259,12 @@ window.getHackDetailsText = function(d) { var shortHackInfo = hackDetails.hacks+' @ '+formatInterval(hackDetails.cooldown); - function tt(text) { - var t = 'Hacks available every 4 hours\n'; - t += 'Hack count:\t'+hackDetails.hacks+'\n'; - t += 'Cooldown time:\t'+formatInterval(hackDetails.cooldown)+'\n'; - t += 'Burnout time:\t'+formatInterval(hackDetails.burnout)+'\n'; - - return ''+text+''; - } + var title = 'Hacks available every 4 hours\n' + + 'Hack count:\t'+hackDetails.hacks+'\n' + + 'Cooldown time:\t'+formatInterval(hackDetails.cooldown)+'\n' + + 'Burnout time:\t'+formatInterval(hackDetails.burnout); - return [tt('hacks'), tt(shortHackInfo)]; + return ['hacks', shortHackInfo, title]; } @@ -280,16 +274,12 @@ window.getMitigationText = function(d,linkCount) { var mitigationShort = mitigationDetails.total; if (mitigationDetails.excess) mitigationShort += ' (+'+mitigationDetails.excess+')'; - function tt(text) { - var t = 'Total shielding:\t'+(mitigationDetails.shields+mitigationDetails.links)+'\n' - + '- active:\t'+mitigationDetails.total+'\n' - + '- excess:\t'+mitigationDetails.excess+'\n' - + 'From\n' - + '- shields:\t'+mitigationDetails.shields+'\n' - + '- links:\t'+mitigationDetails.links; - - return ''+text+''; - } + var title = 'Total shielding:\t'+(mitigationDetails.shields+mitigationDetails.links)+'\n' + + '- active:\t'+mitigationDetails.total+'\n' + + '- excess:\t'+mitigationDetails.excess+'\n' + + 'From\n' + + '- shields:\t'+mitigationDetails.shields+'\n' + + '- links:\t'+mitigationDetails.links; - return [tt('shielding'), tt(mitigationShort)]; + return ['shielding', mitigationShort, title]; }