📄 eventhandler.js
字号:
_labelString : "LABEL", // native event name to camelCase name _nativeKeyEventMap : { keydown:"keyDown", keyup:"keyUp", keypress:"keyPress" }, _nonCharacterKeyMap : { Backspace:8, Tab:9, Shift:16, Ctrl:17, Alt:18, Pause_Break:19, Caps_Lock:20, // Note - escape seems to be a special case - it gives us no character value, but will fire // a keyPress event natively// Escape:27, Page_Up:33, Page_Down:34, End:35, Home:36, Arrow_Left:37, Arrow_Up:38, Arrow_Right:39, Arrow_Down:40, Insert:45, Delete:46, Meta:91, //Meta:92, f1:112, f2:113, f3:114, f4:115, f5:116, f6:117, f7:118, f8:119, f9:120, f10:121, f11:122, f12:123, Num_Lock:144, Scroll_Lock:145 }, // Virtual key map // virtual key code mappings for every key on the keyboard. // Note: While each code maps to a separate key, we're normalizing to a key name - IE // we're not going to differentiate between Enter on the keyboard and Enter on the numeric // key pad (we can't in some cases on some browsers anyway, and this functionality would be // confusing if you weren't expecting it) // JSDoc the developer friendly keynames - these are required for accessKeys, registering // page level key events, etc. //> @type KeyName // // Strings to identify the various keys on the keyboard. // <ul> // <li> For alpha keys, the single (uppercase) character value is used, such as "Q" // <li> For Numeric keys, the number is used as in a single character string, like "1" // <li> Function keys are identified as <code>"f1"</code> - <code>"f12"</code> // <li> Non alpha-numeric character keys (such as the key for "[" / "{") are identified by // their unmodified character value (the value obtained by hitting the key without // holding shift down), by default - exceptions are listed below. // <li> Additional key names:<br> // - <code>Space</code><br> // - <code>Tab</code><br> // - <code>Enter</code><br> // - <code>Escape</code><br> // - <code>Backspace</code><br> // - <code>Insert</code><br> // - <code>Delete</code><br> // - <code>Arrow_Up</code><br> // - <code>Arrow_Down</code><br> // - <code>Arrow_Left</code><br> // - <code>Arrow_Right</code><br> // - <code>Home</code><br> // - <code>End</code><br> // - <code>Page_Up</code><br> // - <code>Page_Down</code><br> // - <code>Shift</code><br> // - <code>Ctrl</code><br> // - <code>Alt</code> // </ul> // [Note: Some keys may not be available for capture on every platform] // @visibility external //< // Avoid doc'ing keys we may not be able to capture, or which are likely to vary based on // OEM keyboard layout, etc. // - <code>Print_Screen</code><br> // - <code>Scroll_Lock</code><br> // - <code>Caps_Lock</code><br> // - <code>Pause_Break</code><br> // - <code>Num_Lock</code><br> // - <code>Menu</code><br> // Key Identifiers differ from keyNames in that we include modifier detection as a // boolean - used in a few places in the code //> @type KeyIdentifier // Identifiers for keys pressed by the user used by various methods.<br> // Valid <code>keyIdentifier</code>s can be either +link{KeyName} strings, or objects.<br> // If a <code>keyIdentifier</code> is specified as an object, it should have the following // properties:<br> // - <code>keyName</code>: name of the key<br> // - <code>ctrlKey</code>: optional boolean - true if ctrl is down.<br> // - <code>shiftKey</code>: optional boolean - true if shift is down.<br> // - <code>altKey</code>: optional boolean - true if alt is down. // @see type:KeyName // @visibility external //< _virtualKeyMap : { // Note - have to quote numeric property names for older browsers '0':'_undefined', // 1 Left mouse button // 2 Right mouse button // 3 Control-break processing // 4 Middle mouse button (three-button mouse) '8':'Backspace', '9':'Tab', // '12':'Clear', '13':'Enter', '16':'Shift', '17':'Ctrl', '18':'Alt', '19':'Pause_Break', '20':'Caps_Lock', // 21-25 Reserved for Kanji systems '27':'Escape', // 28-31 Reserved for Kanji systems '32':'Space', '33':'Page_Up', '34':'Page_Down', '35':'End', '36':'Home', '37':'Arrow_Left', '38':'Arrow_Up', '39':'Arrow_Right', '40':'Arrow_Down', // 41 SELECT key // 42 [Win32: "Original equipment manufacturer (OEM) specific"] // 43 EXECUTE key '44':'Print_Screen', // 44 PRINT SCREEN key for Win 3.0 and later '45':'Insert', '46':'Delete', // 47 HELP key // Note: these are above the main keyboard (not on the numeric keypad) '48':'0', "49":"1", "50":"2", "51":"3", "52":"4", "53":"5", "54":"6", "55":"7", "56":"8", "57":"9", // 58-64 Undefined // Standard Char keys '65':'A', '66':'B', '67':'C', '68':'D', '69':'E', '70':'F', '71':'G', '72':'H', '73':'I', '74':'J', '75':'K', '76':'L', '77':'M', '78':'N', '79':'O', '80':'P', '81':'Q', '82':'R', '83':'S', '84':'T', '85':'U', '86':'V', '87':'W', '88':'X', '89':'Y', '90':'Z', '91':'Meta', // Meta Left '92':'Meta', // Meta Right // 93 Application key [Win32: "Undefined"] // - from observation, this is returned from the 'context menu' key (next to the right // meta key on windows 2k, IE and Moz, US keyboard) '93':'Menu', // 94-95 Undefined // keys on the numeric keypad '96':'0', '97':'1', '98':'2', '99':'3', '100':'4', '101':'5', '102':'6', '103':'7', '104':'8', '105':'9', '106':'*', // The Multiply key '107':'+', // Add key (on the keypad - not "=+") // 108 Separator key '109':'-', // Minus key '110':'.', // Decimal key '111':'/', // Divide key '112':'f1', '113':'f2', '114':'f3', '115':'f4', '116':'f5', '117':'f6', '118':'f7', '119':'f8', '120':'f9', '121':'f10', '122':'f11', '123':'f12', // 124-143 Unassigned '144':'Num_Lock', '145':'Scroll_Lock', // OEM specific - true on Windows // 146-159 Unassigned '160':'Shift', // Left SHIFT key [Win32: "Unassigned"] '161':'Shift', // Right SHIFT key [Win32: "Unassigned"] '162':'Ctrl', // Left CTRL key [Win32: "Unassigned"] '163':'Ctrl', // Right CTRL key [Win32: "Unassigned"] '164':'Alt', // Left ALT key [Win32: "Unassigned"] '165':'Alt', // Right ALT key [Win32: "Unassigned"] // 166-185 Unassigned // 186-192 OEM specific * See below // 193-218 Unassigned // 219-228 OEM specific // 229 Precedes extended key [Win32: "Unassigned"] // 230 OEM specific // 231-232 Unassigned // 233-245 OEM specific // xxx // There is no guarantee for the punctuation keys. They will vary by locale and // platform. // We can't ask for the keyboard mapping, and but let's handle the MS Windows US keyboard // layout by default. // NOTE: this is one reason to make use of Ascii keycodes when we have them. '186':';', // VK_OEM_1 0xBA ";:" for US '187':'=', // '+', VK_OEM_PLUS 0xBB "+" any country '188':',', // VK_OEM_COMMA 0xBC "," any country '189':'-', // VK_OEM_MINUS 0xBD "-" any country '190':'.', // VK_OEM_PERIOD 0xBE "." any country '191':'/', // VK_OEM_2 0xBF "/?" for US '192':'`', // VK_OEM_3 0xC0 "`~" for US '219':'[', // VK_OEM_4 0xDB "[{" for US '220':'\\', // VK_OEM_5 0xDC "\|" for US '221':']', // VK_OEM_6 0xDD "]}" for US '222':"'" // VK_OEM_7 0xDE "'"" for US // VK_OEM_AX 0xE1 AX key on Japanese AX keyboard // VK_OEM_102 0xE2 "<>" or "\|" on RT 102-key keyboard }, _charsetValueToKeyNameMap : { // Don't worry about any control characters that aren't directly mapped to a key // on the keyboard '8':'Backspace', '9':'Tab', '13':'Enter', '27':'Escape', // Normalize the character to the key name // Note: This is occasionaly ambiguous - such as when hitting "*", it could be the // * above the 8, or it could be the * on the keypad // Note: Choosing somewhat arbitrary names for the keys - just make sure this stays // constant. '32':'Space', //' ' '33':'1', //'!' '34':"'", //'"' '35':'3', //'#', '36':'4', //'$', '37':'5', //'%', '38':'7', //'&', '39':"'", '40':'9', //'(', '41':'0', //')', '42':'8', //'*', // May be wrong if on the keypad '43':'=', //'+' // May be wrong if on the keypad '44':',', '45':'-', '46':'.', '47':'/', '48':'0', '49':'1', '50':'2', '51':'3', '52':'4', '53':'5', '54':'6', '55':'7', '56':'8', '57':'9', '58':';', //':', '59':';', '60':',', //'<', '61':'=', '62':'.', //'>', '63':'/', //'?', '64':'2', //'@', // an example of US-Only mapping '65':'A', '66':'B', '67':'C', '68':'D', '69':'E', '70':'F', '71':'G', '72':'H', '73':'I', '74':'J', '75':'K', '76':'L', '77':'M', '78':'N', '79':'O', '80':'P', '81':'Q', '82':'R', '83':'S', '84':'T', '85':'U', '86':'V', '87':'W', '88':'X', '89':'Y', '90':'Z', '91':'[', '92':'\\', '93':']', '94':'6', //'^', '95':'-', //'_', '96':'`', '97':'A', //'a', '98':'B', //'b', '99':'C', //'c', '100':'D', //'d', '101':'E', //'e', '102':'F', //'f', '103':'G', //'g', '104':'H', //'h', '105':'I', //'i', '106':'J', //'j', '107':'K', //'k', '108':'L', //'l', '109':'M', //'m', '110':'N', //'n', '111':'O', //'o', '112':'P', //'p', '113':'Q', //'q', '114':'R', //'r', '115':'S', //'s', '116':'T', //'t', '117':'U', //'u', '118':'V', //'v', '119':'W', //'w', '120':'X', //'x', '121':'Y', //'y', '122':'Z', //'z', '123':'[', //'{', '124':'\\', //'|', '125':']', //'}', '126':'`' //'~' // Beyond this they are a bunch of special characters we should not need to worry about }, _safariSpecialKeyPressMap : { '3':"Enter", '25':"Tab", // This happens with shift+tab '63232':"Arrow_Up", '63233':"Arrow_Down", '63234':"Arrow_Left", '63235':"Arrow_Right", // Note f8/f9/f10 don't fire an event - cos they take OS focus from the browser '64236':"f1", '64237':"f2", '64238':"f3", '64239':"f4", '64240':"f5", '64241':"f6", '64242':"f7", '64243':"f8", '64244':"f9", '64245':"f10", '64246':"f11", '63247':"f12", '63273':"Home", '63275':"End", '63276':"Page_Up", '63277':"Page_Down" }, // _eventHandlerMap - mapping between normal event names and names for internal handler // functions, eg "mouseDown" -> "handleMouseDown" // - Retrieve using "_getInternalHandlerName(event)" // - generated on the fly for any event name // (See comments in bubbleEvent()) _eventHandlerMap : {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -