Created
May 8, 2011 01:05
-
-
Save aaronfrost/961007 to your computer and use it in GitHub Desktop.
js key-combo-event example w/ KRL
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
ctrlpressed = false; | |
altpressed = false; | |
tpressed = false; | |
tempapp = KOBJ.get_application("MY_APP"); | |
function KeyCheck_Global(e, isPressed){ | |
var gotkey = null; | |
switch(e.keyCode){ | |
case 17: //CTRL | |
ctrlpressed=isPressed; | |
break; | |
case 18: //ALT | |
altpressed=isPressed; | |
break; | |
case 84: //T | |
tpressed=isPressed; | |
break; | |
default: | |
break; | |
} | |
if (ctrlpressed && altpressed && tpressed){ | |
//U can haz teh magic hir | |
tempapp.raise_event("new_web_event",{"paramone":"dataone","param2":"datatwo"});//This is almost exactly what I do. | |
} | |
return e; | |
} | |
$K(document).ready(function(){ | |
$K(document).bind('keydown',function(e){ | |
return KeyCheck_Global(e,true); | |
}).bind('keyup',function(e){ | |
return KeyCheck_Global(e,false); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment