Skip to content

Instantly share code, notes, and snippets.

@dodopok
Created March 1, 2013 19:11
Show Gist options
  • Save dodopok/5066986 to your computer and use it in GitHub Desktop.
Save dodopok/5066986 to your computer and use it in GitHub Desktop.
Konami Code - Precisa do jQuery
$(document).ready(function(){
var keys = [];
var konami = '38,38,40,40,37,39,37,39,66,65';
$(document)
.keydown(
function(e) {
keys.push( e.keyCode );
if ( keys.toString().indexOf( konami ) >= 0 ){
$('body').append('<audio autoplay="autoplay" style="display:none;"><source src="/files/mp3/marcha_imperial.mp3" type="audio/mp3" /></audio>');
// empty the array containing the key sequence entered by the user
keys = [];
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment