diff options
author | Aman9das <Aman9das@users.noreply.github.com> | 2021-11-23 21:18:42 +0530 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2021-11-23 21:26:03 +0530 |
commit | b5266ada66a1c8a2409f5ca6c7de2fda968420fa (patch) | |
tree | d9503d529caef339c9ed787dabe83070871b7e2a /recipes/xmpp/webview.js | |
parent | Fixing issue with 'toggl' recipe exposed by the pre-commit hook (diff) | |
download | ferdium-recipes-b5266ada66a1c8a2409f5ca6c7de2fda968420fa.tar.gz ferdium-recipes-b5266ada66a1c8a2409f5ca6c7de2fda968420fa.tar.zst ferdium-recipes-b5266ada66a1c8a2409f5ca6c7de2fda968420fa.zip |
add new 'xmpp' service recipe
Diffstat (limited to 'recipes/xmpp/webview.js')
-rw-r--r-- | recipes/xmpp/webview.js | 13 |
1 files changed, 13 insertions, 0 deletions
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 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | function getMessages() { | ||
3 | let direct = 0; | ||
4 | for (const indicator of document.querySelectorAll('.msgs-indicator')) { | ||
5 | direct += Ferdi.safeParseInt(indicator.textContent) | ||
6 | } | ||
7 | |||
8 | direct = direct / 2 // as the messages are provided in 2 different locations.. | ||
9 | Ferdi.setBadge(direct); | ||
10 | } | ||
11 | |||
12 | Ferdi.loop(getMessages); | ||
13 | }; | ||