Konami Code

A quick excerpt from the custom JavaScript on the jQuery main website:

// Hehe.
if ( window.addEventListener ) {
        var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
        window.addEventListener("keydown", function(e){
                kkeys.push( e.keyCode );
                if ( kkeys.toString().indexOf( konami ) >= 0 )
                        window.location = "http://ejohn.org/apps/hero/";
        }, true);
}

In practice, this means that if you press “↑↑↓↓←→←→BA” while on the jQuery page, you will be redirected to some kind of guitar hero game. It’s a bit sloppy, though: the kkeys array will increase in size with every keypress, which means the page will get slower and slower as you press keys. Nothing problematic, since nobody sane would be doing this anyway.

If you’re wondering, this sequence is the konami code. You can find more websites supporting it here:

http://www.konamicodesites.com/

0 Responses to “Konami Code”


  1. No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



1150 feed subscribers
(readers who polled a feed this week)