add Artplayer.LOG_VERSION

This commit is contained in:
Harvey Zack committed 2023-08-22 20:51:39 +08:00
1 parent 3179d1241e
commit 894a9db1d7
34 files changed
+182 -136

No files matched your search

@@ -25,19 +25,19 @@ export default function autoPlayback(art) {
art.on('video:timeupdate', () => {
if (art.playing) {
const times = storage.get('times') || {};
const times = storage.get('times') ?? {};
const keys = Object.keys(times);
if (keys.length > constructor.AUTO_PLAYBACK_MAX) {
delete times[keys[0]];
}
times[art.option.id || art.option.url] = art.currentTime;
times[art.option.id ?? art.option.url] = art.currentTime;
storage.set('times', times);
}
});
art.on('ready', () => {
const times = storage.get('times') || {};
const currentTime = times[art.option.id || art.option.url];
const times = storage.get('times') ?? {};
const currentTime = times[art.option.id ?? art.option.url];
if (currentTime && currentTime >= constructor.AUTO_PLAYBACK_MIN) {
append($close, icons.close);
setStyle($autoPlayback, 'display', 'flex');
@@ -67,13 +67,13 @@ export default function autoPlayback(art) {
return {
name: 'auto-playback',
get times() {
return storage.get('times') || {};
return storage.get('times') ?? {};
},
clear() {
return storage.del('times');
},
delete(id) {
const times = storage.get('times') || {};
const times = storage.get('times') ?? {};
delete times[id];
storage.set('times', times);
return times;