From 8b8021293b65120e76af0aa9e3d15ce0fa8ddbed Mon Sep 17 00:00:00 2001 From: Ravindra Gullapalli Date: Wed, 16 Feb 2022 17:05:16 +0530 Subject: Add Hubstaff service (#828) --- recipes/hubstaff/webview.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 recipes/hubstaff/webview.js (limited to 'recipes/hubstaff/webview.js') 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 @@ +module.exports = (Ferdi) => { + // TODO: If your hubstaff service has unread messages, uncomment these lines to implement the logic for updating the badges + const getMessages = () => { + // TODO: Insert your notification-finding code here + let directMessages = 0; + let indirectMessages = 0; + const notificationContainers = document.querySelectorAll('.notifications-number'); + if (notificationContainers){ + directMessages = Ferdi.safeParseInt(notificationContainers[0].textContent); + indirectMessages = Ferdi.safeParseInt(notificationContainers[1].textContent); + } + Ferdi.setBadge(directMessages, indirectMessages); + }; + Ferdi.loop(getMessages); +}; -- cgit v1.2.3-70-g09d2