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/icon.svg | 1 + recipes/hubstaff/index.js | 1 + recipes/hubstaff/package.json | 10 ++++++++++ recipes/hubstaff/webview.js | 15 +++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 recipes/hubstaff/icon.svg create mode 100644 recipes/hubstaff/index.js create mode 100644 recipes/hubstaff/package.json create mode 100644 recipes/hubstaff/webview.js (limited to 'recipes') diff --git a/recipes/hubstaff/icon.svg b/recipes/hubstaff/icon.svg new file mode 100644 index 0000000..3055182 --- /dev/null +++ b/recipes/hubstaff/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/recipes/hubstaff/index.js b/recipes/hubstaff/index.js new file mode 100644 index 0000000..651c280 --- /dev/null +++ b/recipes/hubstaff/index.js @@ -0,0 +1 @@ +module.exports = Ferdi => class Hubstaff extends Ferdi {}; diff --git a/recipes/hubstaff/package.json b/recipes/hubstaff/package.json new file mode 100644 index 0000000..bcb675b --- /dev/null +++ b/recipes/hubstaff/package.json @@ -0,0 +1,10 @@ +{ + "id": "hubstaff", + "name": "HubStaff", + "version": "1.0.0", + "license": "MIT", + "config": { + "serviceURL": "https://app.hubstaff.com/login_now", + "hasNotificationSound": true + } +} \ No newline at end of file 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-54-g00ecf