From 86edcc06c2974c48106a1069886b82d0c58c281a Mon Sep 17 00:00:00 2001 From: ody Date: Tue, 10 Nov 2015 22:25:52 +0200 Subject: [PATCH] Add updating of window title on launch The window title show the number of global unread messages when the inbox window launches. --- js/panel_controller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/panel_controller.js b/js/panel_controller.js index fc6556efb..53d9a3db4 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -43,6 +43,10 @@ appWindow = windowInfo; inboxWindowId = appWindow.id; + appWindow.contentWindow.addEventListener('load', function() { + setUnreadCount(storage.get("unreadCount", 0)); + }); + appWindow.onClosed.addListener(function () { inboxOpened = false; appWindow = null; @@ -75,13 +79,11 @@ if (count > 0) { extension.navigator.setBadgeText(count); if (inboxOpened === true) { - var appWindow = chrome.app.window.get(inboxWindowId); appWindow.contentWindow.document.title = "Signal (" + count + ")"; } } else { extension.navigator.setBadgeText(""); if (inboxOpened === true) { - var appWindow = chrome.app.window.get(inboxWindowId); appWindow.contentWindow.document.title = "Signal"; } }