Skip to content

Instantly share code, notes, and snippets.

@kaneel
Created April 30, 2013 09:28
Show Gist options
  • Save kaneel/5487629 to your computer and use it in GitHub Desktop.
Save kaneel/5487629 to your computer and use it in GitHub Desktop.
konamimyass :) Replace sicritW with whatever encoded as character numbers you want
;(function(root, $, ns) {
var w = root.window,
d = root.document,
MBX = !!w[ns] ? w[ns] : w[ns] = {},
sicritW = "", // here you put your character table _ already encoded as numbers _
letters = [],
timerINYOFACE = null,
jDoc = $(d);
jDoc.on("keyup", function(e) {
letters.push(e.keyCode);
if (letters.join("").substr(-1*(sicritW.length)) == sicritW) {
// do something
}
w.clearTimeout(timerINYOFACE);
timerINYOFACE = w.setTimeout(function() {
letters.length = 0;
}, 1000);
});
}(this, jQuery, "MBX"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment