aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/gitter/webview.js
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/gitter/webview.js')
-rw-r--r--recipes/gitter/webview.js9
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) {
7module.exports = Ferdi => { 7module.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);