aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/nextcloud-talk/webview.js
diff options
context:
space:
mode:
authorLibravatar Edgars <Edgars+GitHub@gaitenis.id.lv>2020-11-10 12:50:46 +0200
committerLibravatar Edgars <Edgars+GitHub@gaitenis.id.lv>2020-11-10 12:50:46 +0200
commita363b98e38b7b3091cb2ba11cebed0cc53bedc6b (patch)
tree13a55fcc31da0fcd1f62f9b83ceffc6955110009 /recipes/nextcloud-talk/webview.js
parentMerge pull request #351 from tpapamichail/master (diff)
downloadferdium-recipes-a363b98e38b7b3091cb2ba11cebed0cc53bedc6b.tar.gz
ferdium-recipes-a363b98e38b7b3091cb2ba11cebed0cc53bedc6b.tar.zst
ferdium-recipes-a363b98e38b7b3091cb2ba11cebed0cc53bedc6b.zip
Nextcloud Talk: Hide unrelated notifications and fix notifications count
`service.css` was updated to: - unhide contacts menu; - hide notifications that are not related to Nextcloud Talk; - hide "Dismiss all notifications" as this action would also dismiss hidden notifications. `webview.js` was updated to fix notifications (both direct and indirect) count retrieval. `README.md` was added.
Diffstat (limited to 'recipes/nextcloud-talk/webview.js')
-rw-r--r--recipes/nextcloud-talk/webview.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/recipes/nextcloud-talk/webview.js b/recipes/nextcloud-talk/webview.js
index c180d4d..42b1e49 100644
--- a/recipes/nextcloud-talk/webview.js
+++ b/recipes/nextcloud-talk/webview.js
@@ -6,13 +6,24 @@ 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 const direct = document.querySelector(
12 const indirect = document.querySelectorAll('.app-navigation-entry-utils-counter:not(.highlighted)').length; 12 '.notifications .notification-wrapper'
13 Franz.setBadge(direct, indirect); 13 ).querySelectorAll(
14 '.notification[object_type="chat"], .notification[object_type="room"'
15 ).length;
16
17 var indirect = 0;
18
19 document.querySelectorAll('.app-navigation-entry__counter').forEach(
20 function(counter) {
21 indirect += Number(counter.textContent)
22 }
23 );
24 Ferdi.setBadge(direct, indirect);
14 }; 25 };
15 26
16 Franz.loop(getMessages); 27 Ferdi.loop(getMessages);
17 Franz.injectCSS(_path.default.join(__dirname, 'service.css')); 28 Ferdi.injectCSS(_path.default.join(__dirname, 'service.css'));
18}; 29};