File tree Expand file tree Collapse file tree 2 files changed +122
-1
lines changed
Expand file tree Collapse file tree 2 files changed +122
-1
lines changed Original file line number Diff line number Diff line change 1+ /* global define, KeyboardEvent, module */
2+
3+ ( function ( ) {
4+
5+ var keyboardeventKeyPolyfill = {
6+ polyfill : polyfill ,
7+ keys : {
8+ 3 : 'Cancel' ,
9+ 6 : 'Help' ,
10+ 8 : 'Backspace' ,
11+ 9 : 'Tab' ,
12+ 12 : 'Clear' ,
13+ 13 : 'Enter' ,
14+ 16 : 'Shift' ,
15+ 17 : 'Control' ,
16+ 18 : 'Alt' ,
17+ 19 : 'Pause' ,
18+ 20 : 'CapsLock' ,
19+ 27 : 'Escape' ,
20+ 28 : 'Convert' ,
21+ 29 : 'NonConvert' ,
22+ 30 : 'Accept' ,
23+ 31 : 'ModeChange' ,
24+ 32 : ' ' ,
25+ 33 : 'PageUp' ,
26+ 34 : 'PageDown' ,
27+ 35 : 'End' ,
28+ 36 : 'Home' ,
29+ 37 : 'ArrowLeft' ,
30+ 38 : 'ArrowUp' ,
31+ 39 : 'ArrowRight' ,
32+ 40 : 'ArrowDown' ,
33+ 41 : 'Select' ,
34+ 42 : 'Print' ,
35+ 43 : 'Execute' ,
36+ 44 : 'PrintScreen' ,
37+ 45 : 'Insert' ,
38+ 46 : 'Delete' ,
39+ 48 : [ '0' , ')' ] ,
40+ 49 : [ '1' , '!' ] ,
41+ 50 : [ '2' , '@' ] ,
42+ 51 : [ '3' , '#' ] ,
43+ 52 : [ '4' , '$' ] ,
44+ 53 : [ '5' , '%' ] ,
45+ 54 : [ '6' , '^' ] ,
46+ 55 : [ '7' , '&' ] ,
47+ 56 : [ '8' , '*' ] ,
48+ 57 : [ '9' , '(' ] ,
49+ 91 : 'OS' ,
50+ 93 : 'ContextMenu' ,
51+ 144 : 'NumLock' ,
52+ 145 : 'ScrollLock' ,
53+ 181 : 'VolumeMute' ,
54+ 182 : 'VolumeDown' ,
55+ 183 : 'VolumeUp' ,
56+ 186 : [ ';' , ':' ] ,
57+ 187 : [ '=' , '+' ] ,
58+ 188 : [ ',' , '<' ] ,
59+ 189 : [ '-' , '_' ] ,
60+ 190 : [ '.' , '>' ] ,
61+ 191 : [ '/' , '?' ] ,
62+ 192 : [ '`' , '~' ] ,
63+ 219 : [ '[' , '{' ] ,
64+ 220 : [ '\\' , '|' ] ,
65+ 221 : [ ']' , '}' ] ,
66+ 222 : [ "'" , '"' ] ,
67+ 224 : 'Meta' ,
68+ 225 : 'AltGraph' ,
69+ 246 : 'Attn' ,
70+ 247 : 'CrSel' ,
71+ 248 : 'ExSel' ,
72+ 249 : 'EraseEof' ,
73+ 250 : 'Play' ,
74+ 251 : 'ZoomOut'
75+ }
76+ } ;
77+
78+ // Function keys (F1-24).
79+ var i ;
80+ for ( i = 1 ; i < 25 ; i ++ ) {
81+ keyboardeventKeyPolyfill . keys [ 111 + i ] = 'F' + i ;
82+ }
83+
84+ // Printable ASCII characters.
85+ var letter = '' ;
86+ for ( i = 65 ; i < 91 ; i ++ ) {
87+ letter = String . fromCharCode ( i ) ;
88+ keyboardeventKeyPolyfill . keys [ i ] = [ letter . toLowerCase ( ) , letter . toUpperCase ( ) ] ;
89+ }
90+
91+ function polyfill ( ) {
92+ if ( ! ( 'KeyboardEvent' in window ) ||
93+ 'key' in KeyboardEvent . prototype ) {
94+ return false ;
95+ }
96+
97+ // Polyfill `key` on `KeyboardEvent`.
98+ var proto = {
99+ get : function ( x ) {
100+ var key = keyboardeventKeyPolyfill . keys [ this . which || this . keyCode ] ;
101+
102+ if ( Array . isArray ( key ) ) {
103+ key = key [ + this . shiftKey ] ;
104+ }
105+
106+ return key ;
107+ }
108+ } ;
109+ Object . defineProperty ( KeyboardEvent . prototype , 'key' , proto ) ;
110+ return proto ;
111+ }
112+
113+ if ( typeof define === 'function' && define . amd ) {
114+ define ( 'keyboardevent-key-polyfill' , keyboardeventKeyPolyfill ) ;
115+ } else if ( typeof exports !== 'undefined' && typeof module !== 'undefined' ) {
116+ module . exports = keyboardeventKeyPolyfill ;
117+ } else if ( window ) {
118+ window . keyboardeventKeyPolyfill = keyboardeventKeyPolyfill ;
119+ }
120+
121+ } ) ( ) ;
Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ input.form-autocomplete-stop[readonly] {
320320 line-height : 14px ;
321321 padding : 10px 10px 0 ;
322322 box-sizing : border-box;
323- min- height: 30 px ;
323+ height : 500 px ;
324324 max-height : 500px ;
325325 overflow-y : auto;
326326 overflow-x : hidden;
You can’t perform that action at this time.
0 commit comments