From 6f5e4a00588aefdda7a5a1cfe70935870e7e234a Mon Sep 17 00:00:00 2001 From: Bennett Date: Tue, 22 Sep 2020 20:56:48 +0200 Subject: Unpack recipes and update recipes icons (#292) Co-authored-by: Amine Mouafik --- recipes/jitsi/webview.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 recipes/jitsi/webview.js (limited to 'recipes/jitsi/webview.js') diff --git a/recipes/jitsi/webview.js b/recipes/jitsi/webview.js new file mode 100644 index 0000000..563a3cf --- /dev/null +++ b/recipes/jitsi/webview.js @@ -0,0 +1,14 @@ +"use strict"; + +const NOTIFICATION_BADGE_CLASS = '.badge-round'; + +module.exports = Ferdi => { + const getMessages = () => { + const badges = [...document.querySelectorAll(NOTIFICATION_BADGE_CLASS)]; + const messages = badges.reduce((currentValue, element) => currentValue + Number(element.innerText), 0); + + Ferdi.setBadge(messages); + } + + Ferdi.loop(getMessages); +} \ No newline at end of file -- cgit v1.2.3-70-g09d2