aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Alex <alex.bock@gmail.com>2021-09-11 19:09:00 +0200
committerLibravatar Vijay A <avijayr@protonmail.com>2021-09-11 22:40:41 +0530
commit5c2560428b1794ea5a2774605d90a4972e5a3965 (patch)
tree59fca86f1bbc56b74f15d22d62fc812b6da226a0
parentconfig for pnpm (diff)
downloadferdium-recipes-5c2560428b1794ea5a2774605d90a4972e5a3965.tar.gz
ferdium-recipes-5c2560428b1794ea5a2774605d90a4972e5a3965.tar.zst
ferdium-recipes-5c2560428b1794ea5a2774605d90a4972e5a3965.zip
update WhatsApp webview.js for non-English locales (#680)
* update webview.js for non-English locales the current implementation tries to get the message list parentChatElem through an element called "Chat list", which is not named that in non-English locales. As a replacement, I'm finding all div's with an aria-label attribute and then I choose the tallest one, which should usually be the chat list.
-rw-r--r--all.json2
-rw-r--r--recipes/whatsapp/package.json2
-rw-r--r--recipes/whatsapp/webview.js3
3 files changed, 4 insertions, 3 deletions
diff --git a/all.json b/all.json
index 8e6d722..f910519 100644
--- a/all.json
+++ b/all.json
@@ -1575,7 +1575,7 @@
1575 "featured": true, 1575 "featured": true,
1576 "id": "whatsapp", 1576 "id": "whatsapp",
1577 "name": "WhatsApp", 1577 "name": "WhatsApp",
1578 "version": "3.3.1", 1578 "version": "3.3.2",
1579 "icons": { 1579 "icons": {
1580 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/whatsapp/icon.svg" 1580 "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/whatsapp/icon.svg"
1581 } 1581 }
diff --git a/recipes/whatsapp/package.json b/recipes/whatsapp/package.json
index c33b115..4e59177 100644
--- a/recipes/whatsapp/package.json
+++ b/recipes/whatsapp/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "whatsapp", 2 "id": "whatsapp",
3 "name": "WhatsApp", 3 "name": "WhatsApp",
4 "version": "3.3.1", 4 "version": "3.3.2",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://web.whatsapp.com", 7 "serviceURL": "https://web.whatsapp.com",
diff --git a/recipes/whatsapp/webview.js b/recipes/whatsapp/webview.js
index eaaf2c2..3df34e3 100644
--- a/recipes/whatsapp/webview.js
+++ b/recipes/whatsapp/webview.js
@@ -12,7 +12,8 @@ module.exports = Ferdi => {
12 let count = 0; 12 let count = 0;
13 let indirectCount = 0; 13 let indirectCount = 0;
14 14
15 const parentChatElem = document.querySelector('[aria-label="Chat list"]'); 15 const parentChatElem = Array.from(document.querySelectorAll('div[aria-label]'))
16 .sort((a, b) => (a.offsetHeight < b.offsetHeight) ? 1 : -1)[0];
16 if (!parentChatElem) { 17 if (!parentChatElem) {
17 return; 18 return;
18 } 19 }