diff options
author | Vijay A <avijayr@protonmail.com> | 2021-07-04 20:39:06 +0530 |
---|---|---|
committer | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-07-04 20:40:29 +0530 |
commit | 7311682b5f3a1796814757b6605e782bf4de3fde (patch) | |
tree | 6fad65ba935216c3fe449ffa06893de380f71313 /recipes | |
parent | Fixing unread count in telegram recipe. (diff) | |
download | ferdium-recipes-7311682b5f3a1796814757b6605e782bf4de3fde.tar.gz ferdium-recipes-7311682b5f3a1796814757b6605e782bf4de3fde.tar.zst ferdium-recipes-7311682b5f3a1796814757b6605e782bf4de3fde.zip |
Fixing group unread count in telegram recipe.
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/telegram/package.json | 2 | ||||
-rw-r--r-- | recipes/telegram/webview.js | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/recipes/telegram/package.json b/recipes/telegram/package.json index 15fcaf7..c5f7043 100644 --- a/recipes/telegram/package.json +++ b/recipes/telegram/package.json | |||
@@ -1,7 +1,7 @@ | |||
1 | { | 1 | { |
2 | "id": "telegram", | 2 | "id": "telegram", |
3 | "name": "Telegram", | 3 | "name": "Telegram", |
4 | "version": "3.0.1", | 4 | "version": "3.0.2", |
5 | "description": "Telegram", | 5 | "description": "Telegram", |
6 | "main": "index.js", | 6 | "main": "index.js", |
7 | "author": "Stefan Malzner <stefan@adlk.io>", | 7 | "author": "Stefan Malzner <stefan@adlk.io>", |
diff --git a/recipes/telegram/webview.js b/recipes/telegram/webview.js index 1d33d2f..a8c2ddd 100644 --- a/recipes/telegram/webview.js +++ b/recipes/telegram/webview.js | |||
@@ -7,16 +7,20 @@ const path = require('path'); | |||
7 | module.exports = Franz => { | 7 | module.exports = Franz => { |
8 | const getMessages = function getMessages() { | 8 | const getMessages = function getMessages() { |
9 | let count = 0; | 9 | let count = 0; |
10 | const elements = document.querySelectorAll('.unread'); | 10 | let count_sec = 0 |
11 | if (elements) { | 11 | const elements = document.querySelectorAll('.rp'); |
12 | for (let i = 0; i < elements.length; i += 1) { | 12 | for (let i = 0; i < elements.length; i += 1) { |
13 | if (parseInt(elements[i].innerText)) { | 13 | if (elements[i].querySelector('.dialog-subtitle-badge') && (!isNaN(parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText)) )) { |
14 | count += parseInt(elements[i].innerText) | 14 | if (parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText) != "" && (elements[i].dataset.peerId > 0)) { |
15 | count = +count + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText) | ||
16 | } | ||
17 | else { | ||
18 | count_sec = +count_sec + parseInt(elements[i].querySelector('.dialog-subtitle-badge').innerText) | ||
15 | } | 19 | } |
16 | } | 20 | } |
17 | } | 21 | } |
18 | 22 | ||
19 | Franz.setBadge(count); | 23 | Franz.setBadge(count, count_sec); |
20 | }; | 24 | }; |
21 | 25 | ||
22 | Franz.injectCSS(path.join(__dirname, 'service.css')); | 26 | Franz.injectCSS(path.join(__dirname, 'service.css')); |