From a363b98e38b7b3091cb2ba11cebed0cc53bedc6b Mon Sep 17 00:00:00 2001 From: Edgars Date: Tue, 10 Nov 2020 12:50:46 +0200 Subject: 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. --- recipes/nextcloud-talk/README.md | 21 +++++++++++++++++++++ recipes/nextcloud-talk/package.json | 2 +- recipes/nextcloud-talk/service.css | 12 +++++++++--- recipes/nextcloud-talk/webview.js | 23 +++++++++++++++++------ 4 files changed, 48 insertions(+), 10 deletions(-) create mode 100644 recipes/nextcloud-talk/README.md (limited to 'recipes/nextcloud-talk') diff --git a/recipes/nextcloud-talk/README.md b/recipes/nextcloud-talk/README.md new file mode 100644 index 0000000..e6194c2 --- /dev/null +++ b/recipes/nextcloud-talk/README.md @@ -0,0 +1,21 @@ +# Ferdi recipe for Nextcloud Talk + +Nextcloud Talk - Chat, video & audio-conferencing using WebRTC. + +To add Nextcloud Talk to Ferdi, Nextcloud server address should be provided in the field "Custom server". + +## Credits + +This recipe is based on [`recipe-nextcloud-talk`](https://github.com/meetfranz/recipe-nextcloud-talk). + +## Links + +Ferdi: + +- [Ferdi](https://getferdi.com/) +- [Ferdi recipes](https://github.com/getferdi/recipes) + +Nextcloud: + +- [Nextcloud](https://nextcloud.com/) +- [Nextcloud Talk](https://apps.nextcloud.com/apps/spreed) diff --git a/recipes/nextcloud-talk/package.json b/recipes/nextcloud-talk/package.json index dcb5508..9a25f10 100644 --- a/recipes/nextcloud-talk/package.json +++ b/recipes/nextcloud-talk/package.json @@ -2,7 +2,7 @@ "id": "nextcloud-talk", "name": "Nextcloud Talk", "version": "1.0.2", - "description": "Nextcloud Talk", + "description": "Nextcloud Talk - chat, video & audio-conferencing using WebRTC", "main": "index.js", "author": "Stefan Malzner ", "license": "MIT", diff --git a/recipes/nextcloud-talk/service.css b/recipes/nextcloud-talk/service.css index 82dde75..f4f08bc 100644 --- a/recipes/nextcloud-talk/service.css +++ b/recipes/nextcloud-talk/service.css @@ -15,7 +15,13 @@ settings links and disable them */ display: none !important; } -/* Hide contacts in the top menu */ -#contactsmenu { - display: none; +/* Hide notifications that are not related to calendar */ +.notifications .notification-wrapper .notification {display: none;} +.notifications .notification-wrapper .notification[object_type="chat"], +.notifications .notification-wrapper .notification[object_type="room"] { + display: initial; } + +/* Hide "Dismiss all notifications" as this action will dismiss also hidden +notifications */ +.notification-wrapper .dismiss-all {display: none;} 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) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = Franz => { +module.exports = Ferdi => { const getMessages = function getMessages() { - const direct = document.querySelectorAll('.app-navigation-entry-utils-counter.highlighted').length; - const indirect = document.querySelectorAll('.app-navigation-entry-utils-counter:not(.highlighted)').length; - Franz.setBadge(direct, indirect); + const direct = document.querySelector( + '.notifications .notification-wrapper' + ).querySelectorAll( + '.notification[object_type="chat"], .notification[object_type="room"' + ).length; + + var indirect = 0; + + document.querySelectorAll('.app-navigation-entry__counter').forEach( + function(counter) { + indirect += Number(counter.textContent) + } + ); + Ferdi.setBadge(direct, indirect); }; - Franz.loop(getMessages); - Franz.injectCSS(_path.default.join(__dirname, 'service.css')); + Ferdi.loop(getMessages); + Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); }; -- cgit v1.2.3-54-g00ecf