Try to get some compatibility for keys.

I'd thought using the DOM_VK_ names was a good idea.  Symbolic names
ought to be more portable than opaque numeric constants.  Foolish me,
expecting things to be sane.
Keys now work with FF15 and Chrome 17.
This commit is contained in:
John "Elwin" Edwards 2012-06-21 09:43:52 -07:00
parent a6ca511e4d
commit e5a4a55876
3 changed files with 54 additions and 51 deletions

View file

@ -269,8 +269,8 @@ function sendkey(ev) {
return;
var keynum = ev.keyCode;
var code;
if (keynum >= ev.DOM_VK_A && keynum <= ev.DOM_VK_Z) {
/* Letters. This assumes the codes are 65-90. */
if (keynum >= 65 && keynum <= 90) {
/* Letters. */
if (ev.ctrlKey)
keynum -= 64;
else if (!ev.shiftKey)
@ -279,7 +279,7 @@ function sendkey(ev) {
if (code.length < 2)
code = "0" + code;
}
else if (keynum >= ev.DOM_VK_0 && keynum <= ev.DOM_VK_9) {
else if (keynum >= 48 && keynum <= 57) {
/* The number row, NOT the numpad. */
if (ev.shiftKey) {
code = numShifts[keynum - 48].toString(16);
@ -294,8 +294,8 @@ function sendkey(ev) {
else
code = keyHexCodes[keynum][0];
}
else if (keynum == ev.DOM_VK_SHIFT || keynum == ev.DOM_VK_CONTROL ||
keynum == ev.DOM_VK_ALT || keynum == ev.DOM_VK_CAPS_LOCK) {
else if (keynum >= 16 && keynum <= 20) {
/* Shift, Cntl, Alt, CAPSLOCK */
return;
}
else {