Created
November 3, 2011 14:02
-
-
Save leobalter/1336552 to your computer and use it in GitHub Desktop.
Konami Code + Unicorns
This file contains hidden or 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
var konami = {}; | |
konami.keys = []; | |
konami.string = '38,38,40,40,37,39,37,39,66,65'; | |
konami.check = function(e) { | |
konami.keys.push(e.keyCode); | |
// no memory abuses | |
if (konami.keys.length > 10) { | |
konami.keys.shift(); | |
} | |
if (konami.keys.toString().indexOf(konami.string) >= 0){ | |
$(document).unbind('keydown', konami.check); | |
konami.callback(); | |
} | |
}; | |
// change this function content if you want anything else than unicorns | |
// but, really?! What would you want but unicorns! | |
konami.callback = function() { | |
$.getScript('http://www.cornify.com/js/cornify.js',function(){ | |
cornify_add(); | |
$(document).bind('keydown', cornify_add); | |
}); | |
}; | |
// all set, start it | |
$(document).bind('keydown', konami.check); | |
This file contains hidden or 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
(function(a){var b={};b.keys=[],b.string="38,38,40,40,37,39,37,39,66,65",b.check=function(c){b.keys.push(c.keyCode),b.keys.length>10&&b.keys.shift(),b.keys.toString().indexOf(b.string)>=0&&(a(document).unbind("keydown",b.check),b.callback())},b.callback=function(){a.getScript("http://www.cornify.com/js/cornify.js",function(){cornify_add(),a(document).bind("keydown",cornify_add)})},a(document).bind("keydown",b.check)})(jQuery) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment