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.js28
1 files changed, 22 insertions, 6 deletions
diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js
index c180d4d..0dfb6ea 100644
--- a/recipes/nextcloud-talk/webview.js
+++ b/recipes/nextcloud-talk/webview.js
@@ -6,13 +6,29 @@ function _interopRequireDefault(obj) {
6 return obj && obj.__esModule ? obj : { default: obj }; 6 return obj && obj.__esModule ? obj : { default: obj };
7} 7}
8 8
9module.exports = Franz => { 9module.exports = Ferdi => {
10 const getMessages = function getMessages() { 10 const getMessages = function getMessages() {
11 const direct = document.querySelectorAll('.app-navigation-entry-utils-counter.highlighted').length; 11 let direct = 0;
12 const indirect = document.querySelectorAll('.app-navigation-entry-utils-counter:not(.highlighted)').length; 12 const notificationWrapper = document.querySelector(
13 Franz.setBadge(direct, indirect); 13 '.notifications .notification-wrapper'
14 );
15
16 if (notificationWrapper) {
17 direct = notificationWrapper.querySelectorAll(
18 '.notification[object_type="chat"], .notification[object_type="room"'
19 ).length;
20 }
21
22 let indirect = 0;
23
24 document.querySelectorAll('.app-navigation-entry__counter').forEach(
25 function(counter) {
26 indirect += Number(counter.textContent);
27 }
28 );
29 Ferdi.setBadge(direct, indirect);
14 }; 30 };
15 31
16 Franz.loop(getMessages); 32 Ferdi.loop(getMessages);
17 Franz.injectCSS(_path.default.join(__dirname, 'service.css')); 33 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
18}; 34};