Plugin AP List: Add stats tooltip to show total AP, average EL of selected portals.
This commit is contained in:
parent
e14baa9f3f
commit
023c1d3ec8
@ -93,9 +93,8 @@
|
||||
}
|
||||
|
||||
.ap-list-center-div {
|
||||
width: 50%;
|
||||
width: 55%;
|
||||
margin: 0px auto;
|
||||
|
||||
}
|
||||
|
||||
.ap-list-page-control {
|
||||
@ -146,3 +145,14 @@
|
||||
.ap-list-triangle-right-full {
|
||||
border-width: 7.5px 0px 7.5px 13px;
|
||||
}
|
||||
#ap-list-pagination {
|
||||
display: inline-block;
|
||||
width: 90%;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#ap-list-misc-info {
|
||||
display: inline-block;
|
||||
vertical-align: bottom;
|
||||
padding: 0px 6px;
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ window.plugin.apList.updatePortalTable = function(side) {
|
||||
$('div#ap-list-table').html(table);
|
||||
|
||||
plugin.apList.updatePaginationControl();
|
||||
plugin.apList.updateStats();
|
||||
}
|
||||
|
||||
window.plugin.apList.tableHeaderBuilder = function(side) {
|
||||
@ -169,7 +170,7 @@ window.plugin.apList.getPortalApTitle = function(portal) {
|
||||
|
||||
window.plugin.apList.getPortalEffectiveLvText = function(portal) {
|
||||
var title = plugin.apList.getPortalEffectiveLvTitle(portal);
|
||||
return '<div class="help" title="' + title + '">' + portal.effectiveLevel.effectiveLevel + '</div>';
|
||||
return '<div class="help" title="' + title + '">' + portal.effectiveLevel.effectiveLevel.toFixed(1) + '</div>';
|
||||
}
|
||||
|
||||
window.plugin.apList.getPortalEffectiveLvTitle = function(portal) {
|
||||
@ -211,6 +212,28 @@ window.plugin.apList.updatePaginationControl = function() {
|
||||
$('#ap-list-total-p').html(plugin.apList.totalPage[plugin.apList.displaySide]);
|
||||
}
|
||||
|
||||
window.plugin.apList.updateStats = function() {
|
||||
var destroyPortals = plugin.apList.destroyPortalsGuid.length;
|
||||
if(destroyPortals === 0) {
|
||||
title = 'Stats';
|
||||
} else {
|
||||
var destroyAP = 0;
|
||||
var averageEL = 0;
|
||||
$.each(plugin.apList.destroyPortalsGuid, function(ind,guid) {
|
||||
destroyAP += plugin.apList.cachedPortals[guid].playerApGain.totalAp;
|
||||
averageEL += plugin.apList.cachedPortals[guid].effectiveLevel.effectiveLevel;
|
||||
});
|
||||
averageEL = Math.round(averageEL / destroyPortals * 10) / 10;
|
||||
|
||||
var title = 'Stats\n'
|
||||
+ 'Selected portal(s)\t=\t' + destroyPortals + '\n'
|
||||
+ 'Total AP\t=\t' + destroyAP + '\n'
|
||||
+ 'Average EL\t=\t' + averageEL;
|
||||
}
|
||||
|
||||
$('#ap-list-misc-info').attr('title', title);
|
||||
}
|
||||
|
||||
// MAIN LOGIC FUNCTIONS //////////////////////////////////////////////////////////
|
||||
|
||||
// Loop through portals and get playerApGain, then put in sortedPortals by side and sort them by AP.
|
||||
@ -498,10 +521,10 @@ window.plugin.apList.getEffectiveLevel = function(portal) {
|
||||
}
|
||||
|
||||
return {
|
||||
effectiveLevel: effectiveLevel.toFixed(1),
|
||||
effectiveLevel: Math.round(effectiveLevel * 10) / 10,
|
||||
effectiveEnergy: parseInt(effectiveEnergy),
|
||||
effectOfShields: effectOfShields.toFixed(2),
|
||||
effectOfResoDistance: effectOfResoDistance.toFixed(2),
|
||||
effectOfShields: Math.round(effectOfShields * 100) / 100,
|
||||
effectOfResoDistance: Math.round(effectOfResoDistance * 100) / 100,
|
||||
originLevel: portalLevel
|
||||
};
|
||||
}
|
||||
@ -821,7 +844,8 @@ window.plugin.apList.setupList = function() {
|
||||
+ 'plugin.apList.hideReloadLabel();return false;">↻ R</a>'
|
||||
+ '</span>'
|
||||
+ '<div id="ap-list-table"></div>'
|
||||
+ '<div id="ap-list-pagination"></div>'
|
||||
+ '<span id="ap-list-misc-info" title="Stats">...</span>'
|
||||
+ '<span id="ap-list-pagination"></span>'
|
||||
+ '</div>';
|
||||
|
||||
$('#sidebar').append(content);
|
||||
|
Loading…
x
Reference in New Issue
Block a user