mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
压缩字符
This commit is contained in:
1 parent
2df60a78ff
commit
5f40463713
40 files changed
+385
-481
No files matched your search
@@ -1,20 +1,22 @@
|
||||
export default class Whitelist {
|
||||
constructor(art) {
|
||||
const { kindOf } = art.constructor;
|
||||
const { whitelist } = art.option;
|
||||
this.userAgent = window.navigator.userAgent;
|
||||
this.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.userAgent);
|
||||
const {
|
||||
constructor: { kindOf },
|
||||
option: { whitelist },
|
||||
} = art;
|
||||
this.ua = window.navigator.userAgent;
|
||||
this.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(this.ua);
|
||||
this.state =
|
||||
!this.isMobile ||
|
||||
whitelist.some(item => {
|
||||
const type = kindOf(item);
|
||||
switch (type) {
|
||||
case 'string':
|
||||
return this.userAgent.indexOf(item) > -1;
|
||||
return this.ua.indexOf(item) > -1;
|
||||
case 'function':
|
||||
return item(this.userAgent);
|
||||
return item(this.ua);
|
||||
case 'regexp':
|
||||
return item.test(this.userAgent);
|
||||
return item.test(this.ua);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user