diff options
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 | }; | ||