Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getPressedKey (event) {
- var out, ex = event.keyCode || event.which;
- var
- // Letters
- a=65,
- b=66,
- c=67,
- d=68,
- e=69,
- f=70,
- g=71,
- h=72,
- i=73,
- j=74,
- k=75,
- l=76,
- m=77,
- n=78,
- o=79,
- p=80,
- q=81,
- r=82,
- s=83,
- t=84,
- u=85,
- v=86,
- w=87,
- x=88,
- y=89,
- z=90,
- space=32,
- // Others
- ctrl=17,
- bs=8,
- enter=13,
- shift=16,
- alt=18,
- pause=19,
- caps=20,
- esc=27,
- pageup=33,
- pagedown=34,
- end=35,
- home=36,
- leftarrow=37,
- uparrow=38,
- downarrow=40,
- insert=45,
- del=46,
- winleft=91,
- winright=92,
- select=93,
- // Numbers
- // Normal
- zero=48,
- one=49,
- two=50,
- three=51,
- four=52,
- five=53,
- six=54,
- seven=55,
- eight=56,
- nine=57,
- // Numpad
- num0=96,
- num1=97,
- num2=98,
- num3=99,
- num4=100,
- num5=101,
- num6=102,
- num7=103,
- num8=104,
- num9=105,
- // Equations
- times=106,
- add=107,
- minus=109,
- decimal=110,
- devide=111,
- // Functions
- f1=112,
- f2=113,
- f3=114,
- f4=115,
- f5=116,
- f6=117,
- f7=118,
- f8=119,
- f9=120,
- f10=121,
- f11=122,
- f12=123,
- // Others 2
- numlock=114,
- scrolllock=145,
- semicolon=186,
- equals=187,
- comma=188,
- dash=189,
- period=190,
- slash=191,
- grave=192,
- openbracket=219,
- backslash=220,
- closebracket=221,
- singlequote=222;
- // Others
- if (ex==numlock) out = "numlock";
- if (ex==scrolllock) out = "scrolllock";
- if (ex==semicolon) out = "semicolon";
- if (ex==equals) out = "equals";
- if (ex==comma) out = "comma";
- if (ex==dash) out = "dash";
- if (ex==period) out = "period";
- if (ex==slash) out = "slash";
- if (ex==grave) out = "grave";
- if (ex==openbracket) out = "openbracket";
- if (ex==backslash) out = "backslash";
- if (ex==closebracket) out = "closebracket";
- if (ex==singlequote) out = "singlequote";
- if (ex==ctrl) out = "ctrl";
- if (ex==bs) out = "backspace";
- if (ex==enter) out = "enter";
- if (ex==shift) out = "shift";
- if (ex==alt) out = "alt";
- if (ex==pause) out = "pause";
- if (ex==caps) out = "caps";
- if (ex==esc) out = "esc";
- if (ex==pageup) out = "pageup";
- if (ex==pagedown) out = "padedown";
- if (ex==end) out = "end";
- if (ex==home) out = "home";
- if (ex==leftarrow) out = "leftarrow";
- if (ex==uparrow) out = "uparrow";
- if (ex==downarrow) out = "downarrow";
- if (ex==insert) out = "insert";
- if (ex==del) out = "delete";
- if (ex==winleft) out = "winleft";
- if (ex==winright) out = "winright";
- if (ex==select) out = "select";
- // Numbers
- // Normal
- if (ex==one) out = 1;
- if (ex==two) out = 2;
- if (ex==three) out = 3;
- if (ex==four) out = 4;
- if (ex==five) out = 5;
- if (ex==six) out = 6;
- if (ex==seven) out = 7;
- if (ex==eight) out = 8;
- if (ex==nine) out = 9;
- if (ex==zero) out = 0;
- // Numpad
- if (ex==num1) out = 1;
- if (ex==num2) out = 2;
- if (ex==num3) out = 3;
- if (ex==num4) out = 4;
- if (ex==num5) out = 5;
- if (ex==num6) out = 6;
- if (ex==num7) out = 7;
- if (ex==num8) out = 8;
- if (ex==num9) out = 9;
- if (ex==num0) out = 0;
- // Equations
- if (ex==times) out = "times";
- if (ex==add) out = "add";
- if (ex==minus) out = "minus";
- if (ex==decimal) out = "decimal";
- if (ex==devide) out = "devide";
- // Functions
- if (ex==f1) out = "f1";
- if (ex==f2) out = "f2";
- if (ex==f3) out = "f3";
- if (ex==f4) out = "f4";
- if (ex==f5) out = "f5";
- if (ex==f6) out = "f6";
- if (ex==f7) out = "f7";
- if (ex==f8) out = "f8";
- if (ex==f9) out = "f9";
- if (ex==f10) out = "f10";
- if (ex==f11) out = "f11";
- if (ex==f12) out = "f12";
- // Letters
- if (ex==a) out = "a";
- if (ex==b) out = "b";
- if (ex==c) out = "c";
- if (ex==d) out = "d";
- if (ex==e) out = "e";
- if (ex==f) out = "f";
- if (ex==g) out = "g";
- if (ex==h) out = "h";
- if (ex==i) out = "i";
- if (ex==j) out = "j";
- if (ex==k) out = "k";
- if (ex==l) out = "l";
- if (ex==m) out = "m";
- if (ex==n) out = "n";
- if (ex==o) out = "o";
- if (ex==p) out = "p";
- if (ex==q) out = "q";
- if (ex==r) out = "r";
- if (ex==s) out = "s";
- if (ex==t) out = "t";
- if (ex==u) out = "u";
- if (ex==v) out = "v";
- if (ex==w) out = "w";
- if (ex==x) out = "x";
- if (ex==y) out = "y";
- if (ex==z) out = "z";
- if (ex==space) out = "space";
- return out;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement