mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 08:51:20 -08:00
Artplayer vitepress (#446)
* init * init * update * update * update * update * update * update * add i18n option * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update
This commit is contained in:
1 parent
6a866f88c3
commit
fa7954de0d
295 files changed
+18695
-36337
No files matched your search
@@ -5,13 +5,13 @@ export default function hoverInit(art, events) {
|
||||
|
||||
events.hover(
|
||||
$player,
|
||||
() => {
|
||||
(event) => {
|
||||
addClass($player, 'art-hover');
|
||||
art.emit('hover', true);
|
||||
art.emit('hover', true, event);
|
||||
},
|
||||
() => {
|
||||
(event) => {
|
||||
removeClass($player, 'art-hover');
|
||||
art.emit('hover', false);
|
||||
art.emit('hover', false, event);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import fa from './fa.json';
|
||||
export default class I18n {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
|
||||
this.languages = {
|
||||
'zh-cn': zhCn,
|
||||
'zh-tw': zhTw,
|
||||
@@ -17,7 +18,8 @@ export default class I18n {
|
||||
es: es,
|
||||
fa: fa,
|
||||
};
|
||||
this.init();
|
||||
|
||||
this.update(art.option.i18n);
|
||||
}
|
||||
|
||||
init() {
|
||||
|
||||
@@ -188,6 +188,7 @@ export default class Artplayer extends Emitter {
|
||||
controls: false,
|
||||
preload: utils.isSafari ? 'auto' : 'metadata',
|
||||
},
|
||||
i18n: {},
|
||||
icons: {},
|
||||
customType: {},
|
||||
lang: navigator.language.toLowerCase(),
|
||||
|
||||
@@ -46,7 +46,6 @@ export default class Mobile {
|
||||
const typeCallback = option.customType[typeName];
|
||||
if (typeName && typeCallback) {
|
||||
typeCallback($video, option.url, art);
|
||||
art.emit('customType', typeName);
|
||||
} else {
|
||||
$video.src = option.url;
|
||||
art.emit('url', $video.src);
|
||||
|
||||
@@ -10,14 +10,11 @@ export default function loopMix(art) {
|
||||
const end = clamp(value[1], start, art.duration);
|
||||
if (end - start >= 1) {
|
||||
interval = [start, end];
|
||||
art.emit('loop', interval);
|
||||
} else {
|
||||
interval = [];
|
||||
art.emit('loop', []);
|
||||
}
|
||||
} else {
|
||||
interval = [];
|
||||
art.emit('loop', []);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -16,10 +16,8 @@ export default function playbackRateMix(art) {
|
||||
if (rate === $video.playbackRate) return;
|
||||
$video.playbackRate = rate;
|
||||
notice.show = `${i18n.get('Rate')}: ${rate === 1.0 ? i18n.get('Normal') : `${rate}x`}`;
|
||||
art.emit('playbackRate', rate);
|
||||
} else {
|
||||
art.playbackRate = 1;
|
||||
art.emit('playbackRate', 1);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -23,7 +23,6 @@ export default function switchMix(art) {
|
||||
if (name) {
|
||||
notice.show = `${i18n.get('Switch Video')}: ${name}`;
|
||||
}
|
||||
art.emit('switch', url);
|
||||
resolve(url);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,7 +16,6 @@ export default function volumeMix(art) {
|
||||
if ($video.volume !== 0) {
|
||||
storage.set('volume', $video.volume);
|
||||
}
|
||||
art.emit('volume', $video.volume);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -24,7 +23,6 @@ export default function volumeMix(art) {
|
||||
get: () => $video.muted,
|
||||
set: (muted) => {
|
||||
$video.muted = muted;
|
||||
art.emit('volume', $video.volume);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -28,11 +28,9 @@ export default function lock(art) {
|
||||
if (hasClass($player, 'art-lock')) {
|
||||
removeClass($player, 'art-lock');
|
||||
this.isLock = false;
|
||||
art.emit('lock', false);
|
||||
} else {
|
||||
addClass($player, 'art-lock');
|
||||
this.isLock = true;
|
||||
art.emit('lock', true);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -114,6 +114,7 @@ export default {
|
||||
encoding: s,
|
||||
},
|
||||
moreVideoAttr: o,
|
||||
i18n: o,
|
||||
icons: o,
|
||||
customType: o,
|
||||
};
|
||||
@@ -36,7 +36,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
height: 50%;
|
||||
width: 100%;
|
||||
transition: all 0.2s ease;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
|
||||
@@ -148,7 +148,6 @@ export default class Component {
|
||||
}
|
||||
}
|
||||
setLeft();
|
||||
this.art.emit('selector', find, $item);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user