diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-25 10:21:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 10:21:11 +0200 |
commit | bdbc4330f8c180f013522dc76525e871c86e408a (patch) | |
tree | c6c5317a8ce7f11e81d57c8a3a6d584f3ef34a53 /recipes/gitter/webview.js | |
parent | feat: support telegram count for both webk and webz (#751) (diff) | |
download | ferdium-recipes-bdbc4330f8c180f013522dc76525e871c86e408a.tar.gz ferdium-recipes-bdbc4330f8c180f013522dc76525e871c86e408a.tar.zst ferdium-recipes-bdbc4330f8c180f013522dc76525e871c86e408a.zip |
fix: no gitter badge for mentions in channels (#752)
Diffstat (limited to 'recipes/gitter/webview.js')
-rw-r--r-- | recipes/gitter/webview.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/recipes/gitter/webview.js b/recipes/gitter/webview.js index 0026790..c4eee5b 100644 --- a/recipes/gitter/webview.js +++ b/recipes/gitter/webview.js | |||
@@ -7,13 +7,16 @@ function _interopRequireDefault(obj) { | |||
7 | module.exports = Ferdi => { | 7 | module.exports = Ferdi => { |
8 | const getMessages = () => { | 8 | const getMessages = () => { |
9 | // get unread messages | 9 | // get unread messages |
10 | let count = 0; | 10 | let directCount = 0; |
11 | for (const node of document.querySelectorAll('div.unread-indicator')) { | 11 | for (const node of document.querySelectorAll('div.unread-indicator')) { |
12 | count += Ferdi.safeParseInt(node.textContent); | 12 | directCount += Ferdi.safeParseInt(node.textContent); |
13 | } | 13 | } |
14 | 14 | ||
15 | const channelMentionCount = | ||
16 | document.querySelectorAll('.mention-indicator').length; | ||
17 | |||
15 | // set Ferdi badge | 18 | // set Ferdi badge |
16 | Ferdi.setBadge(count); | 19 | Ferdi.setBadge(directCount, channelMentionCount); |
17 | }; | 20 | }; |
18 | 21 | ||
19 | Ferdi.loop(getMessages); | 22 | Ferdi.loop(getMessages); |