insane javascript implementation of stanley.lieber's bullshit from plan9front