From 5c2560428b1794ea5a2774605d90a4972e5a3965 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 11 Sep 2021 19:09:00 +0200 Subject: 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. --- recipes/whatsapp/package.json | 2 +- recipes/whatsapp/webview.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'recipes/whatsapp') 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 @@ { "id": "whatsapp", "name": "WhatsApp", - "version": "3.3.1", + "version": "3.3.2", "license": "MIT", "config": { "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 => { let count = 0; let indirectCount = 0; - const parentChatElem = document.querySelector('[aria-label="Chat list"]'); + const parentChatElem = Array.from(document.querySelectorAll('div[aria-label]')) + .sort((a, b) => (a.offsetHeight < b.offsetHeight) ? 1 : -1)[0]; if (!parentChatElem) { return; } -- cgit v1.2.3-54-g00ecf