Last active
December 29, 2015 03:19
-
-
Save moimikey/7606776 to your computer and use it in GitHub Desktop.
KONAMIIIIIIIIIIII KYYYYAHHHHHHHHHHHHH!!!!
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
@MM.module 'EasterEggApp', (EE, App, Backbone, Marionette, $, _) -> | |
# up, up, down, down, left, left, right, right, a, enter | |
EE.sequence = [38, 38, 40, 40, 37, 37, 39, 39, 65, 13] | |
EE.pressed = [] | |
EE.on | |
'start': -> | |
$(window).on 'keyup.konami', EE.pressedKey | |
'stop': -> | |
$(window).off '.konami' | |
EE.pressedKey = (evt) => | |
EE.pressed.push evt.keyCode ? evt.which | |
diff = _.difference EE.sequence, EE.pressed | |
len = EE.pressed.length - 1 | |
EE.pressed.length = 0 if EE.pressed[len] isnt EE.sequence[len] or diff.length is 0 | |
EE.surprise() if diff.length is 0 | |
EE.surprise = -> | |
console.log 'KONAMIIIIIIIIIIII' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment