mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-11 05:26:15 -08:00
* update dep * Update package.json * update contextmenu * update d.ts * update onVttLoad * build artplayer * update style * --art-theme * update style * update style * update user-select * add getIcon * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * update style * add progress-hover * update mini * update style * update style * update style * update style * update style * update volume * update style * add art-backdrop * update style * update style * update style * update currentLevel * update artplayerPluginControl * update artplayerPluginDanmuku * Update package.json
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import { inverseClass, query, queryAll, capitalize } from '../utils';
|
|
|
|
export default function flip(option) {
|
|
return (art) => {
|
|
const {
|
|
i18n,
|
|
constructor: { FLIP },
|
|
} = art;
|
|
|
|
const html = FLIP.map((item) => `<span data-value="${item}">${i18n.get(capitalize(item))}</span>`).join('');
|
|
|
|
return {
|
|
...option,
|
|
html: `${i18n.get('Video Flip')}: ${html}`,
|
|
click: (contextmenu, event) => {
|
|
const { value } = event.target.dataset;
|
|
if (value) {
|
|
art.flip = value.toLowerCase();
|
|
contextmenu.show = false;
|
|
}
|
|
},
|
|
mounted: ($panel) => {
|
|
const $default = query('[data-value="normal"]', $panel);
|
|
if ($default) {
|
|
inverseClass($default, 'art-current');
|
|
}
|
|
art.on('flip', (value) => {
|
|
const $current = queryAll('span', $panel).find((item) => item.dataset.value === value);
|
|
if ($current) {
|
|
inverseClass($current, 'art-current');
|
|
}
|
|
});
|
|
},
|
|
};
|
|
};
|
|
}
|