Created
August 18, 2015 12:27
-
-
Save jadwigo/0bed8ed97bd0874d37e8 to your computer and use it in GitHub Desktop.
How to add a konamicode to your jqueries
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
// Konami code block | |
jQuery(function( $ ){ | |
if ( window.addEventListener ) { | |
var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
window.addEventListener("keydown", function(e){ | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
console.log('> Someone entered Konami Code. Quickly, do something cool!') | |
console.log('< Do something cool?'); | |
console.log('> Yes!, Quickly!'); | |
console.log('< Sorry, do you have any ideas?'); | |
console.log('> Make the print page a treasure map!'); | |
console.log('< Sorry, we tried that, but then the print page changed a little, so it broke'); | |
console.log('> Aw really?'); | |
console.log('< Yup.. maybe later we will fix it, but at the moment it does not work.. sorry.'); | |
// do something here | |
kkeys = []; | |
} | |
}, true); | |
} | |
}); | |
// end Konami code block |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment