mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-21 04:31:20 -08:00
4.3.1
This commit is contained in:
1 parent
222f786b88
commit
ce677ef602
62 files changed
+245
-224
No files matched your search
@@ -7,8 +7,8 @@ export default function aspectRatio(art) {
|
||||
return value === 'default' ? i18n.get('Default') : value;
|
||||
}
|
||||
|
||||
function update($panel, $description, value) {
|
||||
if ($description) $description.innerText = getI18n(value);
|
||||
function update($panel, $tooltip, value) {
|
||||
if ($tooltip) $tooltip.innerText = getI18n(value);
|
||||
const $current = queryAll('.art-setting-item', $panel).find((item) => item.dataset.value === value);
|
||||
if ($current) inverseClass($current, 'art-current');
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export default function aspectRatio(art) {
|
||||
width: 200,
|
||||
html: i18n.get('Aspect Ratio'),
|
||||
icon: icons.aspectRatio,
|
||||
description: getI18n(art.aspectRatio),
|
||||
tooltip: getI18n(art.aspectRatio),
|
||||
selector: ['default', '4:3', '16:9'].map((item) => {
|
||||
return {
|
||||
value: item,
|
||||
@@ -29,9 +29,9 @@ export default function aspectRatio(art) {
|
||||
art.aspectRatio = item.value;
|
||||
},
|
||||
mounted: ($panel, item) => {
|
||||
update($panel, item._$description, art.aspectRatio);
|
||||
update($panel, item._$tooltip, art.aspectRatio);
|
||||
art.on('aspectRatio', () => {
|
||||
update($panel, item._$description, art.aspectRatio);
|
||||
update($panel, item._$tooltip, art.aspectRatio);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,8 +9,8 @@ export default function flip(art) {
|
||||
vertical: 'Vertical',
|
||||
};
|
||||
|
||||
function update($panel, $description, value) {
|
||||
if ($description) $description.innerText = i18n.get(keys[value]);
|
||||
function update($panel, $tooltip, value) {
|
||||
if ($tooltip) $tooltip.innerText = i18n.get(keys[value]);
|
||||
const $current = queryAll('.art-setting-item', $panel).find((item) => item.dataset.value === value);
|
||||
if ($current) inverseClass($current, 'art-current');
|
||||
}
|
||||
@@ -18,7 +18,7 @@ export default function flip(art) {
|
||||
return {
|
||||
width: 200,
|
||||
html: i18n.get('Video Flip'),
|
||||
description: i18n.get(keys[art.flip]),
|
||||
tooltip: i18n.get(keys[art.flip]),
|
||||
icon: icons.config,
|
||||
selector: Object.keys(keys).map((item) => {
|
||||
return {
|
||||
@@ -31,9 +31,9 @@ export default function flip(art) {
|
||||
art.flip = item.value;
|
||||
},
|
||||
mounted: ($panel, item) => {
|
||||
update($panel, item._$description, art.flip);
|
||||
update($panel, item._$tooltip, art.flip);
|
||||
art.on('flip', () => {
|
||||
update($panel, item._$description, art.flip);
|
||||
update($panel, item._$tooltip, art.flip);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -133,13 +133,13 @@ export default class Setting extends Component {
|
||||
append($left, item.html);
|
||||
|
||||
if (hasChildren) {
|
||||
const $description = document.createElement('div');
|
||||
addClass($description, 'art-setting-item-right-description');
|
||||
append($right, $description);
|
||||
item._$description = $description;
|
||||
const $tooltip = document.createElement('div');
|
||||
addClass($tooltip, 'art-setting-item-right-tooltip');
|
||||
append($right, $tooltip);
|
||||
item._$tooltip = $tooltip;
|
||||
|
||||
if (item.description) {
|
||||
$description.innerHTML = item.description;
|
||||
if (item.tooltip) {
|
||||
$tooltip.innerHTML = item.tooltip;
|
||||
}
|
||||
|
||||
const $iconRight = document.createElement('div');
|
||||
@@ -160,9 +160,9 @@ export default class Setting extends Component {
|
||||
|
||||
if (item._parentItem && item._parentItem.onSelect) {
|
||||
const result = item._parentItem.onSelect.call(this.art, item, $item, event);
|
||||
if (item._parentItem._$description) {
|
||||
if (item._parentItem._$tooltip) {
|
||||
if (typeof result === 'string' || typeof result === 'number') {
|
||||
item._parentItem._$description.innerHTML = result;
|
||||
item._parentItem._$tooltip.innerHTML = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,11 @@ export default class Setting extends Component {
|
||||
}
|
||||
|
||||
add(callback) {
|
||||
this.option.push(callback(this.art));
|
||||
if (typeof callback === 'function') {
|
||||
this.option.push(callback(this.art));
|
||||
} else {
|
||||
this.option.push(callback);
|
||||
}
|
||||
this.option = makeRecursion(this.option);
|
||||
this.init(this.option);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ export default function playbackRate(art) {
|
||||
return value === 1.0 ? i18n.get('Normal') : value;
|
||||
}
|
||||
|
||||
function update($panel, $description, value) {
|
||||
if ($description) $description.innerText = getI18n(value);
|
||||
function update($panel, $tooltip, value) {
|
||||
if ($tooltip) $tooltip.innerText = getI18n(value);
|
||||
const $current = queryAll('.art-setting-item', $panel).find((item) => Number(item.dataset.value) === value);
|
||||
if ($current) inverseClass($current, 'art-current');
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default function playbackRate(art) {
|
||||
return {
|
||||
width: 200,
|
||||
html: i18n.get('Play Speed'),
|
||||
description: getI18n(art.playbackRate),
|
||||
tooltip: getI18n(art.playbackRate),
|
||||
icon: icons.playbackRate,
|
||||
selector: [0.5, 0.75, 1.0, 1.25, 1.5, 2.0].map((item) => {
|
||||
return {
|
||||
@@ -29,9 +29,9 @@ export default function playbackRate(art) {
|
||||
art.playbackRate = item.value;
|
||||
},
|
||||
mounted: ($panel, item) => {
|
||||
update($panel, item._$description, art.playbackRate);
|
||||
update($panel, item._$tooltip, art.playbackRate);
|
||||
art.on('playbackRate', () => {
|
||||
update($panel, item._$description, art.playbackRate);
|
||||
update($panel, item._$tooltip, art.playbackRate);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -7,8 +7,8 @@ export default function subtitleOffset(art) {
|
||||
return value === 0 ? i18n.get('Normal') : value;
|
||||
}
|
||||
|
||||
function update($panel, $description, value) {
|
||||
if ($description) $description.innerText = getI18n(value);
|
||||
function update($panel, $tooltip, value) {
|
||||
if ($tooltip) $tooltip.innerText = getI18n(value);
|
||||
const $current = queryAll('.art-setting-item', $panel).find((item) => Number(item.dataset.value) === value);
|
||||
if ($current) inverseClass($current, 'art-current');
|
||||
}
|
||||
@@ -16,7 +16,7 @@ export default function subtitleOffset(art) {
|
||||
return {
|
||||
width: 200,
|
||||
html: i18n.get('Subtitle Offset'),
|
||||
description: getI18n(art.subtitleOffset),
|
||||
tooltip: getI18n(art.subtitleOffset),
|
||||
icon: icons.subtitle,
|
||||
selector: [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5].map((item) => {
|
||||
return {
|
||||
@@ -29,9 +29,9 @@ export default function subtitleOffset(art) {
|
||||
art.subtitleOffset = item.value;
|
||||
},
|
||||
mounted: ($panel, item) => {
|
||||
update($panel, item._$description, art.subtitleOffset);
|
||||
update($panel, item._$tooltip, art.subtitleOffset);
|
||||
art.on('subtitleOffset', () => {
|
||||
update($panel, item._$description, art.subtitleOffset);
|
||||
update($panel, item._$tooltip, art.subtitleOffset);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user