Created
July 20, 2010 19:59
-
-
Save amiel/483472 to your computer and use it in GitHub Desktop.
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
$.konami = (function() { | |
var cheatPos = 0, | |
konami_event = 'konami', | |
konami = function(fn) { | |
$(window).bind(konami_event, fn); | |
}; | |
konami.cheat = [38,38,40,40,37,39,37,39,66,65]; | |
$(document).bind('keydown',function(e) { | |
if (e.keyCode == konami.cheat[cheatPos]) ++cheatPos; else cheatPos = 0; | |
if (cheatPos == konami.cheat.length) $.event.trigger(konami_event); | |
}); | |
return konami; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment