From d093a7f4c2955eb47bf02aeaab8f701753e34984 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sat, 15 Apr 2017 18:40:19 +0300 Subject: [PATCH] Reset notification markers on document focus Fixes #837 --- client/js/lounge.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 83d7441b..ecbe493d 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -1595,14 +1595,11 @@ $(function() { $("#viewport .lt").toggleClass("notified", newState); } - document.addEventListener( - "visibilitychange", - function() { - if (sidebar.find(".highlight").length === 0) { - toggleNotificationMarkers(false); - } + $(document).on("visibilitychange focus", () => { + if (sidebar.find(".highlight").length === 0) { + toggleNotificationMarkers(false); } - ); + }); // Only start opening socket.io connection after all events have been registered socket.open();