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

@@ -1,6 +1,6 @@
{
"license": "MIT",
"version": "1.0.0",
"version": "1.0.1",
"name": "artplayer-plugin-chapter",
"types": "types/artplayer-plugin-chapter.d.ts",
"description": "chapter plugin for ArtPlayer",
@@ -21,4 +21,4 @@
"video",
"player"
]
}
}
+11 -7
View File
@@ -186,15 +186,19 @@ export default function artplayerPluginChapter(option = {}) {
if (typeof document !== 'undefined') {
const id = 'artplayer-plugin-chapter';
const $style = document.getElementById(id);
if ($style) {
$style.textContent = style;
} else {
const $style = document.createElement('style');
let $style = document.getElementById(id);
if (!$style) {
$style = document.createElement('style');
$style.id = id;
$style.textContent = style;
document.head.appendChild($style);
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
document.head.appendChild($style);
});
} else {
(document.head || document.documentElement).appendChild($style);
}
}
$style.textContent = style;
}
if (typeof window !== 'undefined') {
@@ -1,6 +1,6 @@
{
"license": "MIT",
"version": "5.1.5",
"version": "5.1.6",
"name": "artplayer-plugin-danmuku",
"types": "types/artplayer-plugin-danmuku.d.ts",
"description": "Danmuku plugin for ArtPlayer",
@@ -724,13 +724,17 @@ export default class Setting {
if (typeof document !== 'undefined') {
const id = 'artplayer-plugin-danmuku';
const $style = document.getElementById(id);
if ($style) {
$style.textContent = style;
} else {
const $style = document.createElement('style');
let $style = document.getElementById(id);
if (!$style) {
$style = document.createElement('style');
$style.id = id;
$style.textContent = style;
document.head.appendChild($style);
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
document.head.appendChild($style);
});
} else {
(document.head || document.documentElement).appendChild($style);
}
}
$style.textContent = style;
}