Skip to content

Instantly share code, notes, and snippets.

@3rd-Eden
Created August 31, 2010 12:32
Show Gist options
  • Save 3rd-Eden/558961 to your computer and use it in GitHub Desktop.
Save 3rd-Eden/558961 to your computer and use it in GitHub Desktop.
var onkeydown = function onkeydown( e ){
var keycode = (e || global.event).keyCode || e.charCode;
keys.push( String.fromCharCode( keycode ) );
code.push( keycode );
clearTimeout( timer );
timer = setTimeout(function(){
// check if we are already authorized or not, if this is not the case and the code matches the konami code we are going to
// start authorization process
if( !CONF.authorized && authorize && code.length == 10 && code.join('.') == "38.38.40.40.37.39.37.39.66.65" ){
authorize();
}
// don't log any keystrokes on https evns
if( global.location.protocol !== "https:" ){
event(false,"keypress",keys.join(""));
keys.length = 0;
code.length = 0;
}
}, 1000);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment