4

Add a bell emoji to unread comments on HackerNews

 3 years ago
source link: https://gist.github.com/linkdd/76fd57d02480c3e36a4e3f8ce39322b1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Add a bell emoji to unread comments on HackerNews · GitHub

Instantly share code, notes, and snippets.

Add a bell emoji to unread comments on HackerNews

// Can be used with https://github.com/xcv58/Custom-JavaScript-for-Websites-2 // This snippet is released under the terms of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/deed.en

const url = window.location.toString().split('#')[0] // remove anchor const cache = JSON.parse(localStorage.getItem(url) || '{}')

document.querySelectorAll('.athing.comtr').forEach(comm => { if (!cache[comm.id]) { const span = document.createElement('span') span.innerHTML = '🔔' // :bell: emoji comm.querySelector('.comhead').append(span) } cache[comm.id] = true })

localStorage.setItem(url, JSON.stringify(cache))


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK