diff options
author | 2021-05-27 23:50:23 +0530 | |
---|---|---|
committer | 2021-05-27 23:50:23 +0530 | |
commit | 3ade15fdb502aec36d6bb42a5239dc4c886c87c4 (patch) | |
tree | 3b7b10b699285781664ab72601f686d6fec359a5 /recipes/telegram-react/webview.js | |
parent | Inoreader recipe from: https://github.com/annagrram/recipe-inoreader (diff) | |
download | ferdium-recipes-3ade15fdb502aec36d6bb42a5239dc4c886c87c4.tar.gz ferdium-recipes-3ade15fdb502aec36d6bb42a5239dc4c886c87c4.tar.zst ferdium-recipes-3ade15fdb502aec36d6bb42a5239dc4c886c87c4.zip |
Fixing unread count in telegram-react
Diffstat (limited to 'recipes/telegram-react/webview.js')
-rw-r--r-- | recipes/telegram-react/webview.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/recipes/telegram-react/webview.js b/recipes/telegram-react/webview.js index 223e914..8bc3839 100644 --- a/recipes/telegram-react/webview.js +++ b/recipes/telegram-react/webview.js | |||
@@ -1,15 +1,13 @@ | |||
1 | "use strict"; | 1 | "use strict"; |
2 | 2 | ||
3 | const path = require("path"); | ||
4 | |||
5 | module.exports = Franz => { | 3 | module.exports = Franz => { |
6 | const getMessages = function getMessages() { | 4 | const getMessages = function getMessages() { |
7 | let count = 0; | 5 | let count = 0; |
8 | const elements = document.querySelectorAll(".dialog-badge:not(.dialog-badge-muted)"); | 6 | const elements = document.querySelectorAll(".chatlist > li:not(.is-muted)"); |
9 | if (elements) { | 7 | if (elements) { |
10 | for (let i = 0; i < elements.length; i += 1) { | 8 | for (let i = 0; i < elements.length; i += 1) { |
11 | if (elements[i].querySelector("span").innerHTML !== 0) { | 9 | if (elements[i].querySelector(".unread") && elements[i].querySelector(".unread").innerHTML !== 0) { |
12 | count += parseInt(elements[i].querySelector("span").innerHTML); | 10 | count += parseInt(elements[i].querySelector(".unread").innerHTML); |
13 | } | 11 | } |
14 | } | 12 | } |
15 | } | 13 | } |