6218d6bad1
update names based on the element from the mutation event rather than checking the chatbox for unchecked messages each mutation
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { eachMutation } from './dom'
|
|
|
|
// attach observer
|
|
const observer = new MutationObserver((mutationRecords: MutationRecord[]) => {
|
|
for (const record of mutationRecords) {
|
|
eachMutation(record)
|
|
}
|
|
})
|
|
observer.observe(document, { attributes: true, childList: true, subtree: true })
|
|
|
|
// attach styles
|
|
const styleAddition = document.createElement('style')
|
|
styleAddition.innerHTML = `
|
|
/* hide badges, except broadcaster and moderator */
|
|
.chat-line__message--badges {
|
|
display: none;
|
|
}
|
|
.ismod .chat-line__message--badges {
|
|
display: inline;
|
|
}
|
|
.ismod .chat-line__message--badges > span {
|
|
display: none;
|
|
}
|
|
.ismod .chat-line__message--badges > span[data-badge="moderator"],
|
|
.ismod .chat-line__message--badges > span[data-badge="broadcaster"] {
|
|
display: inline-block;
|
|
}
|
|
|
|
/* disable 7tv paint colors */
|
|
.seventv-paint {
|
|
background-image: none !important;
|
|
}
|
|
|
|
/* disable username translations */
|
|
.chat-author__intl-login {
|
|
display: none;
|
|
}
|
|
|
|
/* style image when used as name */
|
|
img.obf-image {
|
|
vertical-align: middle;
|
|
margin: -0.5rem 0;
|
|
|
|
height: 1.8rem;
|
|
}
|
|
`
|
|
document.head.appendChild(styleAddition)
|