perf+ui: gzip (api/static precompressed), immutable attachment cache, responsive dialogs/header, safe-area + dynamic theme-color, mobile tuning
This commit is contained in:
@@ -17,6 +17,14 @@ if (saved === 'dark' || (!saved && window.matchMedia('(prefers-color-scheme: dar
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
|
||||
// 状态栏/标题栏颜色跟随主题(亮暗切换实时同步)
|
||||
function syncThemeColor() {
|
||||
const bg = getComputedStyle(document.documentElement).getPropertyValue('--bg').trim();
|
||||
if (bg) document.querySelector('meta[name="theme-color"]')?.setAttribute('content', bg);
|
||||
}
|
||||
syncThemeColor();
|
||||
window.addEventListener('fp-theme-change', syncThemeColor);
|
||||
|
||||
// PWA:仅生产构建且非桌面壳时注册(桌面端走 Tauri,无需 SW)
|
||||
if ('serviceWorker' in navigator && import.meta.env.PROD && !('__TAURI_INTERNALS__' in window)) {
|
||||
window.addEventListener('load', () => {
|
||||
|
||||
Reference in New Issue
Block a user