mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 08:01:20 -08:00
优化手机端UI
This commit is contained in:
1 parent
19a894fcb6
commit
beea013daf
16 files changed
+249
-129
No files matched your search
@@ -1,23 +1,19 @@
|
||||
import { isMobile, userAgent } from './utils/compatibility';
|
||||
|
||||
export default class Whitelist {
|
||||
constructor(art) {
|
||||
const {
|
||||
constructor: { kindOf },
|
||||
option: { whitelist },
|
||||
} = art;
|
||||
this.ua = userAgent;
|
||||
this.isMobile = isMobile();
|
||||
this.state =
|
||||
!this.isMobile ||
|
||||
!art.isMobile ||
|
||||
whitelist.some((item) => {
|
||||
switch (kindOf(item)) {
|
||||
case 'string':
|
||||
return this.ua.indexOf(item) > -1;
|
||||
return item === '*' || art.ua.indexOf(item) > -1;
|
||||
case 'function':
|
||||
return item(this.ua);
|
||||
return item(art.ua);
|
||||
case 'regexp':
|
||||
return item.test(this.ua);
|
||||
return item.test(art.ua);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user