1
0
mirror of https://github.com/hexolan/konami-code-snippets.git synced 2026-05-20 03:29:22 +01:00
Files
konami-code-snippets/examples/direct-nolib.html
T
hexolan 8c64c67c80 feat: expand examples
fix: library usage
2026-04-03 19:31:59 +01:00

19 lines
760 B
HTML

<html>
<head>
<title>Konami Code Snippets: Direct Usage</title>
</head>
<body>
<p>Konami Code</p>
<script>
const konamiSequence = ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "b", "a"]; let konamiStep = 0, handleKonami = callback => e => { konamiSequence[sequenceStep] === e.key ? (konamiStep += 1, konamiStep === konamiSequence.length && (konamiStep = 0, callback())) : konamiStep = 0 };
function konamiCallback() {
window.location.href = `https://github.com/hexolan/konami-code-snippets`;
}
document.addEventListener("keydown", handleKonami(konamiCallback));
</script>
</body>
</html>