forked from meetfranz/recipe-nextcloud-talk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebview.js
More file actions
28 lines (23 loc) · 733 Bytes
/
webview.js
File metadata and controls
28 lines (23 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import path from 'path';
module.exports = (Franz) => {
const getMessages = function getMessages() {
let direct = 0;
const notificationWrapper = document.querySelector(
'.notifications .notification-wrapper'
);
if (notificationWrapper) {
direct = notificationWrapper.querySelectorAll(
'.notification[object_type="chat"], .notification[object_type="room"'
).length;
}
let indirect = 0;
document.querySelectorAll('.app-navigation-entry__counter').forEach(
function(counter) {
indirect += Number(counter.textContent);
}
);
Franz.setBadge(direct, indirect);
};
Franz.loop(getMessages);
Franz.injectCSS(path.join(__dirname, 'service.css'));
};