From f530874dc00dcd1a11d92c705a28c4bcf0d2aab5 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 9 Apr 2016 06:21:07 -0400 Subject: [PATCH] Use favicon-notify for unread notifications I actually made favicon-notify around 4 years ago, even predating when we moved to Git for the client repo. Unfortunately, at the time, a Chrome bug made it not work, so I gave up on it back then and decided web notifications would be enough. I've missed enough notifications to know that having both would be better, and all the relevant browser bugs have been fixed so this can be implemented the easy way. --- js/client-topbar.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/client-topbar.js b/js/client-topbar.js index c1920c8ac..83d82fbf3 100644 --- a/js/client-topbar.js +++ b/js/client-topbar.js @@ -130,6 +130,17 @@ } if (window.nodewebkit) { if (nwWindow.setBadgeLabel) nwWindow.setBadgeLabel(notificationCount || ''); + } else { + var $favicon = $('#dynamic-favicon'); + if (!!$favicon.data('on') !== !!notificationCount) { + if (notificationCount) { + $favicon.attr('href', Tools.resourcePrefix + '/favicon-notify.ico'); + $favicon.data('on', '1'); + } else { + $favicon.attr('href', Tools.resourcePrefix + '/favicon.ico'); + $favicon.data('on', ''); + } + } } sideBuf += this.renderRoomTab(app.rooms['rooms'], 'rooms'); var margin = 0;