Coffeehouse Thread

13 posts

1k Javascript Minecart Ride

Back to Forum: Coffeehouse
  • User profile image
    sysrpl
  • User profile image
    Bas

    Ha, that was awesome. Thanks!

  • User profile image
    ZippyV

    Wtf?

    <html><head>
            <title>1k javasript demo</title>
            <meta charset="utf-8">
        </head>
        <body marginwidth="0" marginheight="0" bgcolor="0">
            <canvas id="c" height="953" width="953"></canvas>
            <script>
                var b = document.body;
                var c = document.getElementsByTagName('canvas')[0];
                var a = c.getContext('2d');
                document.body.clientWidth;
            </script>
            <script>
    _="b.bgColor=X=Y=H=I=J=E=Q=U=V=0;T=[l=1];C=(c.width=c.h_=innerH_)/2;setInterval(function(` i=H;i<X+1;H=++i`(s=8j)
    (D=i/80P=D&1-Q+(Q=5$K=OD(K+2+(5))%3-1,B=OD>9!BkW=1@*-1EF=(s<160)-(s>639=[IJ,JK,UV,V=P*E,O(L=-2j)*L^3)/1 ,95];if(10==0` y=Z=9@+z=W*g=/6;g<6.3;g2/Z)>(P
    B?.4:)>.5)1.1*Z*+11)4-F,Z*)+24-F t=2*,w=t*t*/6;B*w>.2;)tw,- ,tw*=@, Q
    B*W>.62*,1./21+!B
    -    ,    -6@,@L
    0.ZZ+z-Ak.A.6P
    B
    (40
    -,$1k8,3))}5
    -6)} q=T[X%1];d=--i-X;) ,f=C/(d/10+3$v=g=tux=GNl=G?g++l:G?3:1$y=d/18j;z=,w=G;`v!=w(v=w,#Style='hsl(0%,'+16Nw&7)Nw&8
    y+xNw<16))+'%)'#Rect(t+z-(z=)/u-+(w==12f*6*+X/)$z,)}Y4-3*X/)+q[2]^4;X=0|Y},35)random()p.push([g++]cos(g=C+fNp[g]-q-d*q)^3,,7+B*1 .A4j    2 -kZ-8-z
    || for(Math.&&6,i%f*G);>.+z,Z*-Z20
    2,p=T[1]1 A14B*E/1A -6 .0,+=exp(- -y1.1#a.fill$),@.8A5,GpN*(O!P^/3e_eight`){j00k7,";for(Y=0;$="kj`_^ONGA@$#  
         "[Y++];)Z=_.split($),_=Z.join(Z.pop());eval(_)
            </script>
    
    </body></html>

  • User profile image
    PopeDai

    Minified JavaScript. It does kinda take away the sense of accomplishment of hitting 1KB.

  • User profile image
    Bas

    document.body.clientWidth;

    What's that line doing there?

  • User profile image
    Sven Groot

    , Bas wrote

    1
    document.body.clientWidth;

    What's that line doing there?

    Causing the script to crash early when the browser doesn't support that property? Otherwise, I have no idea.

  • User profile image
    MasterPi

    @PopeDai: It's a bit more than minified. Minified scripts are still readable, with only variables shortened and linebreaks removed. This is far more compressed.

  • User profile image
    exoteric

    Nice!  Cool

  • User profile image
    Bas

    It's a bit of a cop-out that they're not counting the javascript code in the first script block, though. It's over 1K if you count that.

    Still awesome, of course.

  • User profile image
    Bass

    @ZippyV:

    Isn't that how everyone programs JavaScript?

  • User profile image
    PopeDai

    , Bass wrote

    @ZippyV:

    Isn't that how everyone programs JavaScript?

    I remember when no-one used anonymous functions, everything was named. With the adoption of jQuery more developers are realizing how creative they can be with the language's syntax (recursively-nested functions, arbitrary scoping, etc). It's a far cry from BraveNet Scripts.

  • User profile image
    cheong

    Works in my Lumia 920 too.

    But I feel it's a bit slow.

    Recent Achievement unlocked: Code Avenger Tier 4/6: You see dead program. A lot!
    Last modified
  • User profile image
    Harlequin

    Just trying to go through that JavaScript I feel like I'm staring at matrix source code...

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.