diff --git a/plugins/compute-ap-stats.user.js b/plugins/compute-ap-stats.user.js
index 3c0e8bd7..6618801d 100644
--- a/plugins/compute-ap-stats.user.js
+++ b/plugins/compute-ap-stats.user.js
@@ -21,9 +21,29 @@ if(typeof window.plugin !== 'function') window.plugin = function() {};
window.plugin.compAPStats = function() {};
window.plugin.compAPStats.setupCallback = function() {
- $('#toolbox').append('Compute AP Stats ');
+ // add a new div to the bottom of the sidebar and style it
+ $('#sidebar').append("
");
+ $('#available_ap_display').css({'color':'yellow', 'font-size':'90%', 'padding':'4px 2px'});
+
+ // do an initial calc for sizing purposes
+ window.plugin.compAPStats.onPositionMove();
+
+ //redefine the max size of the sidebar so its actually visible
+ $('#scrollwrapper').css('max-height', ($('#sidebar').get(0).scrollHeight+3) + 'px');
+
+ //make the value update on map position changes
+ map.on('moveend zoomend', window.plugin.compAPStats.onPositionMove);
}
+window.plugin.compAPStats.onPositionMove = function() {
+ $('#available_ap_display').empty();
+ $('#available_ap_display').append('Available AP in this area:
');
+ var result = window.plugin.compAPStats.compAPStats();
+ $('#available_ap_display').append(' Enlightened:\t' + digits(result[1]) + '
');
+ $('#available_ap_display').append(' Resistance:\t' + digits(result[0]));
+}
+
+
window.plugin.compAPStats.compAPStats = function() {
var totalAP_RES = 0;
@@ -34,7 +54,6 @@ window.plugin.compAPStats.compAPStats = function() {
var allEnlEdges = [];
var allEnlFields = [];
-
// Grab every portal in the viewable area and compute individual AP stats
$.each(window.portals, function(ind, portal) {
var d = portal.options.details;
@@ -89,18 +108,6 @@ window.plugin.compAPStats.compAPStats = function() {
return [totalAP_RES, totalAP_ENL];
}
-window.plugin.compAPStats.guess = function() {
- var res = window.plugin.compAPStats.compAPStats();
- var totalAP_RES = res[0];
- var totalAP_ENL = res[1];
-
- var s = 'Calculated AP gain potential:\n\n';
- s += 'Available Resistance AP:\t' + digits(totalAP_RES) + '\n';
- s += 'Available Enlightened AP:\t' + digits(totalAP_ENL) + '\n';
-
- alert(s);
-}
-
var setup = function() {
window.plugin.compAPStats.setupCallback();
}
diff --git a/style.css b/style.css
index 8a110b96..fbb6dead 100644
--- a/style.css
+++ b/style.css
@@ -609,7 +609,7 @@ aside {
* content when first selecting a portal) */
#portaldetails {
- min-height: 553px;
+ min-height: 569px;
}