aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/nextcloud-calendar/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/nextcloud-calendar/webview.js')
-rw-r--r--recipes/nextcloud-calendar/webview.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/recipes/nextcloud-calendar/webview.js b/recipes/nextcloud-calendar/webview.js
index 2755cab..3ff240f 100644
--- a/recipes/nextcloud-calendar/webview.js
+++ b/recipes/nextcloud-calendar/webview.js
@@ -5,18 +5,19 @@ function _interopRequireDefault(obj) {
5const _path = _interopRequireDefault(require('path')); 5const _path = _interopRequireDefault(require('path'));
6 6
7module.exports = Ferdium => { 7module.exports = Ferdium => {
8 // With `// Legacy ` are marked those selectors that were working for some
9 // Nextcloud version before 27 (24 or 25).
10 const notificationElement = '.notification-wrapper .notification';
8 const getMessages = () => { 11 const getMessages = () => {
9 const directSelector = document.querySelectorAll( 12 Ferdium.setBadge(
10 '.notifications .notification-wrapper .notification[object_type="dav"]', 13 Ferdium.safeParseInt(
14 document.querySelectorAll(
15 `.notifications ${notificationElement}[object_type="dav"], ` + // Legacy
16 `.notification-container ${notificationElement}[data-app="dav"]`, // Nextcloud 27
17 )?.length,
18 ),
11 ); 19 );
12 const direct = directSelector
13 ? Ferdium.safeParseInt(directSelector.length)
14 : 0;
15
16 Ferdium.setBadge(direct);
17 }; 20 };
18
19 Ferdium.loop(getMessages); 21 Ferdium.loop(getMessages);
20
21 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); 22 Ferdium.injectCSS(_path.default.join(__dirname, 'service.css'));
22}; 23};