Show HN: HN Avatars in 357 bytes
701 pointsPaste 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 commentsMight try this one: https://chrome.google.com/webstore/detail/violentmonkey/jinj... I just installed it and it seems to work well.
[0]: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web...
[1]: https://github.com/mdn/webextensions-examples/tree/master/bo...
Continue this thread — 2 replies
> 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!
Continue this thread — 1 reply
Continue this thread — 1 reply
Edit: I'm pretty pleased with my blue Space Invader!
All comments shown.
Couldn't load more comments. Check your connection and try again.