Skip to content

Instantly share code, notes, and snippets.

@djalmaaraujo
Created July 12, 2012 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djalmaaraujo/3100138 to your computer and use it in GitHub Desktop.
Save djalmaaraujo/3100138 to your computer and use it in GitHub Desktop.
konamy
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