views/mecount.js (view raw)
1document.addEventListener('DOMContentLoaded', function() {
2 var mecountobserver = new MutationObserver(function(mutations) {
3 mutations.forEach(function(mutation) {
4 if (mutation.type == "childList") {
5 var m = mutation.target
6 if (m.innerHTML) {
7 m.style.width = "18px"
8 if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
9 m.style.backgroundColor = "var(--bg-page)"
10 m.style.color = "var(--fg-subtle)"
11 }
12 } else {
13 m.style.width = "0px"
14 }
15 }
16 })
17 })
18
19 mecountobserver.observe(document.getElementById("mecount"), { childList: true })
20});