artalk 2.2.2 → 2.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Artalk.css +1 -1
- package/dist/Artalk.es.js +413 -321
- package/dist/Artalk.iife.js +1 -1
- package/dist/Artalk.js +1 -1
- package/index.html +10 -0
- package/package.json +2 -2
- package/src/api/index.ts +12 -8
- package/src/artalk.ts +14 -4
- package/src/components/editor-plugs/emoticons-plug.ts +35 -14
- package/src/components/editor.ts +29 -5
- package/src/components/layer.ts +7 -9
- package/src/components/list-lite.ts +19 -4
- package/src/components/sidebar-layer.ts +43 -36
- package/src/context.ts +1 -0
- package/src/lib/checker/captcha-checker.ts +1 -1
- package/src/lib/detect.ts +222 -0
- package/src/lib/utils.ts +90 -21
- package/src/style/comment.less +1 -0
- package/src/style/main.less +63 -12
- package/types/event.d.ts +5 -1
- package/src/lib/detect.js +0 -263
package/src/lib/detect.js
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
var win = window || {}
|
|
3
|
-
var nav = navigator || {}
|
|
4
|
-
function Detect (userAgent) {
|
|
5
|
-
var u = userAgent || nav.userAgent
|
|
6
|
-
var _this = this
|
|
7
|
-
|
|
8
|
-
var match = {
|
|
9
|
-
// 内核
|
|
10
|
-
Trident: u.indexOf('Trident') > -1 || u.indexOf('NET CLR') > -1,
|
|
11
|
-
Presto: u.indexOf('Presto') > -1,
|
|
12
|
-
WebKit: u.indexOf('AppleWebKit') > -1,
|
|
13
|
-
Gecko: u.indexOf('Gecko/') > -1,
|
|
14
|
-
// 浏览器
|
|
15
|
-
Safari: u.indexOf('Safari') > -1,
|
|
16
|
-
Chrome: u.indexOf('Chrome') > -1 || u.indexOf('CriOS') > -1,
|
|
17
|
-
IE: u.indexOf('MSIE') > -1 || u.indexOf('Trident') > -1,
|
|
18
|
-
Edge: u.indexOf('Edge') > -1,
|
|
19
|
-
Firefox: u.indexOf('Firefox') > -1 || u.indexOf('FxiOS') > -1,
|
|
20
|
-
'Firefox Focus': u.indexOf('Focus') > -1,
|
|
21
|
-
Chromium: u.indexOf('Chromium') > -1,
|
|
22
|
-
Opera: u.indexOf('Opera') > -1 || u.indexOf('OPR') > -1,
|
|
23
|
-
Vivaldi: u.indexOf('Vivaldi') > -1,
|
|
24
|
-
Yandex: u.indexOf('YaBrowser') > -1,
|
|
25
|
-
Kindle: u.indexOf('Kindle') > -1 || u.indexOf('Silk/') > -1,
|
|
26
|
-
360: u.indexOf('360EE') > -1 || u.indexOf('360SE') > -1,
|
|
27
|
-
UC: u.indexOf('UC') > -1 || u.indexOf(' UBrowser') > -1,
|
|
28
|
-
QQBrowser: u.indexOf('QQBrowser') > -1,
|
|
29
|
-
QQ: u.indexOf('QQ/') > -1,
|
|
30
|
-
Baidu: u.indexOf('Baidu') > -1 || u.indexOf('BIDUBrowser') > -1,
|
|
31
|
-
Maxthon: u.indexOf('Maxthon') > -1,
|
|
32
|
-
Sogou: u.indexOf('MetaSr') > -1 || u.indexOf('Sogou') > -1,
|
|
33
|
-
LBBROWSER: u.indexOf('LBBROWSER') > -1,
|
|
34
|
-
'2345Explorer': u.indexOf('2345Explorer') > -1,
|
|
35
|
-
TheWorld: u.indexOf('TheWorld') > -1,
|
|
36
|
-
XiaoMi: u.indexOf('MiuiBrowser') > -1,
|
|
37
|
-
Quark: u.indexOf('Quark') > -1,
|
|
38
|
-
Qiyu: u.indexOf('Qiyu') > -1,
|
|
39
|
-
Wechat: u.indexOf('MicroMessenger') > -1,
|
|
40
|
-
Taobao: u.indexOf('AliApp(TB') > -1,
|
|
41
|
-
Alipay: u.indexOf('AliApp(AP') > -1,
|
|
42
|
-
Weibo: u.indexOf('Weibo') > -1,
|
|
43
|
-
Douban: u.indexOf('com.douban.frodo') > -1,
|
|
44
|
-
Suning: u.indexOf('SNEBUY-APP') > -1,
|
|
45
|
-
iQiYi: u.indexOf('IqiyiApp') > -1,
|
|
46
|
-
// 系统或平台
|
|
47
|
-
Windows: u.indexOf('Windows') > -1,
|
|
48
|
-
Linux: u.indexOf('Linux') > -1 || u.indexOf('X11') > -1,
|
|
49
|
-
'Mac OS': u.indexOf('Macintosh') > -1,
|
|
50
|
-
Android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1,
|
|
51
|
-
Ubuntu: u.indexOf('Ubuntu') > -1,
|
|
52
|
-
FreeBSD: u.indexOf('FreeBSD') > -1,
|
|
53
|
-
Debian: u.indexOf('Debian') > -1,
|
|
54
|
-
'Windows Phone': u.indexOf('IEMobile') > -1 || u.indexOf('Windows Phone') > -1,
|
|
55
|
-
BlackBerry: u.indexOf('BlackBerry') > -1 || u.indexOf('RIM') > -1,
|
|
56
|
-
MeeGo: u.indexOf('MeeGo') > -1,
|
|
57
|
-
Symbian: u.indexOf('Symbian') > -1,
|
|
58
|
-
iOS: u.indexOf('like Mac OS X') > -1,
|
|
59
|
-
'Chrome OS': u.indexOf('CrOS') > -1,
|
|
60
|
-
WebOS: u.indexOf('hpwOS') > -1,
|
|
61
|
-
// 设备
|
|
62
|
-
Mobile: u.indexOf('Mobi') > -1 || u.indexOf('iPh') > -1 || u.indexOf('480') > -1,
|
|
63
|
-
Tablet: u.indexOf('Tablet') > -1 || u.indexOf('Pad') > -1 || u.indexOf('Nexus 7') > -1
|
|
64
|
-
}
|
|
65
|
-
// 修正
|
|
66
|
-
if (match.Mobile) {
|
|
67
|
-
match.Mobile = !(u.indexOf('iPad') > -1)
|
|
68
|
-
} else if (win.showModalDialog && win.chrome) {
|
|
69
|
-
match['360'] = true
|
|
70
|
-
}
|
|
71
|
-
// 基本信息
|
|
72
|
-
var hash = {
|
|
73
|
-
engine: ['WebKit', 'Trident', 'Gecko', 'Presto'],
|
|
74
|
-
browser: ['Safari', 'Chrome', 'Edge', 'IE', 'Firefox', 'Firefox Focus', 'Chromium', 'Opera', 'Vivaldi', 'Yandex', 'Kindle', '360', 'UC', 'QQBrowser', 'QQ', 'Baidu', 'Maxthon', 'Sogou', 'LBBROWSER', '2345Explorer', 'TheWorld', 'XiaoMi', 'Quark', 'Qiyu', 'Wechat', 'Taobao', 'Alipay', 'Weibo', 'Douban', 'Suning', 'iQiYi'],
|
|
75
|
-
os: ['Windows', 'Linux', 'Mac OS', 'Android', 'Ubuntu', 'FreeBSD', 'Debian', 'iOS', 'Windows Phone', 'BlackBerry', 'MeeGo', 'Symbian', 'Chrome OS', 'WebOS'],
|
|
76
|
-
device: ['Mobile', 'Tablet']
|
|
77
|
-
}
|
|
78
|
-
_this.device = 'PC'
|
|
79
|
-
_this.language = (function () {
|
|
80
|
-
var g = (nav.browserLanguage || nav.language)
|
|
81
|
-
var arr = g.split('-')
|
|
82
|
-
if (arr[1]) {
|
|
83
|
-
arr[1] = arr[1].toUpperCase()
|
|
84
|
-
}
|
|
85
|
-
return arr.join('_')
|
|
86
|
-
})()
|
|
87
|
-
for (var s in hash) {
|
|
88
|
-
for (var i = 0; i < hash[s].length; i++) {
|
|
89
|
-
var value = hash[s][i]
|
|
90
|
-
if (match[value]) {
|
|
91
|
-
_this[s] = value
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
// 系统版本信息
|
|
96
|
-
var osVersion = {
|
|
97
|
-
Windows: function () {
|
|
98
|
-
var v = u.replace(/^.*Windows NT ([\d.]+);.*$/, '$1')
|
|
99
|
-
var hash = {
|
|
100
|
-
6.4: '10',
|
|
101
|
-
6.3: '8.1',
|
|
102
|
-
6.2: '8',
|
|
103
|
-
6.1: '7',
|
|
104
|
-
'6.0': 'Vista',
|
|
105
|
-
5.2: 'XP',
|
|
106
|
-
5.1: 'XP',
|
|
107
|
-
'5.0': '2000',
|
|
108
|
-
'10.0': '10',
|
|
109
|
-
'11.0': '11' // 自定的,不是微软官方的判断方法
|
|
110
|
-
}
|
|
111
|
-
return hash[v] || v
|
|
112
|
-
},
|
|
113
|
-
Android: function () {
|
|
114
|
-
return u.replace(/^.*Android ([\d.]+);.*$/, '$1')
|
|
115
|
-
},
|
|
116
|
-
iOS: function () {
|
|
117
|
-
return u.replace(/^.*OS ([\d_]+) like.*$/, '$1').replace(/_/g, '.')
|
|
118
|
-
},
|
|
119
|
-
Debian: function () {
|
|
120
|
-
return u.replace(/^.*Debian\/([\d.]+).*$/, '$1')
|
|
121
|
-
},
|
|
122
|
-
'Windows Phone': function () {
|
|
123
|
-
return u.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/, '$2')
|
|
124
|
-
},
|
|
125
|
-
'Mac OS': function () {
|
|
126
|
-
return u.replace(/^.*Mac OS X ([\d_]+).*$/, '$1').replace(/_/g, '.')
|
|
127
|
-
},
|
|
128
|
-
WebOS: function () {
|
|
129
|
-
return u.replace(/^.*hpwOS\/([\d.]+);.*$/, '$1')
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
_this.osVersion = ''
|
|
133
|
-
if (osVersion[_this.os]) {
|
|
134
|
-
_this.osVersion = osVersion[_this.os]()
|
|
135
|
-
if (_this.osVersion === u) {
|
|
136
|
-
_this.osVersion = ''
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
// 浏览器版本信息
|
|
140
|
-
var version = {
|
|
141
|
-
Safari: function () {
|
|
142
|
-
return u.replace(/^.*Version\/([\d.]+).*$/, '$1')
|
|
143
|
-
},
|
|
144
|
-
Chrome: function () {
|
|
145
|
-
return u.replace(/^.*Chrome\/([\d.]+).*$/, '$1').replace(/^.*CriOS\/([\d.]+).*$/, '$1')
|
|
146
|
-
},
|
|
147
|
-
IE: function () {
|
|
148
|
-
return u.replace(/^.*MSIE ([\d.]+).*$/, '$1').replace(/^.*rv:([\d.]+).*$/, '$1')
|
|
149
|
-
},
|
|
150
|
-
Edge: function () {
|
|
151
|
-
return u.replace(/^.*Edge\/([\d.]+).*$/, '$1')
|
|
152
|
-
},
|
|
153
|
-
Firefox: function () {
|
|
154
|
-
return u.replace(/^.*Firefox\/([\d.]+).*$/, '$1').replace(/^.*FxiOS\/([\d.]+).*$/, '$1')
|
|
155
|
-
},
|
|
156
|
-
'Firefox Focus': function () {
|
|
157
|
-
return u.replace(/^.*Focus\/([\d.]+).*$/, '$1')
|
|
158
|
-
},
|
|
159
|
-
Chromium: function () {
|
|
160
|
-
return u.replace(/^.*Chromium\/([\d.]+).*$/, '$1')
|
|
161
|
-
},
|
|
162
|
-
Opera: function () {
|
|
163
|
-
return u.replace(/^.*Opera\/([\d.]+).*$/, '$1').replace(/^.*OPR\/([\d.]+).*$/, '$1')
|
|
164
|
-
},
|
|
165
|
-
Vivaldi: function () {
|
|
166
|
-
return u.replace(/^.*Vivaldi\/([\d.]+).*$/, '$1')
|
|
167
|
-
},
|
|
168
|
-
Yandex: function () {
|
|
169
|
-
return u.replace(/^.*YaBrowser\/([\d.]+).*$/, '$1')
|
|
170
|
-
},
|
|
171
|
-
Kindle: function () {
|
|
172
|
-
return u.replace(/^.*Version\/([\d.]+).*$/, '$1')
|
|
173
|
-
},
|
|
174
|
-
Maxthon: function () {
|
|
175
|
-
return u.replace(/^.*Maxthon\/([\d.]+).*$/, '$1')
|
|
176
|
-
},
|
|
177
|
-
QQBrowser: function () {
|
|
178
|
-
return u.replace(/^.*QQBrowser\/([\d.]+).*$/, '$1')
|
|
179
|
-
},
|
|
180
|
-
QQ: function () {
|
|
181
|
-
return u.replace(/^.*QQ\/([\d.]+).*$/, '$1')
|
|
182
|
-
},
|
|
183
|
-
Baidu: function () {
|
|
184
|
-
return u.replace(/^.*BIDUBrowser[\s/]([\d.]+).*$/, '$1')
|
|
185
|
-
},
|
|
186
|
-
UC: function () {
|
|
187
|
-
return u.replace(/^.*UC?Browser\/([\d.]+).*$/, '$1')
|
|
188
|
-
},
|
|
189
|
-
Sogou: function () {
|
|
190
|
-
return u.replace(/^.*SE ([\d.X]+).*$/, '$1').replace(/^.*SogouMobileBrowser\/([\d.]+).*$/, '$1')
|
|
191
|
-
},
|
|
192
|
-
'2345Explorer': function () {
|
|
193
|
-
return u.replace(/^.*2345Explorer\/([\d.]+).*$/, '$1')
|
|
194
|
-
},
|
|
195
|
-
TheWorld: function () {
|
|
196
|
-
return u.replace(/^.*TheWorld ([\d.]+).*$/, '$1')
|
|
197
|
-
},
|
|
198
|
-
XiaoMi: function () {
|
|
199
|
-
return u.replace(/^.*MiuiBrowser\/([\d.]+).*$/, '$1')
|
|
200
|
-
},
|
|
201
|
-
Quark: function () {
|
|
202
|
-
return u.replace(/^.*Quark\/([\d.]+).*$/, '$1')
|
|
203
|
-
},
|
|
204
|
-
Qiyu: function () {
|
|
205
|
-
return u.replace(/^.*Qiyu\/([\d.]+).*$/, '$1')
|
|
206
|
-
},
|
|
207
|
-
Wechat: function () {
|
|
208
|
-
return u.replace(/^.*MicroMessenger\/([\d.]+).*$/, '$1')
|
|
209
|
-
},
|
|
210
|
-
Taobao: function () {
|
|
211
|
-
return u.replace(/^.*AliApp\(TB\/([\d.]+).*$/, '$1')
|
|
212
|
-
},
|
|
213
|
-
Alipay: function () {
|
|
214
|
-
return u.replace(/^.*AliApp\(AP\/([\d.]+).*$/, '$1')
|
|
215
|
-
},
|
|
216
|
-
Weibo: function () {
|
|
217
|
-
return u.replace(/^.*weibo__([\d.]+).*$/, '$1')
|
|
218
|
-
},
|
|
219
|
-
Douban: function () {
|
|
220
|
-
return u.replace(/^.*com.douban.frodo\/([\d.]+).*$/, '$1')
|
|
221
|
-
},
|
|
222
|
-
Suning: function () {
|
|
223
|
-
return u.replace(/^.*SNEBUY-APP([\d.]+).*$/, '$1')
|
|
224
|
-
},
|
|
225
|
-
iQiYi: function () {
|
|
226
|
-
return u.replace(/^.*IqiyiVersion\/([\d.]+).*$/, '$1')
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
_this.version = ''
|
|
230
|
-
if (version[_this.browser]) {
|
|
231
|
-
_this.version = version[_this.browser]()
|
|
232
|
-
if (_this.version === u) {
|
|
233
|
-
_this.version = ''
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// 简化版本号
|
|
238
|
-
/* if (_this.osVersion.indexOf('.')) {
|
|
239
|
-
_this.osVersion = _this.osVersion.substring(0, _this.osVersion.indexOf('.'))
|
|
240
|
-
} */
|
|
241
|
-
if (_this.version.indexOf('.')) {
|
|
242
|
-
_this.version = _this.version.substring(0, _this.version.indexOf('.'))
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// 修正
|
|
246
|
-
if (_this.browser === 'Edge') {
|
|
247
|
-
_this.engine = 'EdgeHTML'
|
|
248
|
-
} else if (_this.browser === 'Chrome' && parseInt(_this.version) > 27) {
|
|
249
|
-
_this.engine = 'Blink'
|
|
250
|
-
} else if (_this.browser === 'Opera' && parseInt(_this.version) > 12) {
|
|
251
|
-
_this.engine = 'Blink'
|
|
252
|
-
} else if (_this.browser === 'Yandex') {
|
|
253
|
-
_this.engine = 'Blink'
|
|
254
|
-
} else if (_this.browser === undefined) {
|
|
255
|
-
_this.browser = 'Unknow App'
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
function detectFactory (u) {
|
|
260
|
-
return new Detect(u)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
export default detectFactory
|