Skip to content

Instantly share code, notes, and snippets.

@jgrevich
Created January 7, 2015 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgrevich/bf74caa54982bca8c486 to your computer and use it in GitHub Desktop.
Save jgrevich/bf74caa54982bca8c486 to your computer and use it in GitHub Desktop.
konami code easter egg in js
$(function () {
// konami code - up up down down left right left right b a
var code1 = String.fromCharCode(38, 38, 40, 40, 37, 39, 37, 39, 66, 65);
var code2 = String.fromCharCode(38, 38, 40, 40, 37, 39, 37, 39, 65, 66);
var codeBuffer = "";
$(document).keyup(function (e) {
codeBuffer += String.fromCharCode(e.which);
if (code1.substring(0, codeBuffer.length) == codeBuffer) {
if (code1.length == codeBuffer.length) {
toggle1();
codeBuffer = String.fromCharCode(38, 38, 40, 40, 37, 39, 37, 39, 66);
}
} else if (code2.substring(0, codeBuffer.length) == codeBuffer) {
if (code2.length == codeBuffer.length) {
toggle2();
codeBuffer = "";
}
} else {
codeBuffer = "";
}
});
function toggle1() {
var $body = $("body");
if ($body.raptorize) {
$body.raptorize();
} else {
$("head").append('<script src="/_/logic/jquery.raptorize.1.0.js?'+Math.random()+'"></script>');
}
}
function toggle2() {
window.DEBUG_FLAG = !window.DEBUG_FLAG;
window.DEBUG_FILTER_INCLUDE = null;
window.DEBUG_FILTER_EXCLUDE = null;
window.DEBUG_TO_CONSOLE = false;
window.logInited=true;
updateConsoleVisibility();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment