Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Created April 30, 2019 00:05
Show Gist options
  • Save Sawtaytoes/6655285274f8685eb34405fc08de232f to your computer and use it in GitHub Desktop.
Save Sawtaytoes/6655285274f8685eb34405fc08de232f to your computer and use it in GitHub Desktop.
/* Type the word "exit" in any point of your page... */
(function () {
const sSecret = /* Choose your hidden word...: */ "exit";
let nOffset = 0;
document.onkeypress = function(oPEvt) {
let oEvent = oPEvt || window.event,
nChr = oEvent.charCode,
sNodeType = oEvent.target.nodeName.toUpperCase();
if (nChr === 0 ||
oEvent.target.contentEditable.toUpperCase() === "TRUE" ||
sNodeType === "TEXTAREA" ||
sNodeType === "INPUT" && oEvent.target.type.toUpperCase() === "TEXT") {
return true;
}
if (nChr !== sSecret.charCodeAt(nOffset)) {
nOffset = nChr === sSecret.charCodeAt(0) ? 1 : 0;
} else if (nOffset < sSecret.length - 1) {
nOffset++;
} else {
nOffset = 0;
/* Do something here... */
alert("Yesss!!!");
location.assign("https://developer.mozilla.org/");
}
return true;
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment