diff options
Diffstat (limited to 'recipes/nextcloud-talk/webview.js')
-rw-r--r-- | recipes/nextcloud-talk/webview.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js index 42b1e49..0dfb6ea 100644 --- a/recipes/nextcloud-talk/webview.js +++ b/recipes/nextcloud-talk/webview.js | |||
@@ -8,17 +8,22 @@ function _interopRequireDefault(obj) { | |||
8 | 8 | ||
9 | module.exports = Ferdi => { | 9 | module.exports = Ferdi => { |
10 | const getMessages = function getMessages() { | 10 | const getMessages = function getMessages() { |
11 | const direct = document.querySelector( | 11 | let direct = 0; |
12 | const notificationWrapper = document.querySelector( | ||
12 | '.notifications .notification-wrapper' | 13 | '.notifications .notification-wrapper' |
13 | ).querySelectorAll( | 14 | ); |
14 | '.notification[object_type="chat"], .notification[object_type="room"' | 15 | |
15 | ).length; | 16 | if (notificationWrapper) { |
17 | direct = notificationWrapper.querySelectorAll( | ||
18 | '.notification[object_type="chat"], .notification[object_type="room"' | ||
19 | ).length; | ||
20 | } | ||
16 | 21 | ||
17 | var indirect = 0; | 22 | let indirect = 0; |
18 | 23 | ||
19 | document.querySelectorAll('.app-navigation-entry__counter').forEach( | 24 | document.querySelectorAll('.app-navigation-entry__counter').forEach( |
20 | function(counter) { | 25 | function(counter) { |
21 | indirect += Number(counter.textContent) | 26 | indirect += Number(counter.textContent); |
22 | } | 27 | } |
23 | ); | 28 | ); |
24 | Ferdi.setBadge(direct, indirect); | 29 | Ferdi.setBadge(direct, indirect); |