mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
use ||
This commit is contained in:
1 parent
cafff9b155
commit
95ba1810b6
30 files changed
+447
-447
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;
|
||||
|
||||
Reference in new issue
Block a user