diff options
Diffstat (limited to 'public/join.js')
-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()) |