diff options
author | 2022-02-16 17:05:16 +0530 | |
---|---|---|
committer | 2022-02-16 12:35:16 +0100 | |
commit | 8b8021293b65120e76af0aa9e3d15ce0fa8ddbed (patch) | |
tree | 11445f44a5f15c2feb4479a889150cf8f18d311f /recipes/hubstaff/webview.js | |
parent | docs: add ravindragullapalli as a contributor for code (#834) (diff) | |
download | ferdium-recipes-8b8021293b65120e76af0aa9e3d15ce0fa8ddbed.tar.gz ferdium-recipes-8b8021293b65120e76af0aa9e3d15ce0fa8ddbed.tar.zst ferdium-recipes-8b8021293b65120e76af0aa9e3d15ce0fa8ddbed.zip |
Add Hubstaff service (#828)
Diffstat (limited to 'recipes/hubstaff/webview.js')
-rw-r--r-- | recipes/hubstaff/webview.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/recipes/hubstaff/webview.js b/recipes/hubstaff/webview.js new file mode 100644 index 0000000..408f78c --- /dev/null +++ b/recipes/hubstaff/webview.js | |||
@@ -0,0 +1,15 @@ | |||
1 | module.exports = (Ferdi) => { | ||
2 | // TODO: If your hubstaff service has unread messages, uncomment these lines to implement the logic for updating the badges | ||
3 | const getMessages = () => { | ||
4 | // TODO: Insert your notification-finding code here | ||
5 | let directMessages = 0; | ||
6 | let indirectMessages = 0; | ||
7 | const notificationContainers = document.querySelectorAll('.notifications-number'); | ||
8 | if (notificationContainers){ | ||
9 | directMessages = Ferdi.safeParseInt(notificationContainers[0].textContent); | ||
10 | indirectMessages = Ferdi.safeParseInt(notificationContainers[1].textContent); | ||
11 | } | ||
12 | Ferdi.setBadge(directMessages, indirectMessages); | ||
13 | }; | ||
14 | Ferdi.loop(getMessages); | ||
15 | }; | ||