js obfuscation

http://stackoverflow.com/questions/18834309/how-does-this-obfuscated-javascript-work?newsletter=1&nlcode=26490|fca0

by refhat

JavaScript

z='p="<"+"pre>"/* ,.oq#+     ,._, */;for(y in n="zw24l6k\
4e3t4jnt4qj24xh2 x/* =<,m#F^    A W###q. */42kty24wrt413n243n\
9h243pdxt41csb yz/* #K       q##H######Am */43iyb6k43pk7243nm\
r24".split(4)){/* dP      cpq#q##########b, */for(a in t=pars\
eInt(n[y],36)+/*         p##@###YG=[#######y */(e=x=r=[]))for\
(r=!r,i=0;t[a/*         d#qg `*PWo##q#######D */]>i;i+=.05)wi\
th(Math)x-= /*        aem1k.com Q###KWR#### W[ */.05,0>cos(o=\
new Date/1e3/*      .Q#########Md#.###OP  A@ , */+x/PI)&&(e[~\
~(32*sin(o)*/* ,    (W#####Xx######.P^     T % */sin(.5+y/7))\
+60] =-~ r);/* #y    `^TqW####P###BP           */for(x=0;122>\
x;)p+="   *#"/* b.        OQ####x#K           */[e[x++]+e[x++\
]]||(S=("eval"/* l         `X#####D  ,       */+"(z=\'"+z.spl\
it(B = "\\\\")./*           G####B" #       */join(B+B).split\
(Q="\'").join(B+Q/*          VQBP`        */)+Q+")//m1k")[x/2\
+61*y-1]).fontcolor/*         TP         */(/\\w/.test(S)&&"#\
03B");document.body.innerHTML=p+=B+"\\n"}setTimeout(z)'

// p is the output string
p = "<" + "pre>";

// split string in to base-36 numbers, deliniated by `4`
for (y in n = "zw24l6k4e3t4jnt4qj24xh2 x42kty24wrt413n243n9h243pdxt41csbyz43iyb6k43pk7243nmr24".split(4)) {
    
    // parse base-36 numbers; set x, e, and r to new array each loop
    for (a in t = parseInt(n[y], 36) + (e = x = r = []))
        
        // iterate over the properties of each Number (unsure what purpose this serves)
        for (r = !r, i = 0; t[a] > i; i += .05)
            
          // !!! this seems to be where the magic happens; e, x, and r are populated !!!
          with(Math) x -= .05, 0 > cos(o = new Date / 1e3 + x / PI) && (e[~~(32 * sin(o) * sin(.5 + y / 7)) + 60] = -~r);

    
    // let's build the output string
    for (x = 0; 122 > x;) {
        // decide whether to place a space, star, or hash mark by index value `[x++] + e[x++]`
        p += "   *#"[e[x++] + e[x++]] ||
            
            // if the index is out of bounds, the value is undefined...