Created
September 5, 2013 14:21
-
-
Save scottstanfield/6450745 to your computer and use it in GitHub Desktop.
cornify.js: konami code with rainbows and unicorns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Modified to 'a a' instead of 'b a' due to vimium conflict | |
// ▲ ▲ ▼ ▼ ◀ ▶ ◀ ▶ a a | |
// example page: http://yckart.github.io/jquery.konami.js/ | |
// | |
var kkeys = [], konami = "38,38,40,40,37,39,37,39,65,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); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Taken from: http://www.paulirish.com/2009/cornify-easter-egg-with-jquery/
Reusable code: https://github.com/yckart/jquery.konami.js