diff rlgterm.js @ 70:d7eb63cd7a16

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.
author John "Elwin" Edwards <elwin@sdf.org>
date Thu, 21 Jun 2012 09:43:52 -0700
parents b6a3b26fe0dc
children d084610a89b5
line wrap: on
line diff
--- a/rlgterm.js	Wed Jun 20 14:14:22 2012 -0700
+++ b/rlgterm.js	Thu Jun 21 09:43:52 2012 -0700
@@ -269,8 +269,8 @@
     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 @@
     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 @@
     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 {