Created
November 27, 2013 23:09
-
-
Save kkemple/7684670 to your computer and use it in GitHub Desktop.
allows you to execute code after client correctly enters konami code
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
;(function( $, window, document, undefined ) { | |
var keys = [], | |
konami = '38,38,40,40,37,39,37,39,66,65', | |
timer = 0; | |
$( document ).keydown(function( e ) { | |
keys.push( e.keyCode ); | |
if ( keys.toString().indexOf( konami ) >= 0 ){ | |
// do something when the konami code is executed | |
keys = []; | |
} | |
timer = setTimeout(function() { | |
keys = []; | |
}, 5000); | |
}); | |
})( jQuery, this, this.document ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment