Created
March 20, 2013 23:56
-
-
Save MattRead/5209607 to your computer and use it in GitHub Desktop.
Javascript to trigger easter egg
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
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