mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
37 lines
633 B
JavaScript
37 lines
633 B
JavaScript
import icons from './icons';
|
|
import { append } from './utils';
|
|
|
|
export default class Mask {
|
|
constructor(art) {
|
|
this.art = art;
|
|
this.init();
|
|
}
|
|
|
|
init() {
|
|
const {
|
|
player,
|
|
refs,
|
|
events: { proxy }
|
|
} = this.art;
|
|
|
|
append(refs.$mask, icons.playBig);
|
|
|
|
proxy(refs.$mask, 'click', () => {
|
|
player.play();
|
|
this.hide();
|
|
});
|
|
}
|
|
|
|
show() {
|
|
const { $mask } = this.art.refs;
|
|
$mask.style.display = 'block';
|
|
this.art.emit('mask:show', $mask);
|
|
}
|
|
|
|
hide() {
|
|
const { $mask } = this.art.refs;
|
|
$mask.style.display = 'none';
|
|
this.art.emit('mask:show', $mask);
|
|
}
|
|
}
|