Files
Auto_Bangumi/webui/public/theme-init.js
Estrella Pan bf1c8db08c feat(4.0-P6): 前端插件后端与 plugin-ui 工作区包
- 清单 [[plugin.ui]]:五个挂载点、ab-plugin- 元素名与 web/ 入口校验
- GET /plugins/ui 列出已启用插件的挂载点;GET /plugins/{id}/web/{path} 提供静态资源(防路径穿越、JS MIME、需登录)
- SPA 文档加 CSP script-src 'self',内联深色模式脚本移到 theme-init.js
- webui/packages/plugin-ui:AbHost 类型、--ab-* 主题变量、Vite 库模式模板
- 设计文档第 0 节记录第一部分的调整
2026-10-08 13:31:03 +02:00

8 lines
356 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 渲染前应用深色模式,避免闪烁。CSP 为 script-src 'self',不能写成内联脚本。
(function () {
const saved = localStorage.getItem('theme');
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
if (saved === 'dark' || (!saved && prefersDark))
document.documentElement.classList.add('dark');
})();