aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/nextcloud-talk
diff options
context:
space:
mode:
authorLibravatar Edgars <Edgars+GitHub@gaitenis.id.lv>2020-11-11 10:14:02 +0200
committerLibravatar Edgars <Edgars+GitHub@gaitenis.id.lv>2020-11-11 10:14:02 +0200
commit8b7e59d64dc080f8b5c2d91b72aade4545d26c49 (patch)
tree68e462cba2eb7b08a590c214f331d7339079db5b /recipes/nextcloud-talk
parentNextcloud Talk: Hide unrelated notifications and fix notifications count (diff)
downloadferdium-recipes-8b7e59d64dc080f8b5c2d91b72aade4545d26c49.tar.gz
ferdium-recipes-8b7e59d64dc080f8b5c2d91b72aade4545d26c49.tar.zst
ferdium-recipes-8b7e59d64dc080f8b5c2d91b72aade4545d26c49.zip
Nextcloud Talk: Fine-tuning for `webview.js`
`webview.js` was updated to get direct notifications count only when notification wrapper has been loaded.
Diffstat (limited to 'recipes/nextcloud-talk')
-rw-r--r--recipes/nextcloud-talk/webview.js17
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
9module.exports = Ferdi => { 9module.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);