Last active
August 29, 2015 14:02
-
-
Save 2get/0ea495a4002031331abb to your computer and use it in GitHub Desktop.
konami.coffee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showKonami = -> | |
alert 'KONAMI' | |
inputs = [] | |
input = (e) -> | |
inputs.push(e.keyCode) | |
if e.keyCode is 65 | |
len = inputs.length | |
if inputs[len - 10] is 38 and inputs[len - 1] is 65 | |
if [38, 38, 40, 40, 37, 39, 37, 39, 66, 65].join('') is inputs.slice(len - 10, len).join('') | |
showKonami() | |
document.body.addEventListener('keyup', input, false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment