all repos — honk @ 9534ea09dfb73022060accafd4a248fe0b4b5c93

my fork of honk

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          document.title = document.title + " (" + m.innerHTML + ")"
17	  		}
18	  	})
19	  })
20
21    mecountobserver.observe(document.getElementById("mecount"), { childList: true })
22});