diff --git a/plugins/dynamic-scoreboard.user.js b/plugins/dynamic-scoreboard.user.js index 90a8efad..3468f25f 100644 --- a/plugins/dynamic-scoreboard.user.js +++ b/plugins/dynamic-scoreboard.user.js @@ -42,7 +42,7 @@ function wrapper(plugin_info) { var displayBounds = map.getBounds(); - //variable declaration and set to zero + window.plugin.scoreboard.enlP = 0; window.plugin.scoreboard.resP = 0; window.plugin.scoreboard.enlEightLevelP = 0; @@ -55,7 +55,7 @@ function wrapper(plugin_info) { window.plugin.scoreboard.healthRes = 0; - //get all portals on screen + //get all portals on screen $.each(window.portals, function(i, portal) { // eliminate offscreen portals (selected, and in padding) if(!displayBounds.contains(portal.getLatLng())) return true; @@ -64,18 +64,19 @@ function wrapper(plugin_info) { //variable that contains portal data var d = portal.options.data; + //variable that contains each portal's team value var teamN = portal.options.team; switch (teamN) { - case TEAM_RES: //if the portal is captured by the resistance,increase each counter's value for resistance counters + case TEAM_RES: //if the portal is captured by the resistance,increase each counter's value for resistance counters window.plugin.scoreboard.healthRes += d.health; window.plugin.scoreboard.resP++; window.plugin.scoreboard.resPorLevels = window.plugin.scoreboard.resPorLevels + portal.options.level; if(portal.options.level===8){window.plugin.scoreboard.resEightLevelP++;} if(portal.options.level>window.plugin.scoreboard.maxRes){window.plugin.scoreboard.maxRes = portal.options.level;} break; - case TEAM_ENL: //if the portal is captured by the enlightened,increase each counter's value for resistance counters + case TEAM_ENL: //if the portal is captured by the enlightened,increase each counter's value for enlightened counters window.plugin.scoreboard.healthEnl += d.health; window.plugin.scoreboard.enlP++; window.plugin.scoreboard.enlPorLevels = window.plugin.scoreboard.enlPorLevels + portal.options.level; @@ -93,9 +94,11 @@ function wrapper(plugin_info) { return retval; } - - - //---- function that gets all visible enlightened links on screen + + + + + //---- function that gets all visible enlightened links on screen window.plugin.scoreboard.getEnlLinks = function() { var displayBounds = map.getBounds(); @@ -112,8 +115,7 @@ function wrapper(plugin_info) { }); return window.plugin.scoreboard.enlL; } - - //----function that gets all visible resistance links on screen + //----function that gets all visible resistance links on screen window.plugin.scoreboard.getResLinks = function() { var displayBounds = map.getBounds(); @@ -134,7 +136,7 @@ function wrapper(plugin_info) { - //----function that gets all visible enlightened fields on screen + //----function that gets all visible enlightened fields on screen window.plugin.scoreboard.getEnlFields = function() { var displayBounds = map.getBounds(); @@ -153,7 +155,7 @@ function wrapper(plugin_info) { } - //----function that gets all visible resistance fields on screen + //----function that gets all visible resistance fields on screen window.plugin.scoreboard.getResFields = function() { var displayBounds = map.getBounds(); @@ -171,10 +173,80 @@ function wrapper(plugin_info) { return window.plugin.scoreboard.resF; } - //----------------------------------------------------------- + // A function that creates the html code for the scoreboard table + - var setup = function() { - if(window.useAndroidPanes()) { // use android panes,texture and style + window.plugin.scoreboard.portalTable = function() { + + + // html variable declaration + var html = ""; + // Create the header + html += '
Metrics | ' + + 'Enlightened | ' + + 'Resistance | ' + + '
---|---|---|
Number of Portals | '+'' + +window.plugin.scoreboard.enlP+' | '+''+window.plugin.scoreboard.resP+' |
Average Portal Level | '+'' + +avgEnl+' | '+''+avgRes+' |
Number of Level 8 Portals | '+'' + +window.plugin.scoreboard.enlEightLevelP+' | '+''+window.plugin.scoreboard.resEightLevelP+' |
Max Portal Level | '+'' + +window.plugin.scoreboard.maxEnl+' | '+''+window.plugin.scoreboard.maxRes+' |
Number of Links | '+'' + +enlCountOfLinks+' | '+''+resCountOfLinks+' |
Number of Fields | '+'' + +enlCountOfFields+' | '+''+resCountOfFields+' |
Average portal Health | '+'' + +avgHealthEnl+'% | '+''+avgHealthRes+'% |