mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-16 17:46:17 -08:00
31 lines
1.1 KiB
JavaScript
31 lines
1.1 KiB
JavaScript
import { inverseClass, queryAll } from '../utils';
|
|
|
|
export default function flip(option) {
|
|
return (art) => {
|
|
const { i18n } = art;
|
|
return {
|
|
...option,
|
|
html: `${i18n.get('Video Flip')}:
|
|
<span data-flip="normal" class="art-current">${i18n.get('Normal')}</span>
|
|
<span data-flip="horizontal">${i18n.get('Horizontal')}</span>
|
|
<span data-flip="vertical">${i18n.get('Vertical')}</span>
|
|
`,
|
|
click: (contextmenu, event) => {
|
|
const { flip } = event.target.dataset;
|
|
if (flip) {
|
|
art.flip = flip;
|
|
contextmenu.show = false;
|
|
}
|
|
},
|
|
mounted: ($menu) => {
|
|
art.on('flip', (flip) => {
|
|
const $current = queryAll('span', $menu).find((item) => item.dataset.flip === flip);
|
|
if ($current) {
|
|
inverseClass($current, 'art-current');
|
|
}
|
|
});
|
|
},
|
|
};
|
|
};
|
|
}
|