Show HN: Bookmarklet to Highlight OP's Username
Drag and drop or copy and paste to your bookmark toolbar. Even works on mobile.
javascript:/*/hn op#*/document.querySelectorAll(`a.hnuser[href$=${document.querySelector('a.hnuser').href.split('=').pop()}]`).forEach(a=>a.style.backgroundColor='yellow')
7 comments
[ 3.6 ms ] story [ 31.8 ms ] threadI found an interesting quirk with Chrome that if you drag and drop one that has a URL (e.g., /hn op#), it turns into the name of the bookmark. I'd love to find the source code for Chrome for this particular feature.
Then on top of that, how did you figure out a comment like that would turn into the name of the bookmark?
Both features are very hard to discover~
I think one of my bookmarklets had a URL in it and I saw that it got turned into a name. So I just moved it into a JavaScript comment near the beginning.
Or I had something like this:
> Highlights author (name) without breaking comment collapse
https://greasyfork.org/scripts/393187
Works for me on Firefox; haven't tested on Chrome.
This bookmarklet might be a nice option on mobile. I prefer to view via my own HckrNews web app, which also highlights the OP: https://hw.leftium.com/#/item/35076225