Created
July 12, 2012 18:57
-
-
Save djalmaaraujo/3100138 to your computer and use it in GitHub Desktop.
konamy
This file contains 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
YUI.add("konami", function (Y) { | |
Y.Event.define('konami', { | |
on: function (node, sub, notifier) { | |
var kkeys = [], | |
konami = "38,38,40,40,37,39,37,39,66,65"; | |
Y.one(document).on('keydown', function(e) { | |
kkeys.push( e.keyCode ); | |
if ( kkeys.toString().indexOf( konami ) >= 0 ){ | |
Y.one(document).detach('keydown', arguments.callee); | |
notifier.fire(); | |
} | |
}); | |
}, | |
detach: function (node, sub, notifier) { | |
node.detach(); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment