Free javascript Hosting


colincode.js

Uploaded on Nov 19 2021 22:34 by vopowi8291

// a key map of allowed keys
var allowedKeys = {
80: 'p',
65: 'a',
83: 's',
67: 'c',
76: 'l',
79: 'o',
73: 'i',
78: 'n'
};

// the 'official' Konami Code sequence
var konamiCode = ['p', 'a', 's', 'c', 'a', 'l', 'c', 'o', 'l', 'i', 'n'];

// a variable to remember the 'position' the user has reached so far.
var konamiCodePosition = 0;

// add keydown event listener
document.addEventListener('keydown', function (e) {
// get the value of the key code from the key map
var key = allowedKeys[e.keyCode];
// get the value of the required key from the konami code
var requiredKey = konamiCode[konamiCodePosition];

// compare the key with the required key
if (key == requiredKey) {

// move to the next key in the konami code sequence
konamiCodePosition++;

// if the last key is reached, activate cheats
if (konamiCodePosition == konamiCode.length) {
activateCheats();
konamiCodePosition = 0;
}
} else {
konamiCodePosition = 0;
}
});

function activateCheats() {
window.open("https://media.discordapp.net/attachments/689116867096477702/911276048249933834/colin-300x300.png", '_blank')
}

Back to list