mirror of
https://github.com/resendecode/nuitdelinfo.git
synced 2026-07-09 15:17:50 +00:00
pour toi loulou2
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
const allowedKeys = {
|
||||
37: 'left',
|
||||
38: 'up',
|
||||
39: 'right',
|
||||
40: 'down',
|
||||
65: 'a',
|
||||
66: 'b',
|
||||
};
|
||||
|
||||
const konamiCode = [
|
||||
'up',
|
||||
'up',
|
||||
'down',
|
||||
'down',
|
||||
'left',
|
||||
'right',
|
||||
'left',
|
||||
'right',
|
||||
'b',
|
||||
'a',
|
||||
];
|
||||
|
||||
let konamiCodePosition = 0;
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
let key = allowedKeys[e.keyCode];
|
||||
let requiredKey = konamiCode[konamiCodePosition];
|
||||
|
||||
if (key === requiredKey) {
|
||||
konamiCodePosition++;
|
||||
|
||||
if (konamiCodePosition === konamiCode.length) {
|
||||
activateCheats();
|
||||
konamiCodePosition = 0;
|
||||
}
|
||||
} else konamiCodePosition = 0;
|
||||
});
|
||||
|
||||
const activateCheats = () => {
|
||||
alert('cheats activated');
|
||||
// TODO redirect to easter egg page
|
||||
};
|
||||
Reference in New Issue
Block a user