Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Web Highlighter Userscript (github.com/physicslog)
23 points by fhcxvbdb on Dec 4, 2024 | hide | past | favorite | 3 comments


Nice! I built something similar for https://histre.com/ and made it even robust that the highlight will stay on even if the rest of the page changes. For example, if you highlight a sentence in Hacker News comments, the position of the comment changes all the time and histre highlights the correct sentence even with that change.

I open sourced it here, if that's helpful: https://gitlab.com/histre/browser-extension/-/blob/master/hi...


Very well done! And only 300 lines of code. I'd suggest adding this:

dot.onclick = () => setTimeout(displayHighlightsPopup, 50);

In addition to that, if possible, your highlighter could show all domains with highlights.

Another useful addition would be sharing a page with someone with your highlights. Even here, on HN, someone could read an article and share a link with highlights added. The highlights themselves could go to the URL #hash part. This could be used together with the Archive.is snapshots.

Edit: A simpler feature would be saving a summary of all highlights in a basic text form that can be easily shared here or anywhere else, really. It's very handy when you're reading a long page, keep highliting interesting parts and at the end get the summary.


As for sharing - text fragments could also do for a nice addition: https://developer.mozilla.org/en-US/docs/Web/URI/Fragment/Te...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: