123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- const keyboardMap = [
- "",
- "",
- "",
- "CANCEL",
- "",
- "",
- "HELP",
- "",
- "BACK_SPACE",
- "TAB",
- "",
- "",
- "CLEAR",
- "ENTER",
- "ENTER_SPECIAL",
- "",
- "SHIFT",
- "CONTROL",
- "ALT",
- "PAUSE",
- "CAPS_LOCK",
- "KANA",
- "EISU",
- "JUNJA",
- "FINAL",
- "HANJA",
- "",
- "ESCAPE",
- "CONVERT",
- "NONCONVERT",
- "ACCEPT",
- "MODECHANGE",
- "SPACE",
- "PAGE_UP",
- "PAGE_DOWN",
- "END",
- "HOME",
- "LEFT",
- "UP",
- "RIGHT",
- "DOWN",
- "SELECT",
- "PRINT",
- "EXECUTE",
- "PRINTSCREEN",
- "INSERT",
- "DELETE",
- "",
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- "COLON",
- "SEMICOLON",
- "LESS_THAN",
- "EQUALS",
- "GREATER_THAN",
- "QUESTION_MARK",
- "AT",
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- "OS_KEY",
- "",
- "CONTEXT_MENU",
- "",
- "SLEEP",
- "NUMPAD0",
- "NUMPAD1",
- "NUMPAD2",
- "NUMPAD3",
- "NUMPAD4",
- "NUMPAD5",
- "NUMPAD6",
- "NUMPAD7",
- "NUMPAD8",
- "NUMPAD9",
- "MULTIPLY",
- "ADD",
- "SEPARATOR",
- "SUBTRACT",
- "DECIMAL",
- "DIVIDE",
- "F1",
- "F2",
- "F3",
- "F4",
- "F5",
- "F6",
- "F7",
- "F8",
- "F9",
- "F10",
- "F11",
- "F12",
- "F13",
- "F14",
- "F15",
- "F16",
- "F17",
- "F18",
- "F19",
- "F20",
- "F21",
- "F22",
- "F23",
- "F24",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "NUM_LOCK",
- "SCROLL_LOCK",
- "WIN_OEM_FJ_JISHO",
- "WIN_OEM_FJ_MASSHOU",
- "WIN_OEM_FJ_TOUROKU",
- "WIN_OEM_FJ_LOYA",
- "WIN_OEM_FJ_ROYA",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "CIRCUMFLEX",
- "EXCLAMATION",
- "DOUBLE_QUOTE",
- "HASH",
- "DOLLAR",
- "PERCENT",
- "AMPERSAND",
- "UNDERSCORE",
- "OPEN_PAREN",
- "CLOSE_PAREN",
- "ASTERISK",
- "PLUS",
- "PIPE",
- "HYPHEN_MINUS",
- "OPEN_CURLY_BRACKET",
- "CLOSE_CURLY_BRACKET",
- "TILDE",
- "",
- "",
- "",
- "",
- "VOLUME_MUTE",
- "VOLUME_DOWN",
- "VOLUME_UP",
- "",
- "",
- "SEMICOLON",
- "EQUALS",
- "COMMA",
- "MINUS",
- "PERIOD",
- "SLASH",
- "BACK_QUOTE",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "OPEN_BRACKET",
- "BACK_SLASH",
- "CLOSE_BRACKET",
- "QUOTE",
- "",
- "META",
- "ALTGR",
- "",
- "WIN_ICO_HELP",
- "WIN_ICO_00",
- "",
- "WIN_ICO_CLEAR",
- "",
- "",
- "WIN_OEM_RESET",
- "WIN_OEM_JUMP",
- "WIN_OEM_PA1",
- "WIN_OEM_PA2",
- "WIN_OEM_PA3",
- "WIN_OEM_WSCTRL",
- "WIN_OEM_CUSEL",
- "WIN_OEM_ATTN",
- "WIN_OEM_FINISH",
- "WIN_OEM_COPY",
- "WIN_OEM_AUTO",
- "WIN_OEM_ENLW",
- "WIN_OEM_BACKTAB",
- "ATTN",
- "CRSEL",
- "EXSEL",
- "EREOF",
- "PLAY",
- "ZOOM",
- "",
- "PA1",
- "WIN_OEM_CLEAR",
- ""
- ];
- $(window).keyup(function(event){
- if ($(event.target).closest("input")[0]) {
- return;
- }
- let actionShortcuts = ['Q','W','E','R','T'];
- let key = keyboardMap[event.keyCode];
- switch(key){
- case '1':
- case 'NUMPAD1':
- setup.executeActionOfIndex(0);break;
- case '2':
- case 'NUMPAD2':
- setup.executeActionOfIndex(1);break;
- case '3':
- case 'NUMPAD3':
- setup.executeActionOfIndex(2);break;
- case '4':
- case 'NUMPAD4':
- setup.executeActionOfIndex(3);break;
- case '5':
- case 'NUMPAD5':
- setup.executeActionOfIndex(4);break;
- case '6':
- case 'NUMPAD6':
- setup.executeActionOfIndex(5);break;
- case '7':
- case 'NUMPAD7':
- setup.executeActionOfIndex(6);break;
- case '8':
- case 'NUMPAD8':
- setup.executeActionOfIndex(7);break;
- case '9':
- case 'NUMPAD9':
- setup.executeActionOfIndex(8);break;
- case '0':
- case 'NUMPAD0':
- setup.executeActionOfIndex(9);break;
-
- }
- console.log('Key-Event',key);
- });
- setup.executeActionOfIndex = function(index){
- let _actions = State.temporary.actions;
- if(!_actions)
- return;
- if(!_actions[index])
- return;
- _actions[index].execute();
- }
-
|