mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
删除多余事件
This commit is contained in:
1 parent
e0faa3fe68
commit
7ff61b4660
38 files changed
+266
-516
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { append, tooltip, setStyle } from '../utils';
|
||||
import { append, tooltip } from '../utils';
|
||||
|
||||
export default function fullscreen(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Fullscreen'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
@@ -11,21 +12,14 @@ export default function fullscreen(option) {
|
||||
player,
|
||||
} = art;
|
||||
|
||||
const $fullscreen = append($control, icons.fullscreen);
|
||||
tooltip($fullscreen, i18n.get('Fullscreen'));
|
||||
append($control, icons.fullscreen);
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
player.fullscreenToggle = true;
|
||||
});
|
||||
|
||||
art.on('fullscreenEnabled', () => {
|
||||
setStyle($fullscreen, 'opacity', '0.8');
|
||||
tooltip($fullscreen, i18n.get('Exit fullscreen'));
|
||||
});
|
||||
|
||||
art.on('fullscreenExit', () => {
|
||||
setStyle($fullscreen, 'opacity', '1');
|
||||
tooltip($fullscreen, i18n.get('Fullscreen'));
|
||||
art.on('fullscreenChange', value => {
|
||||
tooltip($control, i18n.get(value ? 'Exit fullscreen' : 'Fullscreen'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { append, tooltip, setStyle } from '../utils';
|
||||
import { append, tooltip } from '../utils';
|
||||
|
||||
export default function fullscreenWeb(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Web fullscreen'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
@@ -11,21 +12,14 @@ export default function fullscreenWeb(option) {
|
||||
player,
|
||||
} = art;
|
||||
|
||||
const $fullscreenWeb = append($control, icons.fullscreenWeb);
|
||||
tooltip($fullscreenWeb, i18n.get('Web fullscreen'));
|
||||
append($control, icons.fullscreenWeb);
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
player.fullscreenWebToggle = true;
|
||||
});
|
||||
|
||||
art.on('fullscreenWebEnabled', () => {
|
||||
setStyle($fullscreenWeb, 'opacity', '0.8');
|
||||
tooltip($fullscreenWeb, i18n.get('Exit web fullscreen'));
|
||||
});
|
||||
|
||||
art.on('fullscreenWebExit', () => {
|
||||
setStyle($fullscreenWeb, 'opacity', '1');
|
||||
tooltip($fullscreenWeb, i18n.get('Web fullscreen'));
|
||||
art.on('fullscreenWebChange', value => {
|
||||
tooltip($control, i18n.get(value ? 'Exit web fullscreen' : 'Web fullscreen'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -136,7 +136,10 @@ export default class Control extends Component {
|
||||
|
||||
add(getOption, callback) {
|
||||
const option = typeof getOption === 'function' ? getOption(this.art) : getOption;
|
||||
errorHandle(option.position, 'Controls option.position can not be empty');
|
||||
errorHandle(
|
||||
['top', 'left', 'right'].includes(option.position),
|
||||
`Control option.position must one of 'top', 'left', 'right'`,
|
||||
);
|
||||
const { $progress, $controlsLeft, $controlsRight } = this.art.template;
|
||||
|
||||
switch (option.position) {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { append, tooltip } from '../utils';
|
||||
export default function pip(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Mini player'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
@@ -10,10 +11,15 @@ export default function pip(option) {
|
||||
i18n,
|
||||
player,
|
||||
} = art;
|
||||
const $pip = append($control, icons.pip);
|
||||
tooltip($pip, i18n.get('Mini player'));
|
||||
|
||||
append($control, icons.pip);
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
player.pip = true;
|
||||
player.pipToggle = true;
|
||||
});
|
||||
|
||||
art.on('pipChange', value => {
|
||||
tooltip($control, i18n.get(value ? 'Exit mini player' : 'Mini player'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
import { append, tooltip } from '../utils';
|
||||
import { append } from '../utils';
|
||||
|
||||
export default function screenshot(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Screenshot'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
icons,
|
||||
i18n,
|
||||
player,
|
||||
} = art;
|
||||
|
||||
const $screenshot = append($control, icons.screenshot);
|
||||
tooltip($screenshot, i18n.get('Screenshot'));
|
||||
proxy($screenshot, 'click', () => {
|
||||
append($control, icons.screenshot);
|
||||
proxy($control, 'click', () => {
|
||||
player.screenshot();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { append, tooltip, setStyle } from '../utils';
|
||||
import { append, tooltip } from '../utils';
|
||||
|
||||
export default function setting(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Show setting'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
@@ -11,8 +12,7 @@ export default function setting(option) {
|
||||
setting,
|
||||
} = art;
|
||||
|
||||
const $setting = append($control, icons.setting);
|
||||
tooltip($setting, i18n.get('Show setting'));
|
||||
append($control, icons.setting);
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
setting.toggle();
|
||||
@@ -20,11 +20,9 @@ export default function setting(option) {
|
||||
|
||||
art.on('setting:toggle', value => {
|
||||
if (value) {
|
||||
setStyle($setting, 'opacity', '0.8');
|
||||
tooltip($setting, i18n.get('Hide setting'));
|
||||
tooltip($control, i18n.get('Hide setting'));
|
||||
} else {
|
||||
setStyle($setting, 'opacity', '1');
|
||||
tooltip($setting, i18n.get('Show setting'));
|
||||
tooltip($control, i18n.get('Show setting'));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { append, tooltip, setStyle } from '../utils';
|
||||
import { append, tooltip } from '../utils';
|
||||
|
||||
export default function subtitle(option) {
|
||||
return art => ({
|
||||
...option,
|
||||
tooltip: art.i18n.get('Hide subtitle'),
|
||||
mounted: $control => {
|
||||
const {
|
||||
events: { proxy },
|
||||
@@ -11,21 +12,14 @@ export default function subtitle(option) {
|
||||
subtitle,
|
||||
} = art;
|
||||
|
||||
const $subtitle = append($control, icons.subtitle);
|
||||
tooltip($subtitle, i18n.get('Hide subtitle'));
|
||||
append($control, icons.subtitle);
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
subtitle.toggle();
|
||||
subtitle.toggle = true;
|
||||
});
|
||||
|
||||
art.on('subtitle:toggle', value => {
|
||||
if (value) {
|
||||
setStyle($subtitle, 'opacity', '1');
|
||||
tooltip($subtitle, i18n.get('Hide subtitle'));
|
||||
} else {
|
||||
setStyle($subtitle, 'opacity', '0.8');
|
||||
tooltip($subtitle, i18n.get('Show subtitle'));
|
||||
}
|
||||
tooltip($control, i18n.get(value ? 'Hide subtitle' : 'Show subtitle'));
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user