summaryrefslogtreecommitdiff
path: root/public/join.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-06-27 13:50:05 +0200
committerTor Andersson <tor@ccxvii.net>2021-06-27 18:12:15 +0200
commitdd165d03e95f252150a94fc27d0280551d7e041b (patch)
tree7f3214fc66a94f1ad686ed491150c04a351c687d /public/join.js
parente6256c972ec68ae5ef45123a7414674c7afa89a1 (diff)
downloadserver-dd165d03e95f252150a94fc27d0280551d7e041b.tar.gz
Blink title when game is ready to start.
Diffstat (limited to 'public/join.js')
-rw-r--r--public/join.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/public/join.js b/public/join.js
index f69879e..d2d39ab 100644
--- a/public/join.js
+++ b/public/join.js
@@ -9,6 +9,25 @@ function confirm_delete(status) {
window.location.href = "/delete/" + game.game_id;
}
+let blink_title = document.title;
+let blink_timer = 0;
+
+function start_blinker(message) {
+ let tick = true;
+ if (blink_timer)
+ stop_blinker();
+ blink_timer = setInterval(function () {
+ document.title = tick ? message : blink_title;
+ tick = !tick;
+ }, 1000);
+}
+
+function stop_blinker() {
+ document.title = blink_title;
+ clearInterval(blink_timer);
+ blink_timer = 0;
+}
+
function send(url) {
fetch(url)
.then(r => r.text())
@@ -105,6 +124,11 @@ function update() {
window.start_button.classList = (game.status === 0) ? "" : "hide";
window.delete_button.classList = (game.status === 0 || solo) ? "" : "hide";
}
+
+ if (game.status === 0 && ready)
+ start_blinker("READY TO START");
+ else
+ stop_blinker();
}
window.onload = function () {