Lurker News
Paste the following into the console of any HN page - for annotated avatars on all HN comments. (self contained code)

  for(u of document.querySelectorAll('.hnuser'))for(u.prepend(c=document.createElement('canvas')),x=c.getContext('2d'),c.width=18,c.height=14,s=u.innerText,r=1,i=28+s.length;i--;i<28?r>>>29>X*X/3+Y/2&&x.fillRect(6+2*X,2*Y,2,2)&x.fillRect(6-2*X,2*Y,2,2):r+=s.charCodeAt(i-28,x.fillStyle='#'+(r>>8&0xFFFFFF).toString(16)))r^=r<<13,r^=r>>>17,r^=r<<5,X=i&3,Y=i>>2

Comments (493) 108 threads

Earlier comments
SCUSKU6 replies#
Wow this is really great! Noob question, but let's say I wanted to permanently load this JS in my browser? How would I achieve that? Grease monkey? Extension? Thanks :)
freeCandy1 reply#
Should be really easy with grease monkey. I simply pasted the snippet into a new script and enabled it for this site. Works perfectly out of the box.
wizwit9991 reply#
needed to add.

  let c,x,X,Y,r,i,s;
smartsl#
and let u;
throwamon1 reply#
Violentmonkey is a nice open source alternative to Greasemonkey.
chrismorgan1 reply#
Your wording implies Greasemonkey is not open source. I don’t know if that was your intention or not, but Greasemonkey is open source.
j-james#
They're probably confusing it with Tampermonkey, which isn't open source.
sgt#
Or ask pg to save it on the server side.
daptaq1 reply#
I don't know about you, but I really don't want an extension for every small change one might want to apply to one specific site.
mrmuagi#
That's fair how about Tampermonkey -- I use it occasionally to apply js/css/html fixups to sites, e.g. Add browser titles to sites for better bookmarks, re-organize/add site html, etc. I did use it for removing content but ublock origin is much better imo for most cases.
daenz4 replies#
I wonder how easily you could have slipped in an obfuscated cookie stealer
schleck81 reply#
UTF-encode the maliscious snippet and disguise it as the regex pattern haha
stavros1 reply#
Doesn't UTF-8 just give you the exact same letters, since it's already ASCII?
kroltan2 replies#
I think it was meant to be UTF-8 escape codes, as in \u0000 etc.

Continue this thread — 2 replies

zeusly#
HN sets one cookie and that is "httpOnly" and "secure", so it can't be read from JavaScript. You can test this yourself by typing document.cookie into your console, it should return an empty string.
usrbinbash#
Given that it takes about 20seconds to read through the snippet, not easily ;-)
neogodless#
I'm trying to do this in Firefox 98.0 and I'm not able to. I see this in the console:

> Scam Warning: Take care when pasting things you don’t understand. This could allow attackers to steal your identity or take control of your computer. Please type ‘allow pasting’ below (no need to press enter) to allow pasting.
Oh now that I'm reading it carefully, I see there's a way to enable it!

santialbo3 replies#
I've got a pooping person hm
rbanffy1 reply#
I didn't see it as that until you mentioned it.
zagrebian2 replies#
You got a piranha plant.
mft_1 reply#
...and I have... um... an octopus carrying a block of wood?

Continue this thread — 1 reply

nannal1 reply#
I think you have a storm trooper.

Continue this thread — 1 reply

snek_case#
Yeah I thought it was a tribal ritual man sort of thing... but now that you mention it...
Normille#
I seem to be the Github Octocat
jvzr#
I have opened a merge request on Refined Hacker News (https://github.com/plibither8/refined-hacker-news) which is a pretty great HN extension for Firefox and other browsers. Thank you to OP

Edit: I'm pretty pleased with my blue Space Invader!

Load more comments