| 1 |
// Copyright 2006 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Constant declarations for common key codes. |
| 17 |
* |
| 18 |
* @author [email protected] (Emil A Eklund) |
| 19 |
*/ |
| 20 |
|
| 21 |
goog.provide('goog.events.KeyNames'); |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* Key names for common characters. These should be used with keyup/keydown |
| 26 |
* events, since the .keyCode property on those is meant to indicate the |
| 27 |
* *physical key* the user held down on the keyboard. Hence the mapping uses |
| 28 |
* only the unshifted version of each key (e.g. no '#', since that's shift+3). |
| 29 |
* Keypress events on the other hand generate (mostly) ASCII codes since they |
| 30 |
* correspond to *characters* the user typed. |
| 31 |
* |
| 32 |
* For further reference: http://unixpapa.com/js/key.html |
| 33 |
* |
| 34 |
* This list is not localized and therefore some of the key codes are not |
| 35 |
* correct for non-US keyboard layouts. |
| 36 |
* |
| 37 |
* @see goog.events.KeyCodes |
| 38 |
* @enum {string} |
| 39 |
*/ |
| 40 |
goog.events.KeyNames = { |
| 41 |
8: 'backspace', |
| 42 |
9: 'tab', |
| 43 |
13: 'enter', |
| 44 |
16: 'shift', |
| 45 |
17: 'ctrl', |
| 46 |
18: 'alt', |
| 47 |
19: 'pause', |
| 48 |
20: 'caps-lock', |
| 49 |
27: 'esc', |
| 50 |
32: 'space', |
| 51 |
33: 'pg-up', |
| 52 |
34: 'pg-down', |
| 53 |
35: 'end', |
| 54 |
36: 'home', |
| 55 |
37: 'left', |
| 56 |
38: 'up', |
| 57 |
39: 'right', |
| 58 |
40: 'down', |
| 59 |
45: 'insert', |
| 60 |
46: 'delete', |
| 61 |
48: '0', |
| 62 |
49: '1', |
| 63 |
50: '2', |
| 64 |
51: '3', |
| 65 |
52: '4', |
| 66 |
53: '5', |
| 67 |
54: '6', |
| 68 |
55: '7', |
| 69 |
56: '8', |
| 70 |
57: '9', |
| 71 |
59: 'semicolon', |
| 72 |
61: 'equals', |
| 73 |
65: 'a', |
| 74 |
66: 'b', |
| 75 |
67: 'c', |
| 76 |
68: 'd', |
| 77 |
69: 'e', |
| 78 |
70: 'f', |
| 79 |
71: 'g', |
| 80 |
72: 'h', |
| 81 |
73: 'i', |
| 82 |
74: 'j', |
| 83 |
75: 'k', |
| 84 |
76: 'l', |
| 85 |
77: 'm', |
| 86 |
78: 'n', |
| 87 |
79: 'o', |
| 88 |
80: 'p', |
| 89 |
81: 'q', |
| 90 |
82: 'r', |
| 91 |
83: 's', |
| 92 |
84: 't', |
| 93 |
85: 'u', |
| 94 |
86: 'v', |
| 95 |
87: 'w', |
| 96 |
88: 'x', |
| 97 |
89: 'y', |
| 98 |
90: 'z', |
| 99 |
93: 'context', |
| 100 |
96: 'num-0', |
| 101 |
97: 'num-1', |
| 102 |
98: 'num-2', |
| 103 |
99: 'num-3', |
| 104 |
100: 'num-4', |
| 105 |
101: 'num-5', |
| 106 |
102: 'num-6', |
| 107 |
103: 'num-7', |
| 108 |
104: 'num-8', |
| 109 |
105: 'num-9', |
| 110 |
106: 'num-multiply', |
| 111 |
107: 'num-plus', |
| 112 |
109: 'num-minus', |
| 113 |
110: 'num-period', |
| 114 |
111: 'num-division', |
| 115 |
112: 'f1', |
| 116 |
113: 'f2', |
| 117 |
114: 'f3', |
| 118 |
115: 'f4', |
| 119 |
116: 'f5', |
| 120 |
117: 'f6', |
| 121 |
118: 'f7', |
| 122 |
119: 'f8', |
| 123 |
120: 'f9', |
| 124 |
121: 'f10', |
| 125 |
122: 'f11', |
| 126 |
123: 'f12', |
| 127 |
186: 'semicolon', |
| 128 |
187: 'equals', |
| 129 |
189: 'dash', |
| 130 |
188: ',', |
| 131 |
190: '.', |
| 132 |
191: '/', |
| 133 |
192: '`', |
| 134 |
219: 'open-square-bracket', |
| 135 |
220: '\\', |
| 136 |
221: 'close-square-bracket', |
| 137 |
222: 'single-quote', |
| 138 |
224: 'win' |
| 139 |
}; |