aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/nextcloud-talk/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/nextcloud-talk/webview.js')
-rw-r--r--recipes/nextcloud-talk/webview.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js
index 1ae3783..77b969b 100644
--- a/recipes/nextcloud-talk/webview.js
+++ b/recipes/nextcloud-talk/webview.js
@@ -5,21 +5,24 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
5module.exports = Ferdium => { 5module.exports = Ferdium => {
6 const getMessages = () => { 6 const getMessages = () => {
7 let direct = 0; 7 let direct = 0;
8
8 const notificationWrapper = document.querySelector( 9 const notificationWrapper = document.querySelector(
9 '.notifications .notification-wrapper', 10 '.notifications .notification-wrapper',
10 ); 11 );
11 12
12 if (notificationWrapper) { 13 if (notificationWrapper) {
13 direct = notificationWrapper.querySelectorAll( 14 const directSelector = notificationWrapper.querySelectorAll(
14 '.notification[object_type="chat"], .notification[object_type="room"]', 15 '.notification[object_type="chat"], .notification[object_type="room"]',
15 ).length; 16 );
17 direct = directSelector ? Ferdium.safeParseInt(directSelector.length) : 0;
16 } 18 }
17 19
18 let indirect = 0; 20 let indirect = 0;
19 21
20 for (const counter of document.querySelectorAll('.app-navigation-entry__counter')) { 22 for (const counter of document.querySelectorAll('.app-navigation-entry__counter')) {
21 indirect += Number(counter.textContent); 23 const entryCounter = Ferdium.safeParseInt(counter.textContent) : 0;
22 } 24 indirect += entryCounter;
25 }
23 26
24 if (document.title.startsWith("*")) { 27 if (document.title.startsWith("*")) {
25 indirect++; 28 indirect++;