aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/telegram/webview.js
diff options
context:
space:
mode:
authorLibravatar Karrq <franci.dainese@gmail.com>2022-05-10 20:57:19 +0200
committerLibravatar GitHub <noreply@github.com>2022-05-10 18:57:19 +0000
commite8d87a2a9668b085167a55eb8ae2fd4c1df44c82 (patch)
treea5c8b4b4a9432f48b3d33def3807382bd44b0359 /recipes/telegram/webview.js
parentupgrade node js to latest LTS version and pnpm from 6.x to 7.x (#17) (diff)
downloadferdium-recipes-e8d87a2a9668b085167a55eb8ae2fd4c1df44c82.tar.gz
ferdium-recipes-e8d87a2a9668b085167a55eb8ae2fd4c1df44c82.tar.zst
ferdium-recipes-e8d87a2a9668b085167a55eb8ae2fd4c1df44c82.zip
Telegram detection defaults to webZ if not webK (#19)
Diffstat (limited to 'recipes/telegram/webview.js')
-rw-r--r--recipes/telegram/webview.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/recipes/telegram/webview.js b/recipes/telegram/webview.js
index f05b43f..632aff0 100644
--- a/recipes/telegram/webview.js
+++ b/recipes/telegram/webview.js
@@ -9,7 +9,6 @@ module.exports = Ferdium => {
9 .querySelector('meta[name="application-name"]') 9 .querySelector('meta[name="application-name"]')
10 ?.getAttribute('content'); 10 ?.getAttribute('content');
11 11
12 const isWebZ = telegramVersion?.includes('WebZ');
13 const isWebK = telegramVersion?.includes('WebK'); 12 const isWebK = telegramVersion?.includes('WebK');
14 13
15 // There are two different Telegram versions for internal competition 14 // There are two different Telegram versions for internal competition
@@ -60,20 +59,20 @@ module.exports = Ferdium => {
60 }; 59 };
61 60
62 const getMessages = () => { 61 const getMessages = () => {
63 if (isWebZ) { 62 if (isWebK) {
64 webZCount();
65 } else if (isWebK) {
66 webKCount(); 63 webKCount();
64 } else {
65 webZCount();
67 } 66 }
68 }; 67 };
69 68
70 const getActiveDialogTitle = () => { 69 const getActiveDialogTitle = () => {
71 let element; 70 let element;
72 71
73 if (isWebZ) { 72 if (isWebK) {
74 element = document.querySelector('.chat-list .ListItem .title > h3');
75 } else if (isWebK) {
76 element = document.querySelector('.top .peer-title'); 73 element = document.querySelector('.top .peer-title');
74 } else {
75 element = document.querySelector('.chat-list .ListItem .title > h3');
77 } 76 }
78 77
79 Ferdium.setDialogTitle(element ? element.textContent : ''); 78 Ferdium.setDialogTitle(element ? element.textContent : '');