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 | |
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'
-rw-r--r-- | all.json | 2 | ||||
-rw-r--r-- | recipes/stackoverflow-chat/package.json | 2 | ||||
-rw-r--r-- | recipes/stackoverflow-chat/webview.js | 15 |
3 files changed, 11 insertions, 8 deletions
@@ -1476,7 +1476,7 @@ | |||
1476 | "featured": false, | 1476 | "featured": false, |
1477 | "id": "stackoverflow-chat", | 1477 | "id": "stackoverflow-chat", |
1478 | "name": "Stackoverflow chat", | 1478 | "name": "Stackoverflow chat", |
1479 | "version": "1.0.0", | 1479 | "version": "1.0.1", |
1480 | "icons": { | 1480 | "icons": { |
1481 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/stackoverflow-chat/icon.svg" | 1481 | "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/stackoverflow-chat/icon.svg" |
1482 | } | 1482 | } |
diff --git a/recipes/stackoverflow-chat/package.json b/recipes/stackoverflow-chat/package.json index 688db65..4cbddeb 100644 --- a/recipes/stackoverflow-chat/package.json +++ b/recipes/stackoverflow-chat/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "stackoverflow-chat", | 2 | "id": "stackoverflow-chat", |
3 | "name": "Stackoverflow chat", | 3 | "name": "Stackoverflow chat", |
4 | "version": "1.0.0", | 4 | "version": "1.0.1", |
5 | "license": "MIT", | 5 | "license": "MIT", |
6 | "config": { | 6 | "config": { |
7 | "serviceURL": "https://chat.stackoverflow.com/", | 7 | "serviceURL": "https://chat.stackoverflow.com/", |
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 | }; |