mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 04:01:20 -08:00
Optimize setBar event and remove unnecessary class manipulation in artplayer-plugin-chapter
This commit is contained in:
1 parent
f3db438d6b
commit
5160dcabca
3 files changed
+6
-9
No files matched your search
@@ -42,6 +42,8 @@ export default function artplayerPluginChapter(option = {}) {
|
||||
}
|
||||
|
||||
function update(chapters = []) {
|
||||
removeClass($player, 'artplayer-plugin-chapter');
|
||||
|
||||
if (!Array.isArray(chapters)) return;
|
||||
if (!chapters.length) return;
|
||||
if (!art.duration) return;
|
||||
@@ -108,12 +110,7 @@ export default function artplayerPluginChapter(option = {}) {
|
||||
};
|
||||
});
|
||||
|
||||
if ($chapters.length) {
|
||||
addClass($player, 'artplayer-plugin-chapter');
|
||||
} else {
|
||||
removeClass($player, 'artplayer-plugin-chapter');
|
||||
}
|
||||
|
||||
addClass($player, 'artplayer-plugin-chapter');
|
||||
art.emit('setBar', 'loaded', art.loaded || 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user