Skip to content

Commit

Permalink
Ignore unread count of spam messages
Browse files Browse the repository at this point in the history
  • Loading branch information
taralika authored May 8, 2020
1 parent 4ccda73 commit 130154d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 130154d

Please sign in to comment.