With the recent attention surrounding ESPN and their use of the Konami Code, I thought it would be fun to make a JavaScript library that allowed everyone to take advantage of this time-honored cheat code:
http://konami-js.googlecode.com
By adding just a few lines to your site, you can set it up so the Konami Code does… Well, pretty much anything! The default behavior is to load a new web page, but if you’re fluent in JavaScript, you can change the konami.code() method to do whatever you want. Checkout some konami-js examples.
Try entering it now: Up, Up, Down, Down, Left, Right, Left, Right, B, A, Enter
{ 10 comments… read them below or add one }
Nice work!
FYI the espn site was using some code from here: http://paulirish.com/2009/cornify-easter-egg-with-jquery/
Maybe there are some ideas in there you can use.
This is certainly awesome though. More sites need something cool under their konami.
Cheers
Thanks Paul. When I started making it originally I was going to use jQuery, but then I thought it would be cool if it didn’t have any dependencies. I didn’t look at the ESPN code at all, so it’s interesting to see where our solutions are similar and where they diverge. Your array approach probably makes more sense than my use of setTimeout(). The anal retentive person in me didn’t like the idea of continuously adding to a variable every time the user pressed a key, although I suppose it doesn’t much matter.
I’m thinking Konami needs to evolve into some sort of new interface standard, to the point where it’s strange when a site doesn’t make use of it…
I could not agree more.
Nice! I hope you don’t mind if I start spreading the word. Obviously, all credit goes to you.
Wow, super awesome work man!
This is also a good code base for making other “combos”
Yeah, you can do quite a bit more with it if you’re so inspired. You inspired me to update the code slightly just now. Instead of the Konami Code being hard-wired into the if statement it’s stored in konami.pattern. The default sets it to the Konami Code, but if you want to redefine it on the fly you can do that now, so long as you know the keyCodes.
I am trying to set up something using Konami on my site. I have been able to get it to go to another page and whatnot, but can anybody help me get it to play an audio clip from an online source when the sequence is entered?
Hi Kevin,
You should check out:
http://www.schillmania.com/projects/soundmanager2/
You could easily setup the “konami” event to trigger a sound this way.
I think you should change the condition to “konami.input.indexOf(“3838404037393739666513″)!=-1) “, because sometimes you mess up and try to do it again (:
@Joa – I think you’re right. The setTimeout() is kind of silly and I’m not sure what prompted me to do that.
I actually tweaked the code this morning to use that approach, as well as enable creating “multiple” easter eggs with different key combinations. Stay tuned!