feat: Optimize chapter handling in artplayer-plugin-chapter

This commit is contained in:
Harvey Zack committed 2024-06-03 12:00:44 +08:00
1 parent e11a2da806
commit 999988465c
3 files changed
+5 -3

No files matched your search

@@ -42,6 +42,8 @@ export default function artplayerPluginChapter(option = {}) {
}
function update(chapters = []) {
$chapters = [];
$control.innerText = '';
removeClass($player, 'artplayer-plugin-chapter');
if (!Array.isArray(chapters)) return;
@@ -93,7 +95,6 @@ export default function artplayerPluginChapter(option = {}) {
}
}
$control.innerText = '';
$chapters = chapters.map((chapter) => {
const $chapter = append($control, html);
const start = clamp(chapter.start, 0, art.duration);