Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CU Online Easter Eggs
var beetlejuice = "6669698476697485736769";
var konami = "38384040373937396665";
var input = "";
var timer;
//The following function sets a timer that checks for user input. You can change the variation in how long the user has to input by changing the number in ‘setTimeout.’ In this case, it’s set for 500 milliseconds or ½ second.
window.addEventListener("keyup", function(e) {
input += e.which;
clearTimeout(timer);
timer = setTimeout(function() { input = ""; }, 500);
check_input();
}, false);
//Once the time is up, this function is run to see if the user’s input is the same as the secret code
function check_input() {
switch (input) {
case beetlejuice:
var audio = new Audio('beetlejuice.mp3');
audio.play();
break;
case konami:
alert("Straight A's unlocked!");
break;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.