mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:41:20 -08:00
update setting
This commit is contained in:
1 parent
7976cc42fe
commit
0616d944c5
7 files changed
+100
-27
No files matched your search
@@ -1,29 +1,38 @@
|
||||
import { inverseClass, queryAll } from '../utils';
|
||||
import { inverseClass, query, queryAll } from '../utils';
|
||||
|
||||
export default function playbackRate(art) {
|
||||
const { i18n, icons } = art;
|
||||
|
||||
function getI18n(value) {
|
||||
return value === 1.0 ? i18n.get('Normal') : value;
|
||||
}
|
||||
|
||||
return {
|
||||
width: 150,
|
||||
html: i18n.get('Play Speed'),
|
||||
desc: getI18n(art.playbackRate),
|
||||
icon: icons.playbackRate,
|
||||
selector: [0.5, 0.75, 1.0, 1.25, 1.5, 2.0].map((item) => {
|
||||
return {
|
||||
value: item,
|
||||
default: item === art.playbackRate,
|
||||
html: item === 1.0 ? i18n.get('Normal') : item,
|
||||
html: getI18n(item),
|
||||
};
|
||||
}),
|
||||
onSelect(item) {
|
||||
art.playbackRate = item.value;
|
||||
},
|
||||
mounted: ($panel) => {
|
||||
mounted: ($panel, item) => {
|
||||
const $desc = query('.art-setting-item-right-desc', item.$item);
|
||||
$desc.innerText = getI18n(art.playbackRate);
|
||||
|
||||
art.on('playbackRate', (value) => {
|
||||
const $current = queryAll('.art-setting-item', $panel).find(
|
||||
(item) => Number(item.dataset.value) === value,
|
||||
);
|
||||
if ($current) {
|
||||
inverseClass($current, 'art-current');
|
||||
$desc.innerText = getI18n(art.playbackRate);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user