diff --git a/code/portal_detail_display.js b/code/portal_detail_display.js
index 2187b34b..d9d308d9 100644
--- a/code/portal_detail_display.js
+++ b/code/portal_detail_display.js
@@ -66,6 +66,7 @@ window.renderPortalDetails = function(guid) {
+ '
'
+ '
'
+ '
'
diff --git a/code/portal_detail_display_tools.js b/code/portal_detail_display_tools.js
index b02d40be..42cf0c95 100644
--- a/code/portal_detail_display_tools.js
+++ b/code/portal_detail_display_tools.js
@@ -131,3 +131,25 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
var text = '
'+(nick||'')+'';
return (slot <= 3 ? text+meter : meter+text) + '
';
}
+
+// calculate AP gain from destroying portal
+// so far it counts only resonators + links
+window.getDestroyAP = function(d) {
+ console.log('rendering destroy AP');
+ var res_count = 0;
+ var links = 0;
+
+ $.each(d.resonatorArray.resonators, function(ind, reso)
+ {
+ res_count += 1;
+ });
+
+ if(d.portalV2.linkedEdges) $.each(d.portalV2.linkedEdges, function(ind, link)
+ {
+ links++;
+ });
+
+ var ap_count = (res_count * DESTROY_RESONATOR) + (links * DESTROY_LINK);
+
+ return 'Destroy ' + res_count + 'x res + ' + links + 'x link ->
' + ap_count + 'AP';
+}
diff --git a/main.js b/main.js
index f34165eb..b99017df 100644
--- a/main.js
+++ b/main.js
@@ -128,6 +128,8 @@ var MIN_AP_FOR_LEVEL = [0, 10000, 30000, 70000, 150000, 300000, 600000, 1200000]
var HACK_RANGE = 35; // in meters, max. distance from portal to be able to access it
var OCTANTS = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE'];
var DEFAULT_PORTAL_IMG = 'http://commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
+var DESTROY_RESONATOR = 75; //AP for destroying portal
+var DESTROY_LINK = 187; //AP fro destroying link
// OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=';