diff --git a/code/region_scoreboard.js b/code/region_scoreboard.js
new file mode 100644
index 00000000..1fcf016d
--- /dev/null
+++ b/code/region_scoreboard.js
@@ -0,0 +1,60 @@
+
+
+window.regionScoreboard = function() {
+ // TODO: rather than just load the region scores for the center of the map, display a list of regions in the current view
+ // and let the user select one (with automatic selection when just one region, and limited to close enough zooms so list size is reasonable)
+ var latLng = map.getCenter();
+
+ var latE6 = Math.round(latLng.lat*1E6);
+ var lngE6 = Math.round(latLng.lng*1E6);
+
+ window.postAjax('getRegionScoreDetails', {latE6:latE6,lngE6:lngE6}, regionScoreboardSuccess, regionScoreboardFailure);
+}
+
+function regionScoreboardFailure() {
+ dialog({
+ title: 'Error loading region scores',
+ text: 'Failed to load region scores - try again'
+ });
+
+}
+
+function regionScoreboardSuccess(data) {
+ if (data.result === undefined) {
+ return regionScoreboardFailure();
+ }
+
+
+ var checkpointTable = '
# | Enlightened | Resistance |
';
+ for (var i=0; i'+data.result.scoreHistory[i][0]+' | '+data.result.scoreHistory[i][1]+' | '+data.result.scoreHistory[i][2]+' | ';
+ }
+ if (data.result.scoreHistory.length == 0) {
+ checkpointTable += 'no checkpoint data |
';
+ }
+ checkpointTable += '
';
+
+
+ var agentTable = '# | Agent |
';
+ for (var i=0; i'+(i+1)+' | '+agent.nick+' '+agent.team+' | ';
+ }
+ if (data.result.topAgents.length==0) {
+ agentTable += 'no top agents |
';
+ }
+ agentTable += '
';
+
+
+ dialog({
+ title: 'Region scores for '+data.result.regionName,
+ html: 'Region scores for '+data.result.regionName+''
+ +'Ehlightened | Resistance |
---|
'+data.result.gameScore[0]+' | '+data.result.gameScore[1]+' |
'
+ +'Checkpoint history'
+ +checkpointTable
+ +'Top agents'
+ +agentTable,
+ width: 600
+ });
+
+}
diff --git a/main.js b/main.js
index 52a17e35..f9de23df 100644
--- a/main.js
+++ b/main.js
@@ -100,6 +100,7 @@ document.getElementsByTagName('body')[0].innerHTML = ''
+ ' '
+ ' '
+ ''