Keystroke Easter Egg

by Scott Currell

HTML

<h1>Secret keystroke</h1>

<p>Type 'god' for god mode</p>
<div id="info"></div>

CSS

body {    
    font-family: "Arial";
}

h1 {
    font-size: 23px;
    font-weight: bold;
    margin-bottom: 2em;
}

p {
    font-size: 10px;
    color: blue;
}

JavaScript

var secret = "717968"; //god
var input = "";
var timer;
var mode = false;

$(document).keyup(function(e) {
    input += e.which;    
    
    clearTimeout(timer);
    timer = setTimeout(function() { input = ""; }, 200);
    
    check_input();
});

function check_input() {
    if(input == secret) {
        //the secret code
        console.log('GOD MODE UNLOCKED');
    }
}

$(document).ready(function() {
    setInterval(function() { $('#info').html('Keystroke: ' + input); }, 100);
});