diff options
author | 2021-09-11 19:09:00 +0200 | |
---|---|---|
committer | 2021-09-11 22:40:41 +0530 | |
commit | 5c2560428b1794ea5a2774605d90a4972e5a3965 (patch) | |
tree | 59fca86f1bbc56b74f15d22d62fc812b6da226a0 /recipes/whatsapp/webview.js | |
parent | config for pnpm (diff) | |
download | ferdium-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.
Diffstat (limited to 'recipes/whatsapp/webview.js')
-rw-r--r-- | recipes/whatsapp/webview.js | 3 |
1 files changed, 2 insertions, 1 deletions
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 | } |