hamsket
hamsket copied to clipboard
Fix WhatsApp properly
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)
Hi @TheGoddessInari what do you think?
So is Hamsket still being maintained or is it going the way of Rambox?