Small tweaks

- Replaced traichu SVG with an animated PNG
- Added Konami code easter egg
- Fixed Cube Cobra typo
This commit is contained in:
Tressley Cahill
2022-10-24 11:29:34 -04:00
parent 4dcfa06f90
commit 74b1a28e1c
5 changed files with 52 additions and 7 deletions
+35 -1
View File
@@ -6,4 +6,38 @@ function dateTime () {
setTimeout(dateTime, 1000)
}
dateTime()
var konamiCode = [
'ArrowUp',
'ArrowUp',
'ArrowDown',
'ArrowDown',
'ArrowLeft',
'ArrowRight',
'ArrowLeft',
'ArrowRight',
'b',
'a'
]
var currentKey = 0
var keyHandler = function (event) {
// If the key isn't in the pattern, or isn't the current key in the pattern, reset
if (konamiCode.indexOf(event.key) < 0 || event.key !== konamiCode[currentKey]) {
currentKey = 0
return
}
// Update how much of the pattern is complete
currentKey++
// If complete, alert and reset
if (konamiCode.length === currentKey) {
currentKey = 0
document.getElementById('traichu-running').classList.add('slide')
setTimeout(function () {
document.getElementById('traichu-running').classList.remove('slide')
}, 4250);
}
}
// Listen for keydown events
document.addEventListener('keydown', keyHandler, false)