chore: 更新版本至 5.1.6,修复样式加载失败问题并优化样式插入逻辑

This commit is contained in:
Harvey Zack committed 2025-01-19 20:50:26 +08:00
1 parent c89b9e7871
commit 4b4973eeb3
9 files changed
+45 -32

No files matched your search

@@ -275,20 +275,22 @@ function artplayerPluginChapter(option = {}) {
art.once("video:loadedmetadata", ()=>update(option.chapters));
return {
name: "artplayerPluginChapter",
update: (chapters)=>update(chapters)
update: ({ chapters })=>update(chapters)
};
};
}
if (typeof document !== "undefined") {
const id = "artplayer-plugin-chapter";
const $style = document.getElementById(id);
if ($style) $style.textContent = (0, _styleLessDefault.default);
else {
const $style = document.createElement("style");
let $style = document.getElementById(id);
if (!$style) {
$style = document.createElement("style");
$style.id = id;
$style.textContent = (0, _styleLessDefault.default);
document.head.appendChild($style);
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", ()=>{
document.head.appendChild($style);
});
else (document.head || document.documentElement).appendChild($style);
}
$style.textContent = (0, _styleLessDefault.default);
}
if (typeof window !== "undefined") window["artplayerPluginChapter"] = artplayerPluginChapter;