Cornify Konami easter egg plugin with jQuery
No doubt you've heard that Cornifying is the latest and greatest invention of the internet.
Now you can surreptitiously add it to your own sites, joining The Underground Cabal of Mirthful Protectors of the Corn:
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; $(document).keydown(function(e) { kkeys.push( e.keyCode ); if ( kkeys.toString().indexOf( konami ) >= 0 ){ $(document).unbind('keydown',arguments.callee); $.getScript('http://www.cornify.com/js/cornify.js',function(){ cornify_add(); $(document).keydown(cornify_add); }); } });
After a user hits the Konami code (up,up,down,down,left,right,left,right,b,a), every other keystroke will add happiness to the world.
You'll find this website has already been enabled. Try it out. :)
2010.05.29: BoingBoing will probably add it. And yeah this feature kinda triggered a meme. :p
2012.03.22: Gunnar Hoffman wrote a better implementation: http://paulirish.com/2009/cornify-easter-egg-with-jquery/#comment-68011
LOL. That is awesome.
This is hilarious – the most useful thing I've read in a long time!
HAHA! That's the best thing I've seen all week.
Best. Friday. post. ever.
This made my day.
That is so completely useless that I love it.
I love it!
Awesome! I'm going to have to memorize the secret key sequence XD
The problem with this code is that when I hit b and a in Safari 4, it automatically brings up the search bar and it puts the b and a into the search and starts looking for all words on the page that start with "ba"
And whatever this code is supposed to do, I have yet to see it in action…..Quite sad really :-(
Where should the code be put in the site for it to work?
Bonnie, if you include jQuery,
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>Then you can just do
yeah, can you get us a "how to install this code for dummies" version? i'd like to try it on my site.
how do you get the pictures on top of everything and not expand the page downwards? I'm trying to get it like the espn page.
Anyone know how to do it in PHPBB3?
Tried this on my personal site (in the section in the index.html) as well as my vbulletin site (inside the index.php) and cant get it working. I also included the link #10 above showed, which I still cant get to work
hahaha! that's really cool. what's up with the weird domain names you're putting out? they area breaking my regex lol
Installed this on my web site but it only works if you first click inside the site with the mouse… some kind of focus issue?
So awesome it hurts! THANX!
That's pretty awesome. I released a similar piece of code at konami-js.googlecode.com. It's a slightly different approach, but it doesn't use jQuery or have any of the pretty unicorns and rainbows – but you can always add them!
@Alex
Firefox does the same thing. You can go into Tools –> Settings and on the advanced tab, there is an option for turning off "find text when I start typing" or something similar.
Hey thanks that was awesome, I took the code and made some custom changes
Thanks again
Nice. But, How do i stop it?
I want to find good pop music. Help me please.
No unicorns, but check out the code on http://www.scribendi.com/news
This plugin/script doesn't work any more.
How do you get the button to work? I copied it onto my blog, but when you click on it, it just goes to cornify.com. And can you explain the Konami code to me please. I like this website, and I was wondering how you got those thingies on the sides of your website that like scribble where ever your mouse goes. Sorry, I ask a lot of questions.. :)
I would like to suggest the following code because it will perform better over long periods of time if your users type many thousands of characters. It's memory footprint does not increase and has no string comparisons.
You know what's funny Paul, your snippet here is what I used to make the #plaidirish easter egg that's on the Isobar standards page, modified with diff script src and key codes. Adds to the awesomeness of the easter egg lol
@Gunnar Hoffman
I'm glad /somebody/ knows what they're talking about. Paul's code is ridiculously inefficient for something so simple.
@Gunnar Hoffman
Thx gunnar. Certainly better.
My original implementation stole code from Resig but this was all 3+ years ago. so yeah.. pretty bad. :)
Hello! I have a question concerning security: I’d like to build something similar (a collection of easter eggs / gimmicks for websites e.g. visitor counters, watches, scroll-o-meters etc.) as my thesis project in communication design.
Aren’t there any security issues when fetching a script from a remote server like cornify does?
There is much talk about security of JSONP but nowhere the words "cornify" and "security" appear together.