Small tweaks
- Replaced traichu SVG with an animated PNG - Added Konami code easter egg - Fixed Cube Cobra typo
This commit is contained in:
+35
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user