Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Javascript to trigger easter egg
var easterEggKeys = new Array('j','i','b','b','y');
var easterEggCurrent = 0;
$(window).keydown(function(e){
var key = String.fromCharCode(e.keyCode).toLowerCase();
if (easterEggKeys[easterEggCurrent].toLowerCase() == key) {
easterEggCurrent++;
if (easterEggCurrent >= easterEggKeys.length) {
$('body').append('<embed src="http://mattread.com/examples/midi/sinfon1.mid" autostart="true" hidden="true" type="audio/midi">');
for (var i = 0; i < document.styleSheets.length; i++) { document.styleSheets[i].disabled = true; }
easterEggCurrent = 0;
}
}
else {
easterEggCurrent = 0;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment