Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Fix WhatsApp properly #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flying-sheep
Copy link

Fixes #199 for good.

The style of the badge class is this:

._38M1B{
  display:inline-block;
  min-width:.9em;
  min-height:1em;
  font-size:12px;
  font-weight:600;
  line-height:1em;
  color:var(--unread-marker-text);
  vertical-align:top}
html[dir] ._38M1B{
  padding:.3em .4em .4em;
  text-align:center;
  background-color:var(--unread-marker-background);
  border-radius:1.1em
}
html[dir] .vc2I1{
  background-color:var(--unread-marker-background-muted)
}
.os-mac ._38M1B{
min-width:.8em;font-weight:500
}
html[dir] .os-mac ._38M1B{
  padding:.3em .4em
}

Therefore we can find the class using:

const className = Array.from(document.styleSheets)
  .flatMap(s => Array.from(s.cssRules))
  .filter(r => r instanceof CSSStyleRule)
  .find(({style}) => style.color === 'var(--unread-marker-text)')
  .selectorText.split('.').reverse()[0]

(I went for split → reverse → [0] instead of substring(1) in case they add some selector in front in the future)

@flying-sheep
Copy link
Author

Hi @TheGoddessInari what do you think?

@huyz
Copy link

huyz commented Nov 16, 2021

So is Hamsket still being maintained or is it going the way of Rambox?

bitthief added a commit to bitthief/hamsket that referenced this pull request Jan 10, 2023
bitthief added a commit to bitthief/hamsket that referenced this pull request Jan 10, 2023
bitthief added a commit to bitthief/hamsket that referenced this pull request Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WhatsApp] Unread message notification + counter
2 participants