Skip to content

Instantly share code, notes, and snippets.

@MattRead
Created March 20, 2013 23:56
Show Gist options
  • Save MattRead/5209607 to your computer and use it in GitHub Desktop.
Save MattRead/5209607 to your computer and use it in GitHub Desktop.
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