about summary refs log tree commit diff
path: root/hosted/stats.js
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2019-10-11 14:53:34 +0200
committermaride <maride@darknebu.la>2019-10-11 14:53:34 +0200
commitf822befed9f4b39f76993adb2376d694023868bf (patch)
tree42134d3d9c08ab830d02cc174a637358d4d61d20 /hosted/stats.js
parent92d20710d7cbad0781d04d45ee859a1d66b30b0d (diff)
Display current team score on the website
Diffstat (limited to 'hosted/stats.js')
-rw-r--r--hosted/stats.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/hosted/stats.js b/hosted/stats.js
new file mode 100644
index 0000000..f82368f
--- /dev/null
+++ b/hosted/stats.js
@@ -0,0 +1,12 @@
+function loadStatsAndRender() {
+    $.get("/api/getStats").done(function(data) {
+        var result = jQuery.parseJSON(data);
+        $("#_teamScore").text(result["score"]);
+        // Re-run in 10s
+        setTimeout(function(){loadStatsAndRender();}, 10000);
+    });
+}
+
+$(document).ready(function() {
+    loadStatsAndRender();
+});
\ No newline at end of file