3 ms·
I already have a custom CSS (using Stylus) for Dark Mode. The CSS is trickier due to the HTML structure.
by linkdd 5y ago
I already have a custom CSS (using Stylus) for Dark Mode.
The CSS is trickier due to the HTML structure.
- sorenjan 5y agoI was thinking of something like this: let style = document.createElement('style'); style.innerHTML = ".unread::after {content: ':bell:'}"; document.getElementsByTagName('head')[0].appendChild(style); document.querySelectorAll('.athing.comtr').forEach(comm => { if (comment is unread) { comm.querySelector('.comhead').classList.add("unread"); } }) That shouldn't collide with other custom CSS, and it avoids adding extra elements in the loop. Edit: I used the actual bell emoji in the code, but HN removed that, so I just replaced it with :bell:.