diff options
author | Vijay A <avijayr@protonmail.com> | 2021-09-23 20:18:53 +0530 |
---|---|---|
committer | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-23 20:19:48 +0530 |
commit | 1a4890a7a52ac34ca54c84b4e8b014ec7928632d (patch) | |
tree | c2c73bc91f2d95351eef777cc389e7907a16e16c /recipes/stackoverflow-chat/webview.js | |
parent | feature: allow services to delineate favorites vs non-favorites in unread counts (diff) | |
download | ferdium-recipes-1a4890a7a52ac34ca54c84b4e8b014ec7928632d.tar.gz ferdium-recipes-1a4890a7a52ac34ca54c84b4e8b014ec7928632d.tar.zst ferdium-recipes-1a4890a7a52ac34ca54c84b4e8b014ec7928632d.zip |
fix: implement unread count badge for 'stackoverflow-chat'
Diffstat (limited to 'recipes/stackoverflow-chat/webview.js')
-rw-r--r-- | recipes/stackoverflow-chat/webview.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/recipes/stackoverflow-chat/webview.js b/recipes/stackoverflow-chat/webview.js index 044c773..cf487b5 100644 --- a/recipes/stackoverflow-chat/webview.js +++ b/recipes/stackoverflow-chat/webview.js | |||
@@ -3,12 +3,15 @@ var _path = _interopRequireDefault(require('path')); | |||
3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | 3 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
4 | 4 | ||
5 | module.exports = Ferdi => { | 5 | module.exports = Ferdi => { |
6 | // TODO: If your stackoverflow-chat service has unread messages, uncomment these lines to implement the logic for updating the badges | 6 | const getMessages = () => { |
7 | // const getMessages = () => { | 7 | const unreadSpan = document.querySelector('span.flag-count.message-count.unread-count'); |
8 | // // TODO: Insert your notification-finding code here | 8 | let directCount = 0; |
9 | // Ferdi.setBadge(0, 0); | 9 | if (unreadSpan) { |
10 | // }; | 10 | directCount = Ferdi.safeParseInt(unreadSpan.innerText); |
11 | // Ferdi.loop(getMessages); | 11 | } |
12 | Ferdi.setBadge(directCount); | ||
13 | }; | ||
14 | Ferdi.loop(getMessages); | ||
12 | 15 | ||
13 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); | 16 | Ferdi.injectCSS(_path.default.join(__dirname, 'service.css')); |
14 | }; | 17 | }; |