From 130154d6f5e6527cd357594bbec0c5407fa6707d Mon Sep 17 00:00:00 2001 From: Anand Taralika <46954145+taralika@users.noreply.github.com> Date: Thu, 7 May 2020 21:33:50 -0700 Subject: [PATCH] Ignore unread count of spam messages --- counter.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/counter.js b/counter.js index ab2c5da..e4aa56e 100644 --- a/counter.js +++ b/counter.js @@ -5,6 +5,12 @@ function updateBadgeCount() var count = 0; for (var i = 0; i < targetNodes.length; ++i) { + // ignore the unreads in spam + // previousElementSibling is of class navItemLabel and has the name of the section in it (e.g., " Spam ") + if (targetNodes[i].previousElementSibling.innerText.trim().toLowerCase().localeCompare("spam") == 0) + { + continue; + } count += parseInt(targetNodes[i].innerHTML); } count /= 2; // because Google Voice has duplicate nodes for some reason