keys.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. define(["./_base/kernel", "./sniff"], function(dojo, has){
  2. // module:
  3. // dojo/keys
  4. return dojo.keys = {
  5. // summary:
  6. // Definitions for common key values. Client code should test keyCode against these named constants,
  7. // as the actual codes can vary by browser.
  8. BACKSPACE: 8,
  9. TAB: 9,
  10. CLEAR: 12,
  11. ENTER: 13,
  12. SHIFT: 16,
  13. CTRL: 17,
  14. ALT: 18,
  15. META: has("webkit") ? 91 : 224, // the apple key on macs
  16. PAUSE: 19,
  17. CAPS_LOCK: 20,
  18. ESCAPE: 27,
  19. SPACE: 32,
  20. PAGE_UP: 33,
  21. PAGE_DOWN: 34,
  22. END: 35,
  23. HOME: 36,
  24. LEFT_ARROW: 37,
  25. UP_ARROW: 38,
  26. RIGHT_ARROW: 39,
  27. DOWN_ARROW: 40,
  28. INSERT: 45,
  29. DELETE: 46,
  30. HELP: 47,
  31. LEFT_WINDOW: 91,
  32. RIGHT_WINDOW: 92,
  33. SELECT: 93,
  34. NUMPAD_0: 96,
  35. NUMPAD_1: 97,
  36. NUMPAD_2: 98,
  37. NUMPAD_3: 99,
  38. NUMPAD_4: 100,
  39. NUMPAD_5: 101,
  40. NUMPAD_6: 102,
  41. NUMPAD_7: 103,
  42. NUMPAD_8: 104,
  43. NUMPAD_9: 105,
  44. NUMPAD_MULTIPLY: 106,
  45. NUMPAD_PLUS: 107,
  46. NUMPAD_ENTER: 108,
  47. NUMPAD_MINUS: 109,
  48. NUMPAD_PERIOD: 110,
  49. NUMPAD_DIVIDE: 111,
  50. F1: 112,
  51. F2: 113,
  52. F3: 114,
  53. F4: 115,
  54. F5: 116,
  55. F6: 117,
  56. F7: 118,
  57. F8: 119,
  58. F9: 120,
  59. F10: 121,
  60. F11: 122,
  61. F12: 123,
  62. F13: 124,
  63. F14: 125,
  64. F15: 126,
  65. NUM_LOCK: 144,
  66. SCROLL_LOCK: 145,
  67. UP_DPAD: 175,
  68. DOWN_DPAD: 176,
  69. LEFT_DPAD: 177,
  70. RIGHT_DPAD: 178,
  71. // virtual key mapping
  72. copyKey: has("mac") && !has("air") ? (has("safari") ? 91 : 224 ) : 17
  73. };
  74. });