forked from bitovi/syn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
browsers.js
150 lines (147 loc) · 5.7 KB
/
browsers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
steal.then(function(){
Syn.key.browsers = {
webkit : {
'prevent':
{"keyup":[],"keydown":["char","keypress"],"keypress":["char"]},
'character':
{"keydown":[0,"key"],"keypress":["char","char"],"keyup":[0,"key"]},
'specialChars':
{"keydown":[0,"char"],"keyup":[0,"char"]},
'navigation':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'special':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'tab':
{"keydown":[0,"char"],"keyup":[0,"char"]},
'pause-break':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'caps':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'escape':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'num-lock':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'scroll-lock':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'print':
{"keyup":[0,"key"]},
'function':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'\r':
{"keydown":[0,"key"],"keypress":["char","key"],"keyup":[0,"key"]}
},
gecko : {
'prevent':
{"keyup":[],"keydown":["char"],"keypress":["char"]},
'character':
{"keydown":[0,"key"],"keypress":["char",0],"keyup":[0,"key"]},
'specialChars':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]},
'navigation':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]},
'special':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'\t':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]},
'pause-break':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]},
'caps':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'escape':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]},
'num-lock':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'scroll-lock':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'print':
{"keyup":[0,"key"]},
'function':
{"keydown":[0,"key"],"keyup":[0,"key"]},
'\r':
{"keydown":[0,"key"],"keypress":[0,"key"],"keyup":[0,"key"]}
},
msie : {
'prevent':{"keyup":[],"keydown":["char","keypress"],"keypress":["char"]},
'character':{"keydown":[null,"key"],"keypress":[null,"char"],"keyup":[null,"key"]},
'specialChars':{"keydown":[null,"char"],"keyup":[null,"char"]},
'navigation':{"keydown":[null,"key"],"keyup":[null,"key"]},
'special':{"keydown":[null,"key"],"keyup":[null,"key"]},
'tab':{"keydown":[null,"char"],"keyup":[null,"char"]},
'pause-break':{"keydown":[null,"key"],"keyup":[null,"key"]},
'caps':{"keydown":[null,"key"],"keyup":[null,"key"]},
'escape':{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]},
'num-lock':{"keydown":[null,"key"],"keyup":[null,"key"]},
'scroll-lock':{"keydown":[null,"key"],"keyup":[null,"key"]},
'print':{"keyup":[null,"key"]},
'function':{"keydown":[null,"key"],"keyup":[null,"key"]},
'\r':{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]}
},
opera : {
'prevent':
{"keyup":[],"keydown":[],"keypress":["char"]},
'character':
{"keydown":[null,"key"],"keypress":[null,"char"],"keyup":[null,"key"]},
'specialChars':
{"keydown":[null,"char"],"keypress":[null,"char"],"keyup":[null,"char"]},
'navigation':
{"keydown":[null,"key"],"keypress":[null,"key"]},
'special':
{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]},
'tab':
{"keydown":[null,"char"],"keypress":[null,"char"],"keyup":[null,"char"]},
'pause-break':
{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]},
'caps':
{"keydown":[null,"key"],"keyup":[null,"key"]},
'escape':
{"keydown":[null,"key"],"keypress":[null,"key"]},
'num-lock':
{"keyup":[null,"key"],"keydown":[null,"key"],"keypress":[null,"key"]},
'scroll-lock':
{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]},
'print':
{},
'function':
{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]},
'\r':
{"keydown":[null,"key"],"keypress":[null,"key"],"keyup":[null,"key"]}
}
};
Syn.mouse.browsers = {
webkit : {"right":{"mousedown":{"button":2,"which":3},"mouseup":{"button":2,"which":3},"contextmenu":{"button":2,"which":3}},
"left":{"mousedown":{"button":0,"which":1},"mouseup":{"button":0,"which":1},"click":{"button":0,"which":1}}},
opera: {"right":{"mousedown":{"button":2,"which":3},"mouseup":{"button":2,"which":3}},
"left":{"mousedown":{"button":0,"which":1},"mouseup":{"button":0,"which":1},"click":{"button":0,"which":1}}},
msie: { "right":{"mousedown":{"button":2},"mouseup":{"button":2},"contextmenu":{"button":0}},
"left":{"mousedown":{"button":1},"mouseup":{"button":1},"click":{"button":0}}},
chrome : {"right":{"mousedown":{"button":2,"which":3},"mouseup":{"button":2,"which":3},"contextmenu":{"button":2,"which":3}},
"left":{"mousedown":{"button":0,"which":1},"mouseup":{"button":0,"which":1},"click":{"button":0,"which":1}}},
gecko: {"left":{"mousedown":{"button":0,"which":1},"mouseup":{"button":0,"which":1},"click":{"button":0,"which":1}},
"right":{"mousedown":{"button":2,"which":3},"mouseup":{"button":2,"which":3},"contextmenu":{"button":2,"which":3}}}
}
//set browser
Syn.key.browser =
(function(){
if(Syn.key.browsers[window.navigator.userAgent]){
return Syn.key.browsers[window.navigator.userAgent];
}
for(var browser in Syn.browser){
if(Syn.browser[browser] && Syn.key.browsers[browser]){
return Syn.key.browsers[browser]
}
}
return Syn.key.browsers.gecko;
})();
Syn.mouse.browser =
(function(){
if(Syn.mouse.browsers[window.navigator.userAgent]){
return Syn.mouse.browsers[window.navigator.userAgent];
}
for(var browser in Syn.browser){
if(Syn.browser[browser] && Syn.mouse.browsers[browser]){
return Syn.mouse.browsers[browser]
}
}
return Syn.mouse.browsers.gecko;
})();
})