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

Show all comments

Showing thread 2 of 108

INTPenis8 replies#
Hah! I got a really cool little icon that looks almost like the cassette tape pirate logo of Piratbyrån back in the day. I have old t-shirts with that logo.

MAKE. THIS. PERMANENT!
On the functional side, this really helps you see who is who in a long threaded discussion. Your eye is much quicker at following the little color icons than their names.

hwers1 reply#
I'm gonna go ahead and vote no on this.
INTPenis2 replies#
But your avatar looks like a Ninja Turtle with shades on. You should be enjoying this. :)
k4rli4 replies#
Likely still traumatized by existence of new reddit UI. Old appears to be better.

Continue this thread — 4 replies

neogodless#
Wow, I thought it was a green camper van!
Cthulhu_2 replies#
It should be fairly straightforward to turn this into a browser addon, give users a choice and offload the people behind HN.
edmcnulty1012 replies#
What is a user script?

Continue this thread — 2 replies

libele1 reply#

  // ==UserScript==
  // @name        HN Avatars in 357 bytes
  // @description Annotated avatars on all HN comments.
  // @author      tomxor (https://news.ycombinator.com/user?id=tomxor)
  // @namespace   https://news.ycombinator.com/item?id=30668137
  // @include     https://news.ycombinator.com/item*
  // @include     https://news.ycombinator.com/user*
  // @grant       none
  // @version     1.0.0
  // ==/UserScript==

  [js goes here]

Continue this thread — 1 reply

rb666#
Doesn't work on FF does it?
bertman4 replies#
>MAKE. THIS. PERMANENT!

I second this. (Also I wanted to see what my avatar looks like, sry)

david927#
How dare you! Edit: ooooh, mine's a beetle!
gaetgu1 reply#
Truly unacceptable. (I look like an alien head!)
ChrisClark9 replies#
But Space Invaders is a classic!

Continue this thread — 9 replies

romellem1 reply#
This is fun, and can easily be added as a userscript. I might look to do that a little later.
notsound3 replies#
// ==UserScript== // @name HN icons // @namespace https://news.ycombinator.com/* // @version 0.1 // @description try to take over the world! // @author some people on HN // @match https://news.ycombinator.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // ==/UserScript==

(function() { // Initial concept is from: https://news.ycombinator.com/item?id=30668137 (tomxor) // The script we are using is from: https://news.ycombinator.com/item?id=30670079 (onion2k) 'use strict'; let observer = new IntersectionObserver( (entries) => { entries.forEach((entry, i) => { if (entry.isIntersecting) { const p = 2; const c = document.createElement('canvas'); const x = c.getContext('2d'); c.width = 18; c.height = 14; const s = entry.target.innerText; const r = 1;

            if (s) {
            for (
                let s = entry.target.innerText, r = 1, i = 28 + s.length;
                i--;

            ) {
                // xorshift32
                (r ^= r << 13), (r ^= r >>> 17), (r ^= r << 5);
                const X = i & 3,
                Y = i >> 2;
                if (i >= 28) {
                // seed state
                r += s.charCodeAt(i - 28);
                x.fillStyle =
                    '#' + ((r >> 8) & 0xffffff).toString(16).padStart(0, 6);
                } else {
                // draw pixel
                if (r >>> 29 > (X * X) / 3 + Y / 2)
                    x.fillRect(p * 3 + p * X, p * Y, p, p),
                    x.fillRect(p * 3 - p * X, p * Y, p, p);
                }
            }
            }

            entry.target.prepend(c);
        } else {
            if (entry.target.firstChild.tagName === 'CANVAS')
            entry.target.firstChild.remove();
        }
        });
    },
    { rootMargin: '0px 0px 0px 0px' }
    );

    document.querySelectorAll('.hnuser').forEach((user) => {
    observer.observe(user);
    });
})();

Continue this thread — 3 replies

simcop2387#
This should be pretty easy to make into a userscript if browsers still support that. I haven't checked on that in half a decade or so

also i wanted to see mine too

WithinReason#
> Hah! I got a really cool little icon that looks almost like the cassette tape pirate logo of Piratbyrån back in the day.

I think it's a skeleton holding his arms up!
edit: Looks like I'm some green bug-monster

MisterSandman4 replies#
I do feel like HN needs avatars of some kind... just don't know if they should be customizable or fixed (like this one).
MisterSandman#
Looks like I got blue transformer/reinhardt
INTPenis#
Definitely not customizable, that's chaos.

Unique, fixed little color doodads make it easier to see who's who in a thread.

Duralias#
With how pretty much every platform has "avatars", that the user can customize, I think it would be fun just getting one assigned to you.

Edit: Huh, I got an alien house. Reminds me of some game.

sexangel1 reply#
I'm for the fixed avatars. We are all born with certain unchangeable aspects.
MisterSandman#
Hey man, we were just discussing avatars, not trying to create an existential crisis.

Continue this thread — 3 more replies