diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-07-14 15:58:39 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-07-14 15:58:39 +0200 |
commit | 11944e43b67c079ccb1ec398e468b2d774b9ec40 (patch) | |
tree | e1e79b2330fc558def3965bd92f53639a18147b8 /public | |
parent | 61d7cd7f72b53bb7f964c306797569d248797049 (diff) | |
download | server-11944e43b67c079ccb1ec398e468b2d774b9ec40.tar.gz |
Stop blinking READY TO START when window is in focus.
Diffstat (limited to 'public')
-rw-r--r-- | public/join.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/public/join.js b/public/join.js index 19efcde..4c2b0a8 100644 --- a/public/join.js +++ b/public/join.js @@ -14,13 +14,16 @@ let blink_title = document.title; let blink_timer = 0; function start_blinker(message) { - let tick = true; + let tick = false; if (blink_timer) stop_blinker(); - blink_timer = setInterval(function () { - document.title = tick ? message : blink_title; - tick = !tick; - }, 1000); + if (!document.hasFocus()) { + document.title = message; + blink_timer = setInterval(function () { + document.title = tick ? message : blink_title; + tick = !tick; + }, 1000); + } } function stop_blinker() { @@ -29,6 +32,8 @@ function stop_blinker() { blink_timer = 0; } +window.addEventListener("focus", stop_blinker); + function send(url) { fetch(url) .then(r => r.text()) |