From 0ac12867ab678668de43c36113610b9381937009 Mon Sep 17 00:00:00 2001 From: Shampra <16141040+Shampra@users.noreply.github.com> Date: Fri, 24 May 2024 12:37:59 +0200 Subject: Fix the method for detecting unread messages for Google Chat (#554) --- recipes/hangoutschat/package.json | 2 +- recipes/hangoutschat/webview.js | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'recipes') diff --git a/recipes/hangoutschat/package.json b/recipes/hangoutschat/package.json index 9bc79f1..4c0b260 100644 --- a/recipes/hangoutschat/package.json +++ b/recipes/hangoutschat/package.json @@ -1,7 +1,7 @@ { "id": "hangoutschat", "name": "Hangouts Chat", - "version": "1.8.1", + "version": "1.8.2", "license": "MIT", "aliases": [ "google-chat", diff --git a/recipes/hangoutschat/webview.js b/recipes/hangoutschat/webview.js index 7f2acf2..307a752 100644 --- a/recipes/hangoutschat/webview.js +++ b/recipes/hangoutschat/webview.js @@ -14,9 +14,6 @@ module.exports = Ferdium => { 'https://accounts.google.com/AccountChooser?continue=https://chat.google.com/?referrer=2'; } - // class corresponding to the red badge that is visible for direct messages - const directMessageSelector = 'div.V6.CL.su.ahD.X9.Y2 span.akt span.XU'; - // class corresponding to the bold text that is visible for room messages const indirectMessageSelector = 'div.V6.CL.V2.X9.Y2 span.akt span.XU'; @@ -25,10 +22,8 @@ module.exports = Ferdium => { let directCount; let indirectCount; - const directCountSelector = document.querySelector(directMessageSelector); - if (directCountSelector) { - directCount = Number(directCountSelector.textContent); - } + // get unread messages count + directCount = document.querySelectorAll('link[href^="https://ssl.gstatic.com/ui/v1/icons/mail/images/favicon_chat_new_notif_"][href$=".ico"]').length; // get unread indirect messages const indirectCountSelector = document.querySelector( -- cgit v1.2.3-70-g09d2