From b5266ada66a1c8a2409f5ca6c7de2fda968420fa Mon Sep 17 00:00:00 2001 From: Aman9das Date: Tue, 23 Nov 2021 21:18:42 +0530 Subject: add new 'xmpp' service recipe --- recipes/xmpp/webview.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 recipes/xmpp/webview.js (limited to 'recipes/xmpp/webview.js') diff --git a/recipes/xmpp/webview.js b/recipes/xmpp/webview.js new file mode 100644 index 0000000..dec648c --- /dev/null +++ b/recipes/xmpp/webview.js @@ -0,0 +1,13 @@ +module.exports = (Ferdi) => { + function getMessages() { + let direct = 0; + for (const indicator of document.querySelectorAll('.msgs-indicator')) { + direct += Ferdi.safeParseInt(indicator.textContent) + } + + direct = direct / 2 // as the messages are provided in 2 different locations.. + Ferdi.setBadge(direct); + } + + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2