mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 05:26:15 -08:00
添加重置方法
This commit is contained in:
1 parent
5fcff320cf
commit
d7cb9d16b8
4 files changed
+56
-8
No files matched your search
+21
-1
@@ -1,4 +1,4 @@
|
||||
import { clamp, secondToTime, setStorage, sleep, setStyle } from './utils';
|
||||
import { clamp, secondToTime, setStorage, sleep, setStyle, sublings } from './utils';
|
||||
import config from './config';
|
||||
|
||||
export default class Player {
|
||||
@@ -173,6 +173,7 @@ export default class Player {
|
||||
if (isPlaying) {
|
||||
this.play();
|
||||
}
|
||||
this.reset();
|
||||
notice.show(`${i18n.get('Switch')}: ${name}`);
|
||||
this.art.emit('switch', url);
|
||||
}
|
||||
@@ -219,4 +220,23 @@ export default class Player {
|
||||
notice.show(`${i18n.get('Aspect ratio')}: ${ratioName}`);
|
||||
this.art.emit('aspectRatio', ratio);
|
||||
}
|
||||
|
||||
reset() {
|
||||
const { refs: { $video }, contextmenu } = this.art;
|
||||
|
||||
if (contextmenu.$playbackRate) {
|
||||
const $normal = contextmenu.$playbackRate.querySelector('.normal');
|
||||
sublings($normal).forEach(item => item.classList.remove('current'));
|
||||
$normal.classList.add('current');
|
||||
}
|
||||
|
||||
setStyle($video, 'width', null);
|
||||
setStyle($video, 'height', null);
|
||||
setStyle($video, 'padding', null);
|
||||
if (contextmenu.$aspectRatio) {
|
||||
const $default = contextmenu.$aspectRatio.querySelector('.default');
|
||||
sublings($default).forEach(item => item.classList.remove('current'));
|
||||
$default.classList.add('current');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user