重构: 前端Vue3+Tailwind+Vite构建管线+设置组件拆分

This commit is contained in:
lxy committed 2026-05-27 02:42:25 +08:00
1 parent f3148bf72f
commit aee7997195
44 files changed
+4309 -1720

No files matched your search

+4
View File
@@ -22,3 +22,7 @@ vendor/
# Build # Build
u-desktop u-desktop
# Web UI
web-ui/node_modules/
web-ui/dist/
+8
View File
@@ -12,6 +12,14 @@ $ErrorActionPreference = "Stop"
$project = "u-desktop" $project = "u-desktop"
$buildDir = "dist" $buildDir = "dist"
# 构建 Web UI
Write-Host "=== 构建 Web UI ===" -ForegroundColor Cyan
Push-Location web-ui
npm ci --prefer-offline
npm run build
if ($LASTEXITCODE -ne 0) { Write-Host "Web UI 构建失败" -ForegroundColor Red; exit 1 }
Pop-Location
# 清理 # 清理
if (Test-Path $buildDir) { Remove-Item $buildDir -Recurse -Force } if (Test-Path $buildDir) { Remove-Item $buildDir -Recurse -Force }
New-Item -ItemType Directory -Force -Path $buildDir | Out-Null New-Item -ItemType Directory -Force -Path $buildDir | Out-Null
+23 -37
View File
@@ -62,50 +62,33 @@ func buildWallpaperHTML(cfg *Config) string {
if cfg.HideWallpaper { if cfg.HideWallpaper {
bgWrapped = `<div id="bg-layer" style="display:none"></div>` bgWrapped = `<div id="bg-layer" style="display:none"></div>`
} }
html := strings.Replace(overlayHTML, "{{BACKGROUND}}", bgWrapped, 1)
html = strings.Replace(html, "{{LAYOUT}}", string(cfg.Layout), 1)
var bodyClasses []string initialData := map[string]interface{}{
if cfg.HideTime { "backgroundHtml": bgWrapped,
bodyClasses = append(bodyClasses, "hide-time") "layout": string(cfg.Layout),
} "showSeconds": cfg.ShowSeconds,
if cfg.HideWeather { "userZodiac": cfg.Zodiac,
bodyClasses = append(bodyClasses, "hide-weather") "wallpaperVisible": !cfg.HideWallpaper,
} "photoFrameMode": cfg.PhotoFrameMode && cfg.PhotoDir != "",
if cfg.HideZodiac { "cardVisibility": map[string]bool{
bodyClasses = append(bodyClasses, "hide-zodiac") "time": !cfg.HideTime,
} "weather": !cfg.HideWeather,
showSec := "false" "zodiac": !cfg.HideZodiac,
if cfg.ShowSeconds { "knowledge": !cfg.HideKnowledge,
showSec = "true" "ainews": !cfg.HideAINews,
} "photo": !cfg.HidePhoto,
html = strings.Replace(html, "{{SHOW_SECONDS}}", showSec, 1) },
if cfg.HideAINews {
bodyClasses = append(bodyClasses, "hide-ainews")
}
if cfg.HideKnowledge {
bodyClasses = append(bodyClasses, "hide-knowledge")
}
if cfg.HidePhoto {
bodyClasses = append(bodyClasses, "hide-photo")
}
if cfg.PhotoFrameMode && cfg.PhotoDir != "" {
bodyClasses = append(bodyClasses, "photo-frame-mode")
}
if len(bodyClasses) > 0 {
cls := strings.Join(bodyClasses, " ")
html = strings.Replace(html, "{{BODY_CLASSES}}", cls, 1)
} else {
html = strings.Replace(html, " {{BODY_CLASSES}}", "", 1)
} }
dataJSON, _ := json.Marshal(initialData)
inject := fmt.Sprintf(`<script>window.__INITIAL_DATA__=%s;</script>`, string(dataJSON))
// 注入自定义文字 // 注入自定义文字
if cfg.WallpaperType == WPTheme && cfg.Theme == ThemeText && cfg.WallpaperText != "" { if cfg.WallpaperType == WPTheme && cfg.Theme == ThemeText && cfg.WallpaperText != "" {
escaped, _ := json.Marshal(cfg.WallpaperText) escaped, _ := json.Marshal(cfg.WallpaperText)
html = strings.Replace(html, "</script>", `window.wallpaperText = `+string(escaped)+`;</script>`, 1) inject += fmt.Sprintf(`<script>window.wallpaperText=%s;</script>`, string(escaped))
} }
return html return strings.Replace(overlayHTML, "</head>", inject+"</head>", 1)
} }
func imageToDataURI(path string) string { func imageToDataURI(path string) string {
@@ -194,7 +177,10 @@ func updateBackground(cfg *Config) {
display = ` style="display:none"` display = ` style="display:none"`
} }
html := fmt.Sprintf(`<div id="bg-layer"%s>%s</div>`, display, bg) html := fmt.Sprintf(`<div id="bg-layer"%s>%s</div>`, display, bg)
evalJS(fmt.Sprintf(`var el=document.getElementById('bg-layer'); if(el){el.outerHTML=%q;}`, html)) // Update Vue reactive state via bridge
evalJS(fmt.Sprintf(`if(window.__updateBackgroundHtml) window.__updateBackgroundHtml(%q);`, html))
// Fallback: direct DOM update for non-Vue contexts
evalJS(fmt.Sprintf(`var el=document.getElementById('bg-layer'); if(el && !window.__updateBackgroundHtml){el.outerHTML=%q;}`, html))
} }
func reloadAllCards() { func reloadAllCards() {
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/overlay/index.ts"></script>
</body>
</html>
+2451
View File
File diff suppressed because it is too large. Load diff
+23
View File
@@ -0,0 +1,23 @@
{
"name": "u-desktop-web",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build --mode overlay && vite build --mode settings",
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.5.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.3",
"autoprefixer": "^10.4.21",
"postcss": "^8.5.3",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.3",
"vite": "^6.3.5",
"vite-plugin-singlefile": "^2.2.0"
}
}
+6
View File
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/settings/index.ts"></script>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
/// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
+59
View File
@@ -0,0 +1,59 @@
<template>
<div id="bg-mount" ref="bgMount"></div>
<template v-if="!state.photoFrameMode">
<SingleLayout v-if="state.layout === 'single'" />
<MultiLayout v-else />
</template>
<PhotoFrame />
<div id="author">绝尘</div>
</template>
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { state, loadInitialData } from './composables/useOverlayState'
import SingleLayout from './components/SingleLayout.vue'
import MultiLayout from './components/MultiLayout.vue'
import PhotoFrame from './components/PhotoFrame.vue'
import './overlay.css'
const bgMount = ref<HTMLElement>()
function mountBackground(html: string) {
const el = bgMount.value
if (!el) return
el.innerHTML = html
// v-html skips <script>; manually execute them
el.querySelectorAll('script').forEach(old => {
const ns = document.createElement('script')
if (old.src) ns.src = old.src
else ns.textContent = old.textContent
// copy attributes
for (const attr of old.attributes) {
ns.setAttribute(attr.name, attr.value)
}
old.parentNode?.replaceChild(ns, old)
})
}
onMounted(() => {
loadInitialData()
if (state.backgroundHtml && state.wallpaperVisible) {
mountBackground(state.backgroundHtml)
}
})
watch(() => state.backgroundHtml, (html) => {
if (state.wallpaperVisible) mountBackground(html)
})
watch(() => state.wallpaperVisible, (visible) => {
const el = bgMount.value
if (!el) return
if (visible && state.backgroundHtml) mountBackground(state.backgroundHtml)
else el.innerHTML = ''
})
</script>
+57
View File
@@ -0,0 +1,57 @@
import { state } from './composables/useOverlayState'
function parseArg(data: any) {
return typeof data === 'string' ? JSON.parse(data) : data
}
export function registerGoBridge() {
const w = window as any
w.updateHoroscopeFromGo = (data: any) => {
state.horoscope = parseArg(data)
}
w.updateAINewsFromGo = (items: any) => {
const parsed = parseArg(items)
if (parsed?.length) state.aiNews = parsed
}
w.updateKnowledgeFromGo = (data: any) => {
state.knowledge = parseArg(data)
}
w.updateWeatherFromGo = (data: any) => {
state.weather = parseArg(data)
}
w.updatePhotoFromGo = (data: any) => {
state.photo = parseArg(data)
}
w.setCardVisible = (card: string, visible: boolean) => {
if (card in state.cardVisibility) {
(state.cardVisibility as any)[card] = visible
}
}
w.setWallpaperVisible = (visible: boolean) => {
state.wallpaperVisible = visible
}
w.setPhotoFrameMode = (enabled: boolean) => {
state.photoFrameMode = enabled
}
w.setShowSeconds = (v: boolean) => {
state.showSeconds = v
}
Object.defineProperty(w, 'userZodiac', {
set(v: string) { state.userZodiac = v },
get() { return state.userZodiac },
})
w.__updateBackgroundHtml = (html: string) => {
state.backgroundHtml = html
}
}
@@ -0,0 +1,64 @@
<template>
<div>
<div class="ainews-header">🤖 AI 资讯</div>
<div class="ainews-item" v-for="(n, i) in state.aiNews.slice(0, 5)" :key="i">
<img v-if="safeImageURL(n.picUrl)"
class="ainews-img" :src="n.picUrl" loading="lazy"
@error="($event.target as HTMLImageElement).style.display='none'" />
<div class="ainews-body">
<div class="ainews-title-row">
<span class="ainews-title">{{ n.title }}</span>
<span class="ainews-source">{{ n.source }} · {{ formatTime(n.ctime) }}</span>
</div>
<div class="ainews-desc" v-if="n.description">{{ n.description }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { state } from '../composables/useOverlayState'
import { safeImageURL } from '@shared/utils'
function formatTime(t: string) {
return t?.length > 10 ? t.substring(5, 10) : t
}
</script>
<style scoped>
.ainews-header {
font-size: 11px; font-weight: 700;
color: var(--text-faint);
letter-spacing: 0; margin-bottom: 14px;
}
.ainews-item {
display: flex; gap: 14px;
margin-bottom: 12px; padding-bottom: 12px;
border-bottom: 1px solid var(--card-line-soft);
min-height: 58px;
}
.ainews-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.ainews-img {
width: 92px; height: 58px;
border-radius: 6px; object-fit: cover;
flex-shrink: 0; opacity: 0.92;
box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}
.ainews-body { flex: 1; min-width: 0; }
.ainews-title-row {
display: flex; align-items: baseline; gap: 10px;
}
.ainews-title {
font-size: 14px; font-weight: 650;
color: var(--text-main); line-height: 1.4;
white-space: nowrap; overflow: hidden;
text-overflow: ellipsis; flex: 1; min-width: 0;
}
.ainews-source { font-size: 10px; color: var(--text-faint); flex-shrink: 0; }
.ainews-desc {
font-size: 12px; color: var(--text-soft);
line-height: 1.5; margin-top: 5px;
display: -webkit-box; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; overflow: hidden;
}
</style>
@@ -0,0 +1,31 @@
<template>
<div>
<div class="knowledge-header">
💡 知识卡片
<span class="knowledge-keyword-tag" v-if="state.knowledge.keyword">#{{ state.knowledge.keyword }}</span>
</div>
<div class="knowledge-content">{{ state.knowledge.content || '请设置知识关键字' }}</div>
</div>
</template>
<script setup lang="ts">
import { state } from '../composables/useOverlayState'
</script>
<style scoped>
.knowledge-header {
font-size: 11px; color: var(--text-faint);
margin-bottom: 10px; display: flex;
align-items: center; gap: 6px;
letter-spacing: 0; font-weight: 700;
}
.knowledge-keyword-tag {
background: rgba(255,255,255,0.09);
padding: 3px 8px; border-radius: 6px;
font-size: 10px; color: var(--text-soft);
}
.knowledge-content {
font-size: 16px; color: var(--text-main);
line-height: 1.55; text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
</style>
@@ -0,0 +1,86 @@
<template>
<div id="layout-multi">
<div id="card-time" class="card" v-if="state.cardVisibility.time">
<TimeCard />
</div>
<div id="card-zodiac" class="card" v-if="state.cardVisibility.zodiac">
<ZodiacCard />
</div>
<div id="card-knowledge" class="card" v-if="state.cardVisibility.knowledge">
<KnowledgeCard />
</div>
<div id="card-ainews" class="card" v-if="state.cardVisibility.ainews">
<AINewsCard />
</div>
<div id="card-weather" class="card" v-if="state.cardVisibility.weather">
<WeatherCard />
</div>
<PhotoCard />
</div>
</template>
<script setup lang="ts">
import { state } from '../composables/useOverlayState'
import TimeCard from './TimeCard.vue'
import WeatherCard from './WeatherCard.vue'
import ZodiacCard from './ZodiacCard.vue'
import KnowledgeCard from './KnowledgeCard.vue'
import AINewsCard from './AINewsCard.vue'
import PhotoCard from './PhotoCard.vue'
</script>
<style scoped>
#layout-multi {
position: fixed;
inset: var(--layout-top) var(--layout-x) var(--layout-bottom);
z-index: 10;
display: grid;
grid-template-columns: minmax(420px, 1fr) minmax(360px, var(--knowledge-panel)) var(--right-panel);
grid-template-rows: var(--time-panel-h) var(--layout-gap) var(--zodiac-panel-h) minmax(32px, 1fr) auto;
grid-template-areas:
"photo knowledge time"
"photo knowledge ."
"photo knowledge zodiac"
". . ."
"news weather weather";
column-gap: var(--layout-col-gap);
row-gap: 0;
pointer-events: none;
}
#layout-multi > .card { pointer-events: none; }
#card-time {
grid-area: time; text-align: left;
width: 100%; height: 100%; padding: 22px 30px;
}
#card-zodiac {
grid-area: zodiac; width: 100%; height: 100%; padding: 22px 28px;
}
#card-knowledge {
grid-area: knowledge; align-self: stretch;
width: 100%; min-height: 0; padding: 22px 26px;
}
#card-ainews {
grid-area: news; align-self: end;
width: 100%; max-height: 390px;
}
#card-weather {
grid-area: weather; align-self: end;
width: 100%; min-width: 0; text-align: right;
padding: 22px 28px 24px;
}
#card-knowledge :deep(.knowledge-content) {
display: -webkit-box; -webkit-line-clamp: 8;
-webkit-box-orient: vertical; overflow: hidden;
}
#layout-multi :deep(#card-photo) {
grid-area: photo;
position: relative; top: auto; left: auto;
align-self: start;
width: 100%;
max-height: var(--photo-panel-h);
padding: 16px;
}
#layout-multi :deep(#card-photo img) {
max-height: calc(var(--photo-panel-h) - 32px);
}
</style>
@@ -0,0 +1,68 @@
<template>
<div id="card-photo" class="card" v-if="state.photo?.src">
<div class="photo-wrap">
<img :src="state.photo.src" alt="" @load="imgLoaded = true" :style="{ opacity: imgLoaded ? 1 : 0 }" />
<div class="photo-info">
<span class="photo-counter">{{ state.photo.counter }}</span>
<div class="photo-progress">
<div class="photo-progress-bar" ref="progressBar"></div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { state } from '../composables/useOverlayState'
const imgLoaded = ref(false)
const progressBar = ref<HTMLDivElement>()
watch(() => state.photo?.src, () => {
imgLoaded.value = false
if (!progressBar.value) return
const bar = progressBar.value
bar.style.transition = 'none'
bar.style.width = '0%'
requestAnimationFrame(() => {
requestAnimationFrame(() => {
const interval = state.photo?.interval || 15
bar.style.transition = `width ${interval}s linear`
bar.style.width = '100%'
})
})
})
</script>
<style scoped>
#card-photo {
padding: 16px;
}
.photo-wrap {
position: relative; border-radius: 8px; overflow: hidden;
}
img {
width: 100%; max-height: 450px;
object-fit: cover; display: block;
border-radius: 8px; transition: opacity 0.5s ease;
}
.photo-info {
position: absolute; bottom: 0; left: 0; right: 0;
padding: 20px 14px 10px;
background: linear-gradient(transparent, rgba(0,0,0,0.5));
}
.photo-counter {
font-size: 11px; opacity: 0.7;
display: block; margin-bottom: 6px;
}
.photo-progress {
height: 3px; background: rgba(255,255,255,0.15);
border-radius: 2px; overflow: hidden;
}
.photo-progress-bar {
height: 100%; width: 0%;
background: rgba(255,255,255,0.6);
border-radius: 2px;
}
</style>
@@ -0,0 +1,53 @@
<template>
<template v-if="state.photoFrameMode">
<img id="photo-frame-bg" :src="state.photo?.src" alt="" :style="{ opacity: visible ? 1 : 0 }" />
<img id="photo-frame-img" :src="state.photo?.src" alt="" :style="{ opacity: visible ? 1 : 0 }" />
<div class="photo-frame-clock">{{ timeStr }}</div>
<div class="photo-frame-date">{{ dateStr }}</div>
</template>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { state } from '../composables/useOverlayState'
import { useTime } from '../composables/useTime'
const { timeStr, dateStr } = useTime()
const visible = ref(false)
watch(() => state.photo?.src, () => {
if (!state.photoFrameMode || !state.photo?.src) return
visible.value = false
setTimeout(() => { visible.value = true }, 400)
})
</script>
<style scoped>
#photo-frame-bg, #photo-frame-img {
position: fixed; top: 0; left: 0;
width: 100%; height: 100%;
z-index: 5; object-fit: contain;
transition: opacity 0.8s ease;
}
#photo-frame-bg {
z-index: 4; object-fit: cover;
filter: blur(30px) brightness(0.5);
transform: scale(1.1);
}
.photo-frame-clock {
position: fixed; top: 28px; right: 36px; z-index: 10;
font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
font-size: 52px; font-weight: 200; letter-spacing: 2px;
color: #fff;
text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 0 40px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.9);
pointer-events: none; opacity: 0; transition: opacity 0.5s ease;
}
.photo-frame-date {
position: fixed; top: 86px; right: 38px; z-index: 10;
font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
font-size: 15px; font-weight: 400;
color: rgba(255,255,255,0.8);
text-shadow: 0 0 12px rgba(0,0,0,0.7), 0 1px 3px rgba(0,0,0,0.8);
pointer-events: none; opacity: 0; transition: opacity 0.5s ease;
}
</style>
@@ -0,0 +1,36 @@
<template>
<div id="layout-single">
<div id="info" class="card">
<TimeCard v-if="state.cardVisibility.time" />
<div class="divider"></div>
<AINewsCard v-if="state.cardVisibility.ainews" />
<div class="divider" v-if="state.cardVisibility.ainews"></div>
<KnowledgeCard v-if="state.cardVisibility.knowledge" />
<div class="divider" v-if="state.cardVisibility.knowledge"></div>
<WeatherCard v-if="state.cardVisibility.weather" />
<div class="divider" v-if="state.cardVisibility.weather"></div>
<ZodiacCard v-if="state.cardVisibility.zodiac" />
</div>
</div>
</template>
<script setup lang="ts">
import { state } from '../composables/useOverlayState'
import TimeCard from './TimeCard.vue'
import WeatherCard from './WeatherCard.vue'
import ZodiacCard from './ZodiacCard.vue'
import KnowledgeCard from './KnowledgeCard.vue'
import AINewsCard from './AINewsCard.vue'
</script>
<style scoped>
#layout-single { display: block; }
#info {
position: fixed;
top: 42px; right: 42px;
text-align: left;
width: min(760px, calc(50vw - 52px));
max-height: calc(100vh - 84px);
z-index: 10;
}
</style>
@@ -0,0 +1,60 @@
<template>
<div class="date" v-html="dateDisplay"></div>
<div class="time" :class="{ 'hourly-glow': glowing }">{{ timeStr }}</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, onUnmounted } from 'vue'
import { state } from '../composables/useOverlayState'
import { useTime } from '../composables/useTime'
const { timeStr, dateStr, holidayStr } = useTime()
const glowing = ref(false)
let glowTimer: number | null = null
const dateDisplay = computed(() => {
return holidayStr.value
? `${dateStr.value} <span style="opacity:0.5;font-size:12px">「${holidayStr.value}」</span>`
: dateStr.value
})
watch(timeStr, (val) => {
if (val.endsWith(':00:00') || val.endsWith(':00')) {
glowing.value = false
requestAnimationFrame(() => {
glowing.value = true
})
if (glowTimer) clearTimeout(glowTimer)
glowTimer = window.setTimeout(() => { glowing.value = false }, 6000)
}
})
onUnmounted(() => {
if (glowTimer) clearTimeout(glowTimer)
})
</script>
<style scoped>
.time {
font-size: 66px;
font-weight: 200;
text-shadow: 0 3px 28px rgba(0,0,0,0.42);
letter-spacing: 0;
line-height: 1;
font-variant-numeric: tabular-nums;
color: rgba(255,255,255,0.96);
}
.time.hourly-glow {
animation: hourlyGlow 6s ease-out forwards;
}
.date {
font-size: 13px;
color: var(--text-soft);
margin-bottom: 8px;
text-shadow: 0 1px 6px rgba(0,0,0,0.5);
letter-spacing: 0;
}
@media (max-width: 1500px) {
.time { font-size: 64px; }
}
</style>
@@ -0,0 +1,80 @@
<template>
<div class="current-weather" v-if="state.weather?.current">{{ state.weather.current }}</div>
<template v-if="state.weather?.hourly?.length">
<div class="forecast-title">24小时预报</div>
<div class="weather-forecast">
<div class="forecast-item" v-for="item in state.weather.hourly" :key="item.time">
<div class="forecast-time">{{ item.time }}</div>
<div class="forecast-icon">{{ item.icon }}</div>
<div class="forecast-temp">{{ item.temp }}</div>
<div class="forecast-pop" v-if="item.pop && item.pop !== '0'">{{ item.pop }}%</div>
</div>
</div>
</template>
<template v-if="state.weather?.daily?.length">
<div class="forecast-title" style="margin-top:12px">7日预报</div>
<div class="daily-forecast">
<div class="daily-item" v-for="item in state.weather.daily" :key="item.date">
<div style="opacity:0.6;font-size:10px">{{ item.date }}</div>
<div class="daily-icon">{{ item.icon }}</div>
<div class="forecast-temp">{{ item.tempMin }}°~{{ item.tempMax }}°</div>
</div>
</div>
</template>
</template>
<script setup lang="ts">
import { state } from '../composables/useOverlayState'
</script>
<style scoped>
.current-weather {
font-size: 17px; font-weight: 600;
color: var(--text-main);
text-shadow: 0 1px 4px rgba(0,0,0,0.5);
margin-bottom: 16px;
text-align: right;
}
.forecast-title {
font-size: 11px; font-weight: 600;
color: var(--text-faint);
letter-spacing: 0;
margin-bottom: 9px;
text-align: right;
}
.weather-forecast {
display: grid;
grid-template-columns: repeat(8, minmax(60px, 1fr));
gap: 7px; overflow: hidden;
}
.forecast-item {
background: rgba(255,255,255,0.055);
border-radius: 8px; padding: 9px 8px;
text-align: center; min-width: 0;
font-size: 12px; color: var(--text-main);
border: 1px solid var(--card-line-soft);
}
.forecast-icon { font-size: 22px; margin: 5px 0; }
.forecast-time { color: var(--text-faint); font-size: 10px; }
.forecast-temp { font-weight: 700; margin-top: 2px; font-size: 14px; }
.forecast-pop { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.daily-forecast {
display: grid;
grid-template-columns: repeat(7, minmax(64px, 1fr));
gap: 7px; overflow: hidden;
}
.daily-item {
background: rgba(255,255,255,0.04);
border-radius: 8px; padding: 9px 8px;
text-align: center; min-width: 0;
font-size: 12px; color: var(--text-main);
border: 1px solid var(--card-line-soft);
}
.daily-icon { font-size: 22px; margin: 5px 0; }
.weather-forecast::-webkit-scrollbar,
.daily-forecast::-webkit-scrollbar { display: none; }
@media (max-width: 1500px) {
.weather-forecast { grid-template-columns: repeat(4, 1fr); }
.daily-forecast { grid-template-columns: repeat(4, 1fr); }
}
</style>
@@ -0,0 +1,81 @@
<template>
<div class="zodiac-text">
<div class="zodiac-title">{{ info.icon }} {{ state.userZodiac }}运势</div>
<div class="zodiac-date">{{ info.date }}</div>
<template v-if="data">
<div class="zodiac-bar" v-for="bar in bars" :key="bar.label">
<span class="zodiac-bar-label">{{ bar.label }}</span>
<div class="zodiac-bar-track">
<div class="zodiac-bar-fill" :style="{ width: bar.val + '%', background: bar.color }"></div>
</div>
<span class="zodiac-bar-val">{{ bar.val }}%</span>
</div>
<div class="zodiac-tags" v-if="hasTags">
<span class="zodiac-tag" v-if="data.luckyColor">🎨 {{ data.luckyColor }}</span>
<span class="zodiac-tag" v-if="data.luckyNum">🔢 {{ data.luckyNum }}</span>
<span class="zodiac-tag" v-if="data.noble">⭐ {{ data.noble }}</span>
</div>
<div class="zodiac-summary" v-if="data.summary">{{ data.summary }}</div>
</template>
<div v-else style="opacity:0.4;font-size:12px;margin-top:8px">运势加载中...</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { state } from '../composables/useOverlayState'
import { useHoroscope, zodiacMap, barColors } from '../composables/useHoroscope'
const { zodiacInfo: info, data } = useHoroscope()
const bars = computed(() => {
if (!data.value) return []
return [
{ label: '综合', val: parseInt(data.value.all) || 0, color: barColors.all },
{ label: '爱情', val: parseInt(data.value.love) || 0, color: barColors.love },
{ label: '工作', val: parseInt(data.value.work) || 0, color: barColors.work },
{ label: '财运', val: parseInt(data.value.money) || 0, color: barColors.money },
{ label: '健康', val: parseInt(data.value.health) || 0, color: barColors.health },
]
})
const hasTags = computed(() => data.value?.luckyColor || data.value?.luckyNum || data.value?.noble)
</script>
<style scoped>
.zodiac-text {
font-size: 14px; color: var(--text-main);
line-height: 1.6; text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.zodiac-title { font-size: 16px; font-weight: 650; margin-bottom: 3px; }
.zodiac-date { font-size: 11px; color: var(--text-faint); margin-bottom: 12px; }
.zodiac-bar {
display: flex; align-items: center; gap: 10px;
margin-bottom: 7px; font-size: 12px;
}
.zodiac-bar-label { width: 28px; color: var(--text-soft); flex-shrink: 0; }
.zodiac-bar-track {
flex: 1; height: 5px;
background: rgba(255,255,255,0.10);
border-radius: 999px; overflow: hidden;
}
.zodiac-bar-fill {
height: 100%; border-radius: 999px;
transition: width 0.6s ease;
}
.zodiac-bar-val {
width: 30px; text-align: right; font-size: 11px;
color: var(--text-soft); flex-shrink: 0;
}
.zodiac-tags { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0 9px; }
.zodiac-tag {
font-size: 10px; background: rgba(255,255,255,0.08);
padding: 4px 8px; border-radius: 6px;
color: var(--text-soft); border: 1px solid rgba(255,255,255,0.05);
}
.zodiac-summary {
font-size: 12px; color: var(--text-soft); line-height: 1.65;
display: -webkit-box; -webkit-line-clamp: 3;
-webkit-box-orient: vertical; overflow: hidden;
}
</style>
@@ -0,0 +1,28 @@
import { computed } from 'vue'
import { state } from './useOverlayState'
export const zodiacMap: Record<string, { icon: string; date: string }> = {
'白羊座': { icon: '♈', date: '3.21-4.19' },
'金牛座': { icon: '♉', date: '4.20-5.20' },
'双子座': { icon: '♊', date: '5.21-6.21' },
'巨蟹座': { icon: '♋', date: '6.22-7.22' },
'狮子座': { icon: '♌', date: '7.23-8.22' },
'处女座': { icon: '♍', date: '8.23-9.22' },
'天秤座': { icon: '♎', date: '9.23-10.23' },
'天蝎座': { icon: '♏', date: '10.24-11.22' },
'射手座': { icon: '♐', date: '11.23-12.21' },
'摩羯座': { icon: '♑', date: '12.22-1.19' },
'水瓶座': { icon: '♒', date: '1.20-2.18' },
'双鱼座': { icon: '♓', date: '2.19-3.20' },
}
export const barColors: Record<string, string> = {
all: '#e0e0e0', love: '#ff6b9d', work: '#4fc3f7', money: '#ffd54f', health: '#81c784',
}
export function useHoroscope() {
const zodiacInfo = computed(() => zodiacMap[state.userZodiac] || { icon: '✨', date: '' })
const data = computed(() => state.horoscope)
return { zodiacInfo, data }
}
@@ -0,0 +1,36 @@
import { reactive } from 'vue'
import type { WeatherData, HoroscopeData, AINewsItem, KnowledgeData, PhotoData, CardVisibility } from '@shared/types'
export const state = reactive({
layout: 'single' as 'single' | 'multi',
showSeconds: true,
userZodiac: '射手座',
wallpaperVisible: true,
photoFrameMode: false,
cardVisibility: {
time: true,
weather: true,
zodiac: true,
knowledge: true,
ainews: true,
photo: true,
} as CardVisibility,
backgroundHtml: '',
weather: null as WeatherData | null,
horoscope: null as HoroscopeData | null,
aiNews: [] as AINewsItem[],
knowledge: { content: '', keyword: '' } as KnowledgeData,
photo: null as PhotoData | null,
})
export function loadInitialData() {
const d = (window as any).__INITIAL_DATA__
if (!d) return
if (d.layout) state.layout = d.layout
if (d.showSeconds !== undefined) state.showSeconds = d.showSeconds
if (d.userZodiac) state.userZodiac = d.userZodiac
if (d.wallpaperVisible !== undefined) state.wallpaperVisible = d.wallpaperVisible
if (d.photoFrameMode !== undefined) state.photoFrameMode = d.photoFrameMode
if (d.cardVisibility) Object.assign(state.cardVisibility, d.cardVisibility)
if (d.backgroundHtml) state.backgroundHtml = d.backgroundHtml
}
+77
View File
@@ -0,0 +1,77 @@
import { ref, onMounted, onUnmounted } from 'vue'
import { state } from './useOverlayState'
export function useTime() {
const timeStr = ref('00:00')
const dateStr = ref('1月1日 周一')
const holidayStr = ref('')
let timer: number | null = null
let lastTime = ''
let lastDate = ''
const holidays = [
{ m: 1, d: 1, name: '元旦' },
{ m: 2, d: 14, name: '情人节' },
{ m: 3, d: 8, name: '妇女节' },
{ m: 4, d: 5, name: '清明节' },
{ m: 5, d: 1, name: '劳动节' },
{ m: 5, d: 4, name: '青年节' },
{ m: 6, d: 1, name: '儿童节' },
{ m: 7, d: 1, name: '建党节' },
{ m: 8, d: 1, name: '建军节' },
{ m: 9, d: 10, name: '教师节' },
{ m: 10, d: 1, name: '国庆节' },
{ m: 10, d: 31, name: '万圣节' },
{ m: 12, d: 25, name: '圣诞节' },
]
function getNextHoliday(now: Date) {
const y = now.getFullYear()
const results: { diff: number; name: string }[] = []
for (const h of holidays) {
const target = new Date(y, h.m - 1, h.d)
let diff = Math.ceil((target.getTime() - now.getTime()) / 86400000)
if (diff > 0 && diff <= 60) results.push({ diff, name: h.name })
if (diff < 0) {
const next = new Date(y + 1, h.m - 1, h.d)
diff = Math.ceil((next.getTime() - now.getTime()) / 86400000)
if (diff > 0 && diff <= 60) results.push({ diff, name: h.name })
}
}
results.sort((a, b) => a.diff - b.diff)
return results.length > 0 ? `距${results[0].name}还有${results[0].diff}天` : ''
}
function update() {
const now = new Date()
const hh = String(now.getHours()).padStart(2, '0')
const mm = String(now.getMinutes()).padStart(2, '0')
const ss = String(now.getSeconds()).padStart(2, '0')
const t = state.showSeconds ? `${hh}:${mm}:${ss}` : `${hh}:${mm}`
const month = now.getMonth() + 1
const day = now.getDate()
const week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][now.getDay()]
const d = `${month}月${day}日 ${week}`
if (t !== lastTime) {
timeStr.value = t
lastTime = t
}
if (d !== lastDate) {
const h = getNextHoliday(now)
dateStr.value = d
holidayStr.value = h
lastDate = d
}
}
onMounted(() => {
update()
timer = window.setInterval(update, 1000)
})
onUnmounted(() => {
if (timer) clearInterval(timer)
})
return { timeStr, dateStr, holidayStr }
}
+7
View File
@@ -0,0 +1,7 @@
import { createApp } from 'vue'
import App from './App.vue'
import '../tailwind.css'
import { registerGoBridge } from './bridge'
registerGoBridge()
createApp(App).mount('#app')
+86
View File
@@ -0,0 +1,86 @@
* { margin: 0; padding: 0; }
html, body {
width: 100%; height: 100%;
overflow: hidden;
background: #000;
font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
color: #fff;
font-variant-numeric: tabular-nums;
}
:root {
--card-bg: rgba(22, 19, 28, 0.56);
--card-bg-strong: rgba(24, 20, 30, 0.68);
--card-line: rgba(255,255,255,0.10);
--card-line-soft: rgba(255,255,255,0.06);
--text-main: rgba(255,255,255,0.92);
--text-soft: rgba(255,255,255,0.66);
--text-faint: rgba(255,255,255,0.42);
--accent-warm: #ffd86b;
--accent-cool: #6bdcff;
--shadow-card: 0 18px 60px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.10);
--layout-x: 48px;
--layout-top: 38px;
--layout-bottom: 72px;
--layout-gap: 18px;
--layout-col-gap: 24px;
--right-panel: 400px;
--knowledge-panel: 460px;
--time-panel-h: 154px;
--zodiac-panel-h: 326px;
--photo-panel-h: 360px;
}
.card {
position: relative;
box-sizing: border-box;
overflow: hidden;
background: linear-gradient(145deg, rgba(255,255,255,0.075), rgba(255,255,255,0.025)), var(--card-bg);
backdrop-filter: blur(28px) saturate(1.2);
-webkit-backdrop-filter: blur(28px) saturate(1.2);
border: 1px solid var(--card-line);
border-radius: 8px;
padding: 22px 24px;
box-shadow: var(--shadow-card);
}
.card::before {
content: "";
position: absolute; inset: 0;
pointer-events: none;
border-radius: inherit;
background:
linear-gradient(90deg, rgba(255,255,255,0.13), transparent 34%),
radial-gradient(circle at 12% 0%, rgba(255,216,107,0.13), transparent 38%);
opacity: 0.55;
}
.card > * { position: relative; }
.divider {
height: 1px;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
margin: 18px 0;
}
@keyframes hourlyGlow {
0% { text-shadow: 0 0 30px rgba(255,255,255,1), 0 0 80px rgba(180,200,255,0.8), 0 0 120px rgba(100,150,255,0.5); color: #fff; }
8% { text-shadow: 0 0 50px rgba(255,255,255,1), 0 0 100px rgba(180,200,255,1), 0 0 160px rgba(100,150,255,0.6); }
18% { text-shadow: 0 0 20px rgba(255,255,255,0.6), 0 0 40px rgba(180,200,255,0.3); }
28% { text-shadow: 0 0 35px rgba(255,255,255,0.85), 0 0 70px rgba(180,200,255,0.6), 0 0 100px rgba(100,150,255,0.35); }
38% { text-shadow: 0 0 15px rgba(255,255,255,0.4), 0 0 30px rgba(180,200,255,0.2); }
48% { text-shadow: 0 0 25px rgba(255,255,255,0.6), 0 0 50px rgba(180,200,255,0.4); }
60% { text-shadow: 0 0 10px rgba(255,255,255,0.25), 0 0 20px rgba(180,200,255,0.12); }
75% { text-shadow: 0 0 15px rgba(255,255,255,0.35), 0 0 30px rgba(180,200,255,0.2); }
100% { text-shadow: 0 2px 20px rgba(0,0,0,0.5); color: #fff; }
}
@media (max-width: 1500px) {
:root {
--layout-x: 32px;
--layout-col-gap: 18px;
--right-panel: 360px;
--knowledge-panel: 380px;
--time-panel-h: 144px;
--zodiac-panel-h: 312px;
--photo-panel-h: 320px;
}
}
+89
View File
@@ -0,0 +1,89 @@
<template>
<div class="p-4 select-none overflow-y-auto">
<div class="mb-3.5">
<h1 class="text-base font-semibold text-[var(--text-strong)]">桌面设置</h1>
<p class="text-[11px] text-[var(--text-weak)] mt-0.5">壁纸 · 布局 · 信息显示</p>
</div>
<ToggleSection :s="s" />
<WallpaperSection :s="s" @set-wp-type="setWpType" :current-color="currentColor" @pick-solid="onPickSolid" @pick-gradient="onPickGradient" @save-color="onSaveColor" @apply-color="onApplySavedColor" @remove-color="onRemoveSavedColor" />
<LayoutSection :s="s" />
<PhotoSection :s="s" />
<PersonalizeSection :s="s" />
<div class="text-center text-[11px] text-[var(--footer-color)] mt-3 py-1.5 tracking-wide">u-desktop v1.0</div>
</div>
</template>
<script setup lang="ts">
import { reactive, ref, onMounted } from 'vue'
import { go } from './composables/useGoBridge'
import ToggleSection from './components/ToggleSection.vue'
import WallpaperSection from './components/WallpaperSection.vue'
import LayoutSection from './components/LayoutSection.vue'
import PhotoSection from './components/PhotoSection.vue'
import PersonalizeSection from './components/PersonalizeSection.vue'
import type { SettingsData } from '@shared/types'
const initDone = ref(false)
const s = reactive<SettingsData>({
lightTheme: false, wallpaper: true, time: true, weather: true,
zodiacCard: true, knowledgeCard: true, layout: 'single', zodiac: '射手座',
city: '', provinces: [], citiesByProv: {}, wallpaperType: 'theme', theme: '',
themes: [], color1: '', color2: '', colorGradient: false, savedColors: [],
bingAutoRefresh: false, knowledgeKeyword: '', knowledgePrompt: '',
wallpaperText: '', imagePath: '', showSeconds: true, ainewsCard: true,
photoDir: '', photoInterval: 15, photoCard: true, photoFrameMode: false, autoStart: false,
})
// Shared state for color section
const currentColor = reactive({ c1: '', c2: '', gradient: false })
function setWpType(type: string) {
const prev = s.wallpaperType
s.wallpaperType = type
if (!initDone.value) return
if (type === 'theme') go.saveWallpaperType('theme', s.theme)
else if (type === 'bing' && prev !== 'bing') go.enableBing()
}
async function onPickSolid() {
const c = await go.pickSolidColor()
if (c) { currentColor.c1 = c; currentColor.c2 = ''; currentColor.gradient = false }
}
async function onPickGradient() {
const res = await go.pickGradientColor()
if (res) {
const parts = res.split(',')
currentColor.c1 = parts[0]; currentColor.c2 = parts[1] || ''; currentColor.gradient = true
}
}
function onSaveColor() {
if (!currentColor.c1) return
go.addSavedColor(currentColor.c1, currentColor.c2, currentColor.gradient)
s.savedColors.push({ color1: currentColor.c1, color2: currentColor.c2, gradient: currentColor.gradient })
}
function onApplySavedColor(idx: number) {
go.applySavedColor(idx)
const sc = s.savedColors[idx]
currentColor.c1 = sc.color1; currentColor.c2 = sc.color2; currentColor.gradient = sc.gradient
}
async function onRemoveSavedColor(idx: number) {
await go.removeSavedColor(idx)
s.savedColors.splice(idx, 1)
}
onMounted(async () => {
const raw = await go.loadAllSettings()
const data = JSON.parse(raw) as SettingsData
if (data.lightTheme) document.documentElement.className = 'light'
Object.assign(s, { ...data, citiesByProv: data.citiesByProv || {}, provinces: data.provinces || [], themes: data.themes || [], savedColors: data.savedColors || [] })
if (data.color1) { currentColor.c1 = data.color1; currentColor.c2 = data.color2 || ''; currentColor.gradient = data.colorGradient || false }
setTimeout(() => {
const el = document.documentElement
if (go.resizeToFit) go.resizeToFit(el.scrollWidth, el.scrollHeight + 8)
}, 100)
initDone.value = true
})
</script>
@@ -0,0 +1,21 @@
<template>
<div class="mb-3">
<div class="text-[10px] font-semibold text-[var(--text-weak)] uppercase tracking-[1.5px] mb-1 pl-0.5">布局</div>
<div class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-xs font-medium text-[var(--text-muted)]">信息布局</div>
<select v-model="s.layout" @change="go.saveLayout(s.layout)"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-0.5 px-1.5 outline-none min-w-[80px] max-w-[160px] focus:border-[var(--input-border-focus)]">
<option value="single">合并卡片</option>
<option value="multi">独立卡片</option>
</select>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { go } from '../composables/useGoBridge'
import type { SettingsData } from '@shared/types'
defineProps<{ s: SettingsData }>()
</script>
@@ -0,0 +1,111 @@
<template>
<div class="mb-3">
<div class="text-[10px] font-semibold text-[var(--text-weak)] uppercase tracking-[1.5px] mb-1 pl-0.5">个性化</div>
<div class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-xs font-medium text-[var(--text-muted)]">我的星座</div>
<select v-model="s.zodiac" @change="go.saveZodiac(s.zodiac)"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-0.5 px-1.5 outline-none min-w-[80px] max-w-[160px] focus:border-[var(--input-border-focus)]">
<option v-for="z in zodiacs" :key="z" :value="z">{{ z }}</option>
</select>
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div><div class="text-xs font-medium text-[var(--text-muted)]">知识关键字</div><div class="text-[10px] text-[var(--text-weak)] mt-px">AI 将根据关键字生成知识小卡片</div></div>
<input type="text" v-model="s.knowledgeKeyword" @input="debounced(go.saveKnowledgeKeyword, s.knowledgeKeyword)"
placeholder="如: 历史、科学、冷知识"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-1 px-2 outline-none w-[140px] focus:border-[var(--input-border-focus)]">
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div><div class="text-xs font-medium text-[var(--text-muted)]">知识提示词</div><div class="text-[10px] text-[var(--text-weak)] mt-px">补充风格或方向,系统会保证内容密度</div></div>
<input type="text" v-model="s.knowledgePrompt" @input="debounced(go.saveKnowledgePrompt, s.knowledgePrompt)"
placeholder="如: 偏实践、给出判断标准"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-1 px-2 outline-none w-[140px] focus:border-[var(--input-border-focus)]">
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)] relative">
<div class="text-xs font-medium text-[var(--text-muted)]">天气城市</div>
<div class="city-picker" :class="{ open: cityOpen }" tabindex="0" @click="cityOpen = !cityOpen">
<span class="text-[var(--text)] text-[11px]">{{ cityDisplay }}</span>
<span class="absolute right-1.5 top-1/2 -translate-y-1/2 text-[var(--text-weak)] text-[10px] pointer-events-none">▾</span>
<div class="city-panel">
<div class="city-col">
<div v-for="p in s.provinces" :key="p" :class="{ active: p === activeProv }" @click.stop="activeProv = p">{{ p }}</div>
</div>
<div class="city-col">
<div v-for="c in currentCities" :key="c.id" :class="{ active: c.id === s.city }" @click.stop="onCitySelect(c)">{{ c.name }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { go } from '../composables/useGoBridge'
import { debounced } from '../composables/useDebounce'
import type { SettingsData } from '@shared/types'
const props = defineProps<{ s: SettingsData }>()
const zodiacs = ['白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座','天蝎座','射手座','摩羯座','水瓶座','双鱼座']
const cityOpen = ref(false)
const activeProv = ref('')
const selectedCityName = ref('')
const currentCities = computed(() => {
if (!activeProv.value) return []
return (props.s.citiesByProv as any)[activeProv.value] || []
})
const cityDisplay = computed(() => {
if (activeProv.value && selectedCityName.value) return `${activeProv.value} · ${selectedCityName.value}`
return '未选择'
})
function onCitySelect(c: { id: string; name: string }) {
props.s.city = c.id
selectedCityName.value = c.name
cityOpen.value = false
go.saveCity(c.id)
}
function onDocClick(e: MouseEvent) {
const picker = document.querySelector('.city-picker')
if (picker && !picker.contains(e.target as Node)) cityOpen.value = false
}
onMounted(() => {
document.addEventListener('click', onDocClick)
// Find initial city
for (const p of Object.keys(props.s.citiesByProv)) {
for (const c of (props.s.citiesByProv as any)[p]) {
if (c.id === props.s.city) { activeProv.value = p; selectedCityName.value = c.name; break }
}
if (activeProv.value) break
}
})
onUnmounted(() => document.removeEventListener('click', onDocClick))
</script>
<style scoped>
.city-picker {
position: relative; background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; padding: 4px 24px 4px 8px; cursor: pointer;
font-size: 11px; min-width: 140px; max-width: 180px;
}
.city-picker:focus, .city-picker.open { border-color: var(--input-border-focus); }
.city-panel {
display: none; position: absolute; right: -1px; bottom: calc(100% + 4px);
background: var(--option-bg); border: 1px solid var(--input-border);
border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
z-index: 1000; width: 260px; height: 200px; overflow: hidden;
}
.city-picker.open .city-panel { display: flex; }
.city-col { flex: 1; overflow-y: auto; border-right: 1px solid var(--card-divider); }
.city-col:last-child { border-right: none; }
.city-col div {
padding: 5px 10px; font-size: 11px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.city-col div:hover { background: var(--input-bg); }
.city-col div.active { color: var(--accent); font-weight: 600; }
</style>
@@ -0,0 +1,61 @@
<template>
<div class="mb-3">
<div class="text-[10px] font-semibold text-[var(--text-weak)] uppercase tracking-[1.5px] mb-1 pl-0.5">相册</div>
<div class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg">
<div class="flex justify-between items-center px-3.5 py-2">
<div><div class="text-xs font-medium text-[var(--text-muted)]">相册展示</div></div>
<ToggleSwitch v-model="s.photoCard" />
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div><div class="text-xs font-medium text-[var(--text-muted)]">电子相册模式</div><div class="text-[10px] text-[var(--text-weak)] mt-px">照片铺满整个壁纸</div></div>
<ToggleSwitch v-model="s.photoFrameMode" />
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div class="text-[10px] text-[var(--text-weak)]">{{ s.photoDir || '未选择目录' }}</div>
<div class="flex gap-1">
<button class="btn" @click="onPickDir">选择目录</button>
<button v-if="s.photoDir" class="btn-sm" @click="onClearDir">清除</button>
</div>
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div class="text-xs font-medium text-[var(--text-muted)]">切换间隔</div>
<select v-model="s.photoInterval" @change="go.savePhotoInterval(Number(s.photoInterval))"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-0.5 px-1.5 outline-none min-w-[80px] max-w-[160px] focus:border-[var(--input-border-focus)]">
<option v-for="v in [5,10,15,20,30,60]" :key="v" :value="v">{{ v }} 秒</option>
</select>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { go } from '../composables/useGoBridge'
import ToggleSwitch from './ToggleSwitch.vue'
import type { SettingsData } from '@shared/types'
const props = defineProps<{ s: SettingsData }>()
async function onPickDir() {
const dir = await go.pickPhotoDir()
if (dir) props.s.photoDir = dir
}
async function onClearDir() {
await go.clearPhotoDir()
props.s.photoDir = ''
}
</script>
<style scoped>
.btn {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 10px;
font-family: inherit; cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--card-border); }
.btn-sm {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 10px; padding: 3px 8px;
font-family: inherit; cursor: pointer; white-space: nowrap;
}
.btn-sm:hover { background: var(--card-border); }
</style>
@@ -0,0 +1,47 @@
<template>
<div class="mb-3">
<div class="text-[10px] font-semibold text-[var(--text-weak)] uppercase tracking-[1.5px] mb-1 pl-0.5">显示控制</div>
<div class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg">
<div v-for="t in toggles" :key="t.key"
class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)] first:border-t-0"
:class="{ 'pl-8': t.sub }">
<div>
<div class="text-xs font-medium text-[var(--text-muted)]">{{ t.label }}</div>
<div v-if="t.desc" class="text-[10px] text-[var(--text-weak)] mt-px">{{ t.desc }}</div>
</div>
<ToggleSwitch v-model="(s as any)[t.key]" />
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { watch } from 'vue'
import ToggleSwitch from './ToggleSwitch.vue'
import { go } from '../composables/useGoBridge'
import type { SettingsData } from '@shared/types'
const props = defineProps<{ s: SettingsData }>()
const toggles: { key: keyof SettingsData; label: string; desc?: string; sub?: boolean }[] = [
{ key: 'autoStart', label: '开机启动', desc: '系统启动时自动运行' },
{ key: 'wallpaper', label: '显示壁纸' },
{ key: 'time', label: '时间日期' },
{ key: 'showSeconds', label: '显示秒', sub: true },
{ key: 'weather', label: '天气信息' },
{ key: 'zodiacCard', label: '星座运势' },
{ key: 'knowledgeCard', label: '知识卡片' },
{ key: 'ainewsCard', label: 'AI 资讯' },
]
const toggleKeys = toggles.map(t => t.key)
watch(
() => toggleKeys.map(k => (props.s as any)[k]),
() => {
const data: Record<string, boolean> = {}
for (const k of toggleKeys) data[k] = (props.s as any)[k]
go.saveToggles(data)
}
)
</script>
@@ -0,0 +1,28 @@
<template>
<label class="switch">
<input type="checkbox" :checked="modelValue" @change="$emit('update:modelValue', ($event.target as HTMLInputElement).checked)">
<span class="track"><span class="thumb"></span></span>
</label>
</template>
<script setup lang="ts">
defineProps<{ modelValue: boolean }>()
defineEmits<{ 'update:modelValue': [value: boolean] }>()
</script>
<style scoped>
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.switch .track {
position: absolute; inset: 0;
background: var(--toggle-track);
border-radius: 10px; cursor: pointer; transition: background 0.2s;
}
.switch .thumb {
position: absolute; width: 14px; height: 14px; top: 3px; left: 3px;
background: var(--toggle-thumb);
border-radius: 50%; transition: all 0.2s; pointer-events: none;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: var(--text-strong); }
</style>
@@ -0,0 +1,198 @@
<template>
<div class="mb-3">
<div class="text-[10px] font-semibold text-[var(--text-weak)] uppercase tracking-[1.5px] mb-1 pl-0.5">壁纸</div>
<div class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg">
<!-- 类型选择 -->
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-xs font-medium text-[var(--text-muted)]">类型选择</div>
<div class="flex gap-1">
<button v-for="t in wpTypes" :key="t.value" @click="$emit('set-wp-type', t.value)"
:class="s.wallpaperType === t.value
? 'bg-[var(--accent)] border-[var(--accent)] text-[var(--text-strong)]'
: 'bg-[var(--input-bg)] border-[var(--input-border)] text-[var(--text)] hover:bg-[var(--card-border)]'"
class="border rounded-md text-[11px] py-1 px-2.5 font-[inherit] cursor-pointer whitespace-nowrap transition-colors">{{ t.label }}</button>
</div>
</div>
</div>
<!-- 主题 -->
<div v-if="s.wallpaperType === 'theme'" class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg mt-1.5">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-xs font-medium text-[var(--text-muted)]">选择主题</div>
<select v-model="s.theme" @change="go.saveWallpaperType('theme', s.theme)"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-0.5 px-1.5 outline-none min-w-[80px] max-w-[160px] focus:border-[var(--input-border-focus)]">
<option v-for="t in s.themes" :key="t.value" :value="t.value">{{ t.label }}</option>
</select>
</div>
<div v-if="s.theme === 'text'" class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div class="text-xs font-medium text-[var(--text-muted)]">自定义文字</div>
<input type="text" v-model="s.wallpaperText" @input="debounced(go.saveWallpaperText, s.wallpaperText)"
placeholder="输入显示文字"
class="bg-[var(--input-bg)] border border-[var(--input-border)] rounded-md text-[var(--text)] text-[11px] py-1 px-2 outline-none w-[140px] focus:border-[var(--input-border-focus)]">
</div>
</div>
<!-- 本地图片 -->
<div v-if="s.wallpaperType === 'image'" class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg mt-1.5">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-[10px] text-[var(--text-weak)] truncate mr-2">{{ s.imagePath || '未选择图片' }}</div>
<button class="btn" @click="onPickImage">选择图片</button>
</div>
</div>
<!-- Bing -->
<div v-if="s.wallpaperType === 'bing'" class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg mt-1.5">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="flex items-center gap-2 min-w-0">
<img v-if="bing.url" :src="bingThumb" class="w-16 h-10 object-cover rounded flex-shrink-0">
<div class="min-w-0">
<div class="text-xs font-medium text-[var(--text-muted)] truncate">{{ bing.copyright || 'Bing 每日壁纸' }}</div>
<div class="text-[10px] text-[var(--text-weak)]">{{ bing.idx > 0 ? `${bing.idx} / ${bing.total}` : '' }}</div>
</div>
</div>
<div class="flex gap-1 flex-shrink-0">
<button class="btn-sm" @click="onBingPrev">&#9664;</button>
<button class="btn-sm" @click="onBingNext">&#9654;</button>
<button class="btn-sm" @click="onBingFav">{{ bing.fav ? '★' : '☆' }}</button>
</div>
</div>
<div class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div><div class="text-xs font-medium text-[var(--text-muted)]">定时切换</div><div class="text-[10px] text-[var(--text-weak)] mt-px">每小时自动切换壁纸</div></div>
<ToggleSwitch v-model="s.bingAutoRefresh" />
</div>
<!-- 收藏列表 -->
<div v-if="bingFavs.length" class="px-3.5 py-2 border-t border-[var(--card-divider)]">
<div class="text-[10px] text-[var(--text-weak)] mb-1.5">收藏列表</div>
<div class="grid grid-cols-4 gap-1.5">
<div v-for="(f, i) in bingFavs" :key="i" class="cursor-pointer rounded overflow-hidden hover:opacity-80" @click="onBingSetByIdx(f.idx)">
<img :src="f.thumb" class="w-full h-10 object-cover rounded">
</div>
</div>
</div>
</div>
<!-- 纯色/渐变 -->
<div v-if="s.wallpaperType === 'color'" class="bg-[var(--card-bg)] border border-[var(--card-border)] rounded-lg mt-1.5">
<div class="flex justify-between items-center px-3.5 py-2">
<div class="text-xs font-medium text-[var(--text-muted)]">选择颜色</div>
<div class="flex gap-1">
<button class="btn" @click="$emit('pick-solid')">纯色</button>
<button class="btn" @click="$emit('pick-gradient')">渐变</button>
</div>
</div>
<div v-if="currentColor.c1" class="flex justify-between items-center px-3.5 py-2 border-t border-[var(--card-divider)]">
<div class="flex items-center gap-1.5">
<span class="inline-block w-6 h-4 rounded-sm border border-[var(--input-border)]" :style="swatchStyle"></span>
<span class="text-[10px] text-[var(--text-weak)]">当前颜色</span>
</div>
<button class="btn" @click="$emit('save-color')">收藏</button>
</div>
</div>
<!-- 已收藏颜色 -->
<div v-if="s.savedColors.length && s.wallpaperType === 'color'" class="flex flex-wrap gap-1.5 mt-1.5 px-0.5">
<div v-for="(c, i) in s.savedColors" :key="i" class="color-swatch" :style="swatchOf(c)"
@click="$emit('apply-color', i)" @contextmenu.prevent="$emit('remove-color', i)">
<span class="del">&times;</span>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { go } from '../composables/useGoBridge'
import { debounced } from '../composables/useDebounce'
import ToggleSwitch from './ToggleSwitch.vue'
import type { SettingsData, BingState } from '@shared/types'
const props = defineProps<{
s: SettingsData
currentColor: { c1: string; c2: string; gradient: boolean }
}>()
defineEmits<{
'set-wp-type': [type: string]
'pick-solid': []
'pick-gradient': []
'save-color': []
'apply-color': [idx: number]
'remove-color': [idx: number]
}>()
const wpTypes = [
{ value: 'theme', label: '主题' },
{ value: 'image', label: '本地图片' },
{ value: 'bing', label: 'Bing' },
{ value: 'color', label: '纯色/渐变' },
]
// Bing
const bing = ref<BingState>({ date: '', title: '', copyright: '', url: '', fav: false, idx: 0, total: 0 })
const bingThumb = ref('')
const bingFavs = ref<{ idx: number; thumb: string }[]>([])
async function loadBingInfo() {
const raw = await go.getBingInfo()
const st = JSON.parse(raw) as BingState
bing.value = st
if (st.url) bingThumb.value = st.url.replace('_1920x1080', '_400x240')
}
async function onBingPrev() { bing.value = JSON.parse(await go.bingPrev()) }
async function onBingNext() { bing.value = JSON.parse(await go.bingNext()) }
async function onBingFav() { bing.value = JSON.parse(await go.bingToggleFavorite()); await loadBingFavs() }
async function onBingSetByIdx(idx: number) { bing.value = JSON.parse(await go.bingSetByIdx(idx)) }
async function loadBingFavs() {
const raw = await go.getBingFavorites()
const list = JSON.parse(raw) as string[]
bingFavs.value = await Promise.all(list.map(async f => ({
idx: parseInt(f.match(/(\d+)/)?.[1] || '0', 10),
thumb: await go.bingThumbDataURI(f)
})))
}
watch(() => props.s.bingAutoRefresh, v => go.saveBingAutoRefresh(v))
watch(() => props.s.wallpaperType, t => {
if (t === 'bing') { loadBingInfo(); loadBingFavs() }
}, { immediate: true })
async function onPickImage() {
const p = await go.pickLocalImage()
if (p) props.s.imagePath = p
}
// Color swatches
function gradientBg(c1: string, c2: string, gradient: boolean) {
return { background: gradient && c2 ? `linear-gradient(135deg,${c1},${c2})` : c1 }
}
const swatchStyle = computed(() => props.currentColor.c1 ? gradientBg(props.currentColor.c1, props.currentColor.c2, props.currentColor.gradient) : {})
function swatchOf(c: { color1: string; color2: string; gradient: boolean }) { return gradientBg(c.color1, c.color2, c.gradient) }
</script>
<style scoped>
.btn {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 10px;
font-family: inherit; cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--card-border); }
.btn-sm {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 10px; padding: 3px 8px;
font-family: inherit; cursor: pointer; white-space: nowrap;
}
.btn-sm:hover { background: var(--card-border); }
.color-swatch {
width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
border: 2px solid transparent; transition: border-color 0.15s; position: relative;
}
.color-swatch:hover { border-color: var(--accent); }
.color-swatch .del {
display: none; position: absolute; top: -6px; right: -6px;
width: 14px; height: 14px; border-radius: 50%;
background: #e53e3e; color: #fff; font-size: 9px; line-height: 14px;
text-align: center; cursor: pointer;
}
.color-swatch:hover .del { display: block; }
</style>
@@ -0,0 +1,5 @@
const timers = new Map<string, ReturnType<typeof setTimeout>>()
export function debounced(fn: (v: string) => void, val: string, ms = 500) {
clearTimeout(timers.get(fn.name))
timers.set(fn.name, setTimeout(() => fn(val), ms))
}
@@ -0,0 +1,32 @@
const w = window as any
export const go = {
loadAllSettings: (): Promise<string> => w.loadAllSettings(),
saveToggles: (data: Record<string, boolean>) => w.saveToggles(JSON.stringify(data)),
saveLayout: (layout: string) => w.saveLayout(layout),
saveZodiac: (zodiac: string) => w.saveZodiac(zodiac),
saveCity: (cityId: string) => w.saveCity(cityId),
saveWallpaperType: (type: string, theme: string) => w.saveWallpaperType(type, theme),
pickLocalImage: (): Promise<string> => w.pickLocalImage(),
enableBing: () => w.enableBing(),
bingPrev: (): Promise<string> => w.bingPrev(),
bingNext: (): Promise<string> => w.bingNext(),
bingToggleFavorite: (): Promise<string> => w.bingToggleFavorite(),
getBingInfo: (): Promise<string> => w.getBingInfo(),
saveBingAutoRefresh: (val: boolean) => w.saveBingAutoRefresh(val),
getBingFavorites: (): Promise<string> => w.getBingFavorites(),
bingSetByIdx: (idx: number): Promise<string> => w.bingSetByIdx(idx),
bingThumbDataURI: (filename: string): Promise<string> => w.bingThumbDataURI(filename),
pickSolidColor: (): Promise<string> => w.pickSolidColor(),
pickGradientColor: (): Promise<string> => w.pickGradientColor(),
addSavedColor: (c1: string, c2: string, gradient: boolean) => w.addSavedColor(c1, c2, gradient),
removeSavedColor: (idx: number): Promise<string> => w.removeSavedColor(idx),
applySavedColor: (idx: number) => w.applySavedColor(idx),
saveWallpaperText: (text: string) => w.saveWallpaperText(text),
saveKnowledgeKeyword: (keyword: string) => w.saveKnowledgeKeyword(keyword),
saveKnowledgePrompt: (prompt: string) => w.saveKnowledgePrompt(prompt),
pickPhotoDir: (): Promise<string> => w.pickPhotoDir(),
clearPhotoDir: () => w.clearPhotoDir(),
savePhotoInterval: (val: number) => w.savePhotoInterval(val),
resizeToFit: (w: number, h: number) => w.resizeToFit(w, h),
}
+6
View File
@@ -0,0 +1,6 @@
import { createApp } from 'vue'
import App from './App.vue'
import '../tailwind.css'
import './settings.css'
createApp(App).mount('#app')
+48
View File
@@ -0,0 +1,48 @@
:root {
--bg: #0f0f1a;
--card-bg: rgba(255,255,255,0.04);
--card-border: rgba(255,255,255,0.06);
--card-divider: rgba(255,255,255,0.04);
--text: #e0e0e0;
--text-strong: #fff;
--text-weak: rgba(255,255,255,0.25);
--text-muted: rgba(255,255,255,0.5);
--input-bg: rgba(255,255,255,0.08);
--input-border: rgba(255,255,255,0.1);
--input-border-focus: #4f8cff;
--accent: #4f8cff;
--toggle-track: rgba(255,255,255,0.1);
--toggle-thumb: rgba(255,255,255,0.5);
--option-bg: #1a1a2e;
--footer-color: rgba(255,255,255,0.3);
}
.light {
--bg: #f5f5f5;
--card-bg: rgba(0,0,0,0.03);
--card-border: rgba(0,0,0,0.08);
--card-divider: rgba(0,0,0,0.05);
--text: #333;
--text-strong: #111;
--text-weak: rgba(0,0,0,0.35);
--text-muted: rgba(0,0,0,0.55);
--input-bg: rgba(0,0,0,0.04);
--input-border: rgba(0,0,0,0.12);
--input-border-focus: #2b6cb0;
--accent: #2b6cb0;
--toggle-track: rgba(0,0,0,0.12);
--toggle-thumb: rgba(0,0,0,0.45);
--option-bg: #fff;
--footer-color: rgba(0,0,0,0.35);
}
body {
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
background: var(--bg); color: var(--text);
-webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
select option { background: var(--option-bg); color: var(--text); }
.light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
.light ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }
+94
View File
@@ -0,0 +1,94 @@
export interface WeatherData {
current: string
hourly: HourlyItem[]
daily: DailyItem[]
}
export interface HourlyItem {
time: string
icon: string
temp: string
pop?: string
}
export interface DailyItem {
date: string
icon: string
tempMin: string
tempMax: string
}
export interface HoroscopeData {
zodiac: string
all: string
love: string
work: string
money: string
health: string
luckyColor: string
luckyNum: string
noble: string
summary: string
}
export interface AINewsItem {
title: string
source: string
ctime: string
description: string
picUrl: string
}
export interface KnowledgeData {
content: string
keyword: string
}
export interface PhotoData {
src: string
counter: string
interval: number
}
export interface SettingsData {
lightTheme: boolean
wallpaper: boolean
time: boolean
weather: boolean
zodiacCard: boolean
knowledgeCard: boolean
layout: string
zodiac: string
city: string
provinces: string[]
citiesByProv: Record<string, { id: string; name: string }[]>
wallpaperType: string
theme: string
themes: { value: string; label: string }[]
color1: string
color2: string
colorGradient: boolean
savedColors: { color1: string; color2: string; gradient: boolean }[]
bingAutoRefresh: boolean
knowledgeKeyword: string
knowledgePrompt: string
wallpaperText: string
imagePath: string
showSeconds: boolean
ainewsCard: boolean
photoDir: string
photoInterval: number
photoCard: boolean
photoFrameMode: boolean
autoStart: boolean
}
export interface BingState {
date: string
title: string
copyright: string
url: string
fav: boolean
idx: number
total: number
}
+4
View File
@@ -0,0 +1,4 @@
export function safeImageURL(value: unknown): string {
const url = String(value || '').trim()
return /^(https?:|data:image\/)/i.test(url) ? url : ''
}
+3
View File
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+15
View File
@@ -0,0 +1,15 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{vue,ts}', './*.html'],
corePlugins: {
preflight: false,
},
theme: {
extend: {
fontFamily: {
sans: ['"Segoe UI"', '"Microsoft YaHei"', 'sans-serif'],
display: ['-apple-system', '"SF Pro Display"', '"Segoe UI"', 'sans-serif'],
},
},
},
}
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"jsx": "preserve",
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["ESNext", "DOM"],
"skipLibCheck": true,
"noEmit": true,
"paths": {
"@shared/*": ["./src/shared/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.vue"],
"exclude": ["node_modules"]
}
+31
View File
@@ -0,0 +1,31 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { viteSingleFile } from 'vite-plugin-singlefile'
import { resolve } from 'path'
export default defineConfig(({ mode }) => ({
plugins: [vue(), viteSingleFile()],
resolve: {
alias: {
'@shared': resolve(__dirname, 'src/shared'),
},
},
build: {
outDir: resolve(__dirname, '../web'),
emptyOutDir: false,
cssCodeSplit: false,
assetsInlineLimit: 10_000_000,
rollupOptions: {
input: mode === 'overlay'
? resolve(__dirname, 'overlay.html')
: resolve(__dirname, 'settings.html'),
output: {
inlineDynamicImports: true,
},
},
target: 'esnext',
},
css: {
postcss: './postcss.config.js',
},
}))
+22 -928
View File
@@ -1,934 +1,28 @@
<!-- v4 -->
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<style> <meta name="viewport" content="width=device-width, initial-scale=1.0">
* { margin: 0; padding: 0; } <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function n(i){if(i.ep)return;i.ep=!0;const r=s(i);fetch(i.href,r)}})();/**
html, body { * @vue/shared v3.5.34
width: 100%; * (c) 2018-present Yuxi (Evan) You and Vue contributors
height: 100%; * @license MIT
overflow: hidden; **/function Ks(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const J={},at=[],$e=()=>{},Wn=()=>!1,os=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ls=e=>e.startsWith("onUpdate:"),oe=Object.assign,Ws=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},sr=Object.prototype.hasOwnProperty,k=(e,t)=>sr.call(e,t),F=Array.isArray,dt=e=>jt(e)==="[object Map]",Un=e=>jt(e)==="[object Set]",hn=e=>jt(e)==="[object Date]",D=e=>typeof e=="function",ee=e=>typeof e=="string",Fe=e=>typeof e=="symbol",B=e=>e!==null&&typeof e=="object",Bn=e=>(B(e)||D(e))&&D(e.then)&&D(e.catch),zn=Object.prototype.toString,jt=e=>zn.call(e),nr=e=>jt(e).slice(8,-1),qn=e=>jt(e)==="[object Object]",Us=e=>ee(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ot=Ks(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),cs=e=>{const t=Object.create(null);return(s=>t[s]||(t[s]=e(s)))},ir=/-\w/g,ye=cs(e=>e.replace(ir,t=>t.slice(1).toUpperCase())),rr=/\B([A-Z])/g,ct=cs(e=>e.replace(rr,"-$1").toLowerCase()),Gn=cs(e=>e.charAt(0).toUpperCase()+e.slice(1)),vs=cs(e=>e?`on${Gn(e)}`:""),Ie=(e,t)=>!Object.is(e,t),xs=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},Zn=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},or=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let pn;const fs=()=>pn||(pn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function lt(e){if(F(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],i=ee(n)?ur(n):lt(n);if(i)for(const r in i)t[r]=i[r]}return t}else if(ee(e)||B(e))return e}const lr=/;(?![^(]*\))/g,cr=/:([^]+)/,fr=/\/\*[^]*?\*\//g;function ur(e){const t={};return e.replace(fr,"").split(lr).forEach(s=>{if(s){const n=s.split(cr);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function us(e){let t="";if(ee(e))t=e;else if(F(e))for(let s=0;s<e.length;s++){const n=us(e[s]);n&&(t+=n+" ")}else if(B(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const ar="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",dr=Ks(ar);function Jn(e){return!!e||e===""}function hr(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=Bs(e[n],t[n]);return s}function Bs(e,t){if(e===t)return!0;let s=hn(e),n=hn(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=Fe(e),n=Fe(t),s||n)return e===t;if(s=F(e),n=F(t),s||n)return s&&n?hr(e,t):!1;if(s=B(e),n=B(t),s||n){if(!s||!n)return!1;const i=Object.keys(e).length,r=Object.keys(t).length;if(i!==r)return!1;for(const o in e){const l=e.hasOwnProperty(o),f=t.hasOwnProperty(o);if(l&&!f||!l&&f||!Bs(e[o],t[o]))return!1}}return String(e)===String(t)}const Yn=e=>!!(e&&e.__v_isRef===!0),K=e=>ee(e)?e:e==null?"":F(e)||B(e)&&(e.toString===zn||!D(e.toString))?Yn(e)?K(e.value):JSON.stringify(e,Xn,2):String(e),Xn=(e,t)=>Yn(t)?Xn(e,t.value):dt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,i],r)=>(s[ws(n,r)+" =>"]=i,s),{})}:Un(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>ws(s))}:Fe(t)?ws(t):B(t)&&!F(t)&&!qn(t)?String(t):t,ws=(e,t="")=>{var s;return Fe(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
background: #000; * @vue/reactivity v3.5.34
font-family: "Segoe UI", "Microsoft YaHei", sans-serif; * (c) 2018-present Yuxi (Evan) You and Vue contributors
color: #fff; * @license MIT
font-variant-numeric: tabular-nums; **/let re;class pr{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&re&&(re.active?(this.parent=re,this.index=(re.scopes||(re.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=re;try{return re=this,t()}finally{re=s}}}on(){++this._on===1&&(this.prevScope=re,re=this)}off(){if(this._on>0&&--this._on===0){if(re===this)re=this.prevScope;else{let t=re;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function gr(){return re}let Z;const Ss=new WeakSet;class Qn{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,re&&(re.active?re.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ss.has(this)&&(Ss.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ti(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,gn(this),si(this);const t=Z,s=be;Z=this,be=!0;try{return this.fn()}finally{ni(this),Z=t,be=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Gs(t);this.deps=this.depsTail=void 0,gn(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ss.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ps(this)&&this.run()}get dirty(){return Ps(this)}}let ei=0,Mt,It;function ti(e,t=!1){if(e.flags|=8,t){e.next=It,It=e;return}e.next=Mt,Mt=e}function zs(){ei++}function qs(){if(--ei>0)return;if(It){let t=It;for(It=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Mt;){let t=Mt;for(Mt=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function si(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function ni(e){let t,s=e.depsTail,n=s;for(;n;){const i=n.prevDep;n.version===-1?(n===s&&(s=i),Gs(n),_r(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=i}e.deps=t,e.depsTail=s}function Ps(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(ii(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function ii(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Ht)||(e.globalVersion=Ht,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ps(e))))return;e.flags|=2;const t=e.dep,s=Z,n=be;Z=e,be=!0;try{si(e);const i=e.fn(e._value);(t.version===0||Ie(i,e._value))&&(e.flags|=128,e._value=i,t.version++)}catch(i){throw t.version++,i}finally{Z=s,be=n,ni(e),e.flags&=-3}}function Gs(e,t=!1){const{dep:s,prevSub:n,nextSub:i}=e;if(n&&(n.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let r=s.computed.deps;r;r=r.nextDep)Gs(r,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function _r(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let be=!0;const ri=[];function je(){ri.push(be),be=!1}function ke(){const e=ri.pop();be=e===void 0?!0:e}function gn(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Z;Z=void 0;try{t()}finally{Z=s}}}let Ht=0;class mr{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Zs{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Z||!be||Z===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Z)s=this.activeLink=new mr(Z,this),Z.deps?(s.prevDep=Z.depsTail,Z.depsTail.nextDep=s,Z.depsTail=s):Z.deps=Z.depsTail=s,oi(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Z.depsTail,s.nextDep=void 0,Z.depsTail.nextDep=s,Z.depsTail=s,Z.deps===s&&(Z.deps=n)}return s}trigger(t){this.version++,Ht++,this.notify(t)}Line truncated
} * @vue/runtime-core v3.5.34
:root { * (c) 2018-present Yuxi (Evan) You and Vue contributors
--card-bg: rgba(22, 19, 28, 0.56); * @license MIT
--card-bg-strong: rgba(24, 20, 30, 0.68); **/function kt(e,t,s,n){try{return n?e(...n):e()}catch(i){hs(i,t,s)}}function Re(e,t,s,n){if(D(e)){const i=kt(e,t,s,n);return i&&Bn(i)&&i.catch(r=>{hs(r,t,s)}),i}if(F(e)){const i=[];for(let r=0;r<e.length;r++)i.push(Re(e[r],t,s,n));return i}}function hs(e,t,s,n=!0){const i=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||J;if(t){let l=t.parent;const f=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${s}`;for(;l;){const a=l.ec;if(a){for(let p=0;p<a.length;p++)if(a[p](e,f,d)===!1)return}l=l.parent}if(r){je(),kt(r,null,10,[e,f,d]),ke();return}}Wr(e,s,i,n,o)}function Wr(e,t,s,n=!0,i=!1){if(i)throw e;console.error(e)}const de=[];let Ee=-1;const ht=[];let qe=null,ut=0;const pi=Promise.resolve();let es=null;function Ur(e){const t=es||pi;return e?t.then(this?e.bind(this):e):t}function Br(e){let t=Ee+1,s=de.length;for(;t<s;){const n=t+s>>>1,i=de[n],r=Nt(i);r<e||r===e&&i.flags&2?t=n+1:s=n}return t}function Qs(e){if(!(e.flags&1)){const t=Nt(e),s=de[de.length-1];!s||!(e.flags&2)&&t>=Nt(s)?de.push(e):de.splice(Br(t),0,e),e.flags|=1,gi()}}function gi(){es||(es=pi.then(mi))}function zr(e){F(e)?ht.push(...e):qe&&e.id===-1?qe.splice(ut+1,0,e):e.flags&1||(ht.push(e),e.flags|=1),gi()}function mn(e,t,s=Ee+1){for(;s<de.length;s++){const n=de[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;de.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function _i(e){if(ht.length){const t=[...new Set(ht)].sort((s,n)=>Nt(s)-Nt(n));if(ht.length=0,qe){qe.push(...t);return}for(qe=t,ut=0;ut<qe.length;ut++){const s=qe[ut];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}qe=null,ut=0}}const Nt=e=>e.id==null?e.flags&2?-1:1/0:e.id;function mi(e){try{for(Ee=0;Ee<de.length;Ee++){const t=de[Ee];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),kt(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ee<de.length;Ee++){const t=de[Ee];t&&(t.flags&=-2)}Ee=-1,de.length=0,_i(),es=null,(de.length||ht.length)&&mi()}}let Pe=null,yi=null;function ts(e){const t=Pe;return Pe=e,yi=e&&e.type.__scopeId||null,t}function qr(e,t=Pe,s){if(!t||e._n)return e;const n=(...i)=>{n._d&&On(-1);const r=ts(t);let o;try{o=e(...i)}finally{ts(r),n._d&&On(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function st(e,t,s,n){const i=e.dirs,r=t&&t.dirs;for(let o=0;o<i.length;o++){const l=i[o];r&&(l.oldValue=r[o].value);let f=l.dir[n];f&&(je(),Re(f,s,8,[e.el,l,e,t]),ke())}}function Gr(e,t){if(he){let s=he.provides;const n=he.parent&&he.parent.provides;n===s&&(s=he.provides=Object.create(n)),s[e]=t}}function Yt(e,t,s=!1){const n=qo();if(n||pt){let i=pt?pt._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return s&&D(t)?t.call(n&&n.proxy):t}}const Zr=Symbol.for("v-scx"),Jr=()=>Yt(Zr);function Ye(e,t,s){return bi(e,t,s)}function bi(e,t,s=J){const{immediate:n,deep:i,flush:r,once:o}=s,l=oe({},s),f=t&&n||!t&&r!=="post";let d;if(Vt){if(r==="sync"){const C=Jr();d=C.__watcherHandles||(C.__watcherHandles=[])}else if(!f){const C=()=>{};return C.stop=$e,C.resume=$e,C.pause=$e,C}}const a=he;l.call=(C,N,I)=>Re(C,a,N,I);let p=!1;r==="post"?l.scheduler=C=>{pe(C,a&&a.suspense)}:r!=="sync"&&(p=!0,l.scheduler=(C,N)=>{N?C():Qs(C)}),l.augmentJob=C=>{t&&(C.flags|=4),p&&(C.flags|=2,a&&(C.id=a.uid,C.i=a))};const x=Kr(e,t,l);return Vt&&(d?d.push(x):f&&x()),x}function Yr(e,t,s){const n=this.proxy,i=ee(e)?e.includes(".")?vi(n,e):()=>n[e]:e.bind(n,n);let r;D(t)?r=t:(r=t.handler,s=t);const o=Kt(this),l=bi(i,r.bind(n),s);return o(),l}function vi(e,t){const s=t.split(".");return()=>{let n=e;for(let i=0;i<s.length&&n;i++)n=n[s[i]];return n}}const Xr=Symbol("_vte"),Qr=e=>e.__isTeleport,eo=Symbol("_leaveCb");function en(e,t){e.shapeFlag&6&&e.component?(e.transition=t,en(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function He(e,t){return D(e)?oe({name:e.name},t,{setup:e}):e}function xi(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function yn(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const ss=new WeakMap;function Pt(e,t,s,n,i=!1){if(F(e)){e.forEach((I,Q)=>Pt(I,t&&(F(t)?t[Q]:t),s,n,i));return}if($t(n)&&!i){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Pt(e,t,s,n.component.subTree);return}const r=n.shapeFlag&4?on(n.component):n.el,o=i?null:r,{i:l,r:f}=e,d=t&&t.r,a=l.refs===J?l.refs={}:l.refs,p=l.setupState,x=j(p),C=p===J?Wn:I=>yn(a,I)?!1:k(x,I),N=(I,Q)=>!(Q&&yn(a,Q));if(d!=null&&d!==f){if(bn(t),ee(d))a[d]=null,C(d)&&(p[d]=null);else if(fe(d)){const I=t;N(d,I.k)&&(d.value=null),I.k&&(a[I.k]=null)}}if(D(f))kt(f,l,12,[o,a]);else{const I=ee(f),Q=fe(f);if(I||Q){const W=()=>{if(e.f){const L=I?C(f)?p[f]:a[f]:N()||!e.k?f.value:a[e.k];if(i)F(L)&&Ws(L,r);else if(F(L))L.includes(r)||L.push(r);else if(I)a[f]=[r],C(f)&&(p[f]=a[f]);else{const Y=[r];N(f,e.k)&&(f.value=Y),e.k&&(a[e.k]=Y)}}else I?(a[f]=o,C(f)Line truncated
--card-line: rgba(255,255,255,0.10); * @vue/runtime-dom v3.5.34
--card-line-soft: rgba(255,255,255,0.06); * (c) 2018-present Yuxi (Evan) You and Vue contributors
--text-main: rgba(255,255,255,0.92); * @license MIT
--text-soft: rgba(255,255,255,0.66); **/let ks;const Pn=typeof window<"u"&&window.trustedTypes;if(Pn)try{ks=Pn.createPolicy("vue",{createHTML:e=>e})}catch{}const qi=ks?e=>ks.createHTML(e):e=>e,el="http://www.w3.org/2000/svg",tl="http://www.w3.org/1998/Math/MathML",Ne=typeof document<"u"?document:null,$n=Ne&&Ne.createElement("template"),sl={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const i=t==="svg"?Ne.createElementNS(el,e):t==="mathml"?Ne.createElementNS(tl,e):s?Ne.createElement(e,{is:s}):Ne.createElement(e);return e==="select"&&n&&n.multiple!=null&&i.setAttribute("multiple",n.multiple),i},createText:e=>Ne.createTextNode(e),createComment:e=>Ne.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ne.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,i,r){const o=s?s.previousSibling:t.lastChild;if(i&&(i===r||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),s),!(i===r||!(i=i.nextSibling)););else{$n.innerHTML=qi(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const l=$n.content;if(n==="svg"||n==="mathml"){const f=l.firstChild;for(;f.firstChild;)l.appendChild(f.firstChild);l.removeChild(f)}t.insertBefore(l,s)}return[o?o.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},nl=Symbol("_vtc");function il(e,t,s){const n=e[nl];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const Fn=Symbol("_vod"),rl=Symbol("_vsh"),ol=Symbol(""),ll=/(?:^|;)\s*display\s*:/;function cl(e,t,s){const n=e.style,i=ee(s);let r=!1;if(s&&!i){if(t)if(ee(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&Et(n,l,"")}else for(const o in t)s[o]==null&&Et(n,o,"");for(const o in s){o==="display"&&(r=!0);const l=s[o];l!=null?ul(e,o,!ee(t)&&t?t[o]:void 0,l)||Et(n,o,l):Et(n,o,"")}}else if(i){if(t!==s){const o=n[ol];o&&(s+=";"+o),n.cssText=s,r=ll.test(s)}}else t&&e.removeAttribute("style");Fn in e&&(e[Fn]=r?n.display:"",e[rl]&&(n.display="none"))}const Rn=/\s*!important$/;function Et(e,t,s){if(F(s))s.forEach(n=>Et(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=fl(e,t);Rn.test(s)?e.setProperty(ct(n),s.replace(Rn,""),"important"):e[n]=s}}const Hn=["Webkit","Moz","ms"],Ms={};function fl(e,t){const s=Ms[t];if(s)return s;let n=ye(t);if(n!=="filter"&&n in e)return Ms[t]=n;n=Gn(n);for(let i=0;i<Hn.length;i++){const r=Hn[i]+n;if(r in e)return Ms[t]=r}return t}function ul(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&ee(n)&&s===n}const Dn="http://www.w3.org/1999/xlink";function Nn(e,t,s,n,i,r=dr(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(Dn,t.slice(6,t.length)):e.setAttributeNS(Dn,t,s):s==null||r&&!Jn(s)?e.removeAttribute(t):e.setAttribute(t,r?"":Fe(s)?String(s):s)}function Ln(e,t,s,n,i){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?qi(s):s);return}const r=e.tagName;if(t==="value"&&r!=="PROGRESS"&&!r.includes("-")){const l=r==="OPTION"?e.getAttribute("value")||"":e.value,f=s==null?e.type==="checkbox"?"on":"":String(s);(l!==f||!("_value"in e))&&(e.value=f),s==null&&e.removeAttribute(t),e._value=s;return}let o=!1;if(s===""||s==null){const l=typeof e[t];l==="boolean"?s=Jn(s):s==null&&l==="string"?(s="",o=!0):l==="number"&&(s=0,o=!0)}try{e[t]=s}catch{}o&&e.removeAttribute(i||t)}function al(e,t,s,n){e.addEventListener(t,s,n)}function dl(e,t,s,n){e.removeEventListener(t,s,n)}const Vn=Symbol("_vei");function hl(e,t,s,n,i=null){const r=e[Vn]||(e[Vn]={}),o=r[t];if(n&&o)o.value=n;else{const[l,f]=pl(t);if(n){const d=r[t]=ml(n,i);al(e,l,d,f)}else o&&(dl(e,l,o,f),r[t]=void 0)}}const jn=/(?:Once|Passive|Capture)$/;function pl(e){let t;if(jn.test(e)){t={};let n;for(;n=e.match(jn);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ct(e.slice(2)),t]}let Is=0;const gl=Promise.resolve(),_l=()=>Is||(gl.then(()=>Is=0),Is=Date.now());function ml(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Re(yl(n,s.value),t,5,[n])};return s.value=e,s.attached=_l(),s}function yl(e,t){if(F(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>i=>!i._stopped&&n&&n(i))}else return t}const kn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,bl=(e,t,s,n,i,r)=>{const o=i==="svg";t==="class"?il(e,n,o):t==="style"?cl(e,s,n):os(t)?ls(t)||hl(e,t,s,n,r):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):vl(e,t,n,o))?(Ln(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Nn(e,t,n,o,r,t!=="value")):e._isVueCE&&(xl(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ee(n)))?Ln(e,ye(t),n,r,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),Nn(e,t,n,o))};function vl(e,t,s,n){if(n)return!!(t==="inLine truncated
--text-faint: rgba(255,255,255,0.42); <style rel="stylesheet" crossorigin>.time[data-v-fc6abe16]{font-size:66px;font-weight:200;text-shadow:0 3px 28px rgba(0,0,0,.42);letter-spacing:0;line-height:1;font-variant-numeric:tabular-nums;color:#fffffff5}.time.hourly-glow[data-v-fc6abe16]{animation:hourlyGlow 6s ease-out forwards}.date[data-v-fc6abe16]{font-size:13px;color:var(--text-soft);margin-bottom:8px;text-shadow:0 1px 6px rgba(0,0,0,.5);letter-spacing:0}@media(max-width:1500px){.time[data-v-fc6abe16]{font-size:64px}}.current-weather[data-v-c377fb97]{font-size:17px;font-weight:600;color:var(--text-main);text-shadow:0 1px 4px rgba(0,0,0,.5);margin-bottom:16px;text-align:right}.forecast-title[data-v-c377fb97]{font-size:11px;font-weight:600;color:var(--text-faint);letter-spacing:0;margin-bottom:9px;text-align:right}.weather-forecast[data-v-c377fb97]{display:grid;grid-template-columns:repeat(8,minmax(60px,1fr));gap:7px;overflow:hidden}.forecast-item[data-v-c377fb97]{background:#ffffff0e;border-radius:8px;padding:9px 8px;text-align:center;min-width:0;font-size:12px;color:var(--text-main);border:1px solid var(--card-line-soft)}.forecast-icon[data-v-c377fb97]{font-size:22px;margin:5px 0}.forecast-time[data-v-c377fb97]{color:var(--text-faint);font-size:10px}.forecast-temp[data-v-c377fb97]{font-weight:700;margin-top:2px;font-size:14px}.forecast-pop[data-v-c377fb97]{font-size:10px;color:var(--text-faint);margin-top:2px}.daily-forecast[data-v-c377fb97]{display:grid;grid-template-columns:repeat(7,minmax(64px,1fr));gap:7px;overflow:hidden}.daily-item[data-v-c377fb97]{background:#ffffff0a;border-radius:8px;padding:9px 8px;text-align:center;min-width:0;font-size:12px;color:var(--text-main);border:1px solid var(--card-line-soft)}.daily-icon[data-v-c377fb97]{font-size:22px;margin:5px 0}.weather-forecast[data-v-c377fb97]::-webkit-scrollbar,.daily-forecast[data-v-c377fb97]::-webkit-scrollbar{display:none}@media(max-width:1500px){.weather-forecast[data-v-c377fb97],.daily-forecast[data-v-c377fb97]{grid-template-columns:repeat(4,1fr)}}.zodiac-text[data-v-bcc0f377]{font-size:14px;color:var(--text-main);line-height:1.6;text-shadow:0 1px 4px rgba(0,0,0,.5)}.zodiac-title[data-v-bcc0f377]{font-size:16px;font-weight:650;margin-bottom:3px}.zodiac-date[data-v-bcc0f377]{font-size:11px;color:var(--text-faint);margin-bottom:12px}.zodiac-bar[data-v-bcc0f377]{display:flex;align-items:center;gap:10px;margin-bottom:7px;font-size:12px}.zodiac-bar-label[data-v-bcc0f377]{width:28px;color:var(--text-soft);flex-shrink:0}.zodiac-bar-track[data-v-bcc0f377]{flex:1;height:5px;background:#ffffff1a;border-radius:999px;overflow:hidden}.zodiac-bar-fill[data-v-bcc0f377]{height:100%;border-radius:999px;transition:width .6s ease}.zodiac-bar-val[data-v-bcc0f377]{width:30px;text-align:right;font-size:11px;color:var(--text-soft);flex-shrink:0}.zodiac-tags[data-v-bcc0f377]{display:flex;gap:7px;flex-wrap:wrap;margin:10px 0 9px}.zodiac-tag[data-v-bcc0f377]{font-size:10px;background:#ffffff14;padding:4px 8px;border-radius:6px;color:var(--text-soft);border:1px solid rgba(255,255,255,.05)}.zodiac-summary[data-v-bcc0f377]{font-size:12px;color:var(--text-soft);line-height:1.65;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.knowledge-header[data-v-20fd209d]{font-size:11px;color:var(--text-faint);margin-bottom:10px;display:flex;align-items:center;gap:6px;letter-spacing:0;font-weight:700}.knowledge-keyword-tag[data-v-20fd209d]{background:#ffffff17;padding:3px 8px;border-radius:6px;font-size:10px;color:var(--text-soft)}.knowledge-content[data-v-20fd209d]{font-size:16px;color:var(--text-main);line-height:1.55;text-shadow:0 1px 4px rgba(0,0,0,.5)}.ainews-header[data-v-842d17af]{font-size:11px;font-weight:700;color:var(--text-faint);letter-spacing:0;margin-bottom:14px}.ainews-item[data-v-842d17af]{display:flex;gap:14px;margin-bottom:12px;padding-bottom:12px;border-bottom:1px solid var(--card-line-soft);min-height:58px}.ainews-item[data-v-842d17af]:last-child{margin-bottom:0;padding-bottom:0;border-bottom:none}.ainews-img[data-v-842d17af]{width:92px;height:58px;border-radius:6px;-o-object-fit:cover;object-fit:cover;flex-shrink:0;opacity:.92;box-shadow:0 8px 22px #00000038}.ainews-body[data-v-842d17af]{flex:1;min-width:0}.ainews-title-row[data-v-842d17af]{display:flex;align-items:baseline;gap:10px}.ainews-title[data-v-842d17af]{font-size:14px;font-weight:650;color:var(--text-main);line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}.ainews-source[data-v-842d17af]{font-size:10px;color:var(--text-faint);flex-shrink:0}.ainews-desc[data-v-842d17af]{font-size:12px;color:var(--text-soft);line-height:1.5;margin-top:5px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}#layout-single[data-v-89757d39]{display:block}#info[data-v-89757d39]{position:fixed;top:42px;right:42px;text-align:left;width:min(760px,calc(50vw - 52px));max-height:calc(100vh - 84px);z-index:10}#card-photo[data-v-32718552]{padding:16px}.photoLine truncated
--accent-warm: #ffd86b;
--accent-cool: #6bdcff;
--shadow-card: 0 18px 60px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.10);
--layout-x: 48px;
--layout-top: 38px;
--layout-bottom: 72px;
--layout-gap: 18px;
--layout-col-gap: 24px;
--right-panel: 400px;
--knowledge-panel: 460px;
--time-panel-h: 154px;
--zodiac-panel-h: 326px;
--photo-panel-h: 360px;
}
/* ===== 公共卡片样式 ===== */
.card {
position: relative;
box-sizing: border-box;
overflow: hidden;
background: linear-gradient(145deg, rgba(255,255,255,0.075), rgba(255,255,255,0.025)), var(--card-bg);
backdrop-filter: blur(28px) saturate(1.2);
-webkit-backdrop-filter: blur(28px) saturate(1.2);
border: 1px solid var(--card-line);
border-radius: 8px;
padding: 22px 24px;
box-shadow: var(--shadow-card);
}
.card::before {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
border-radius: inherit;
background:
linear-gradient(90deg, rgba(255,255,255,0.13), transparent 34%),
radial-gradient(circle at 12% 0%, rgba(255,216,107,0.13), transparent 38%);
opacity: 0.55;
}
.card > * {
position: relative;
}
.time {
font-size: 66px;
font-weight: 200;
text-shadow: 0 3px 28px rgba(0,0,0,0.42);
letter-spacing: 0;
line-height: 1;
font-variant-numeric: tabular-nums;
color: rgba(255,255,255,0.96);
}
@keyframes hourlyGlow {
0% { text-shadow: 0 0 30px rgba(255,255,255,1), 0 0 80px rgba(180,200,255,0.8), 0 0 120px rgba(100,150,255,0.5); color: #fff; }
8% { text-shadow: 0 0 50px rgba(255,255,255,1), 0 0 100px rgba(180,200,255,1), 0 0 160px rgba(100,150,255,0.6); }
18% { text-shadow: 0 0 20px rgba(255,255,255,0.6), 0 0 40px rgba(180,200,255,0.3); }
28% { text-shadow: 0 0 35px rgba(255,255,255,0.85), 0 0 70px rgba(180,200,255,0.6), 0 0 100px rgba(100,150,255,0.35); }
38% { text-shadow: 0 0 15px rgba(255,255,255,0.4), 0 0 30px rgba(180,200,255,0.2); }
48% { text-shadow: 0 0 25px rgba(255,255,255,0.6), 0 0 50px rgba(180,200,255,0.4); }
60% { text-shadow: 0 0 10px rgba(255,255,255,0.25), 0 0 20px rgba(180,200,255,0.12); }
75% { text-shadow: 0 0 15px rgba(255,255,255,0.35), 0 0 30px rgba(180,200,255,0.2); }
100% { text-shadow: 0 2px 20px rgba(0,0,0,0.5); color: #fff; }
}
.time.hourly-glow {
animation: hourlyGlow 6s ease-out forwards;
}
.date {
font-size: 13px;
color: var(--text-soft);
margin-bottom: 8px;
text-shadow: 0 1px 6px rgba(0,0,0,0.5);
letter-spacing: 0;
}
.current-weather {
font-size: 17px;
font-weight: 600;
color: var(--text-main);
text-shadow: 0 1px 4px rgba(0,0,0,0.5);
margin-bottom: 16px;
text-align: right;
}
.forecast-title {
font-size: 11px;
font-weight: 600;
color: var(--text-faint);
letter-spacing: 0;
margin-bottom: 9px;
text-align: right;
}
.weather-forecast {
display: grid;
grid-template-columns: repeat(8, minmax(60px, 1fr));
gap: 7px;
overflow: hidden;
padding-bottom: 0;
}
.forecast-item {
background: rgba(255,255,255,0.055);
border-radius: 8px;
padding: 9px 8px;
text-align: center;
min-width: 0;
font-size: 12px;
color: var(--text-main);
border: 1px solid var(--card-line-soft);
}
.forecast-icon { font-size: 22px; margin: 5px 0; }
.forecast-time { color: var(--text-faint); font-size: 10px; }
.forecast-temp { font-weight: 700; margin-top: 2px; font-size: 14px; }
.forecast-pop { font-size: 10px; color: var(--text-faint); margin-top: 2px; }
.daily-forecast {
display: grid;
grid-template-columns: repeat(7, minmax(64px, 1fr));
gap: 7px;
overflow: hidden;
padding-bottom: 0;
}
.daily-item {
background: rgba(255,255,255,0.04);
border-radius: 8px;
padding: 9px 8px;
text-align: center;
min-width: 0;
font-size: 12px;
color: var(--text-main);
border: 1px solid var(--card-line-soft);
}
.daily-icon { font-size: 22px; margin: 5px 0; }
.zodiac-text {
font-size: 14px;
color: var(--text-main);
line-height: 1.6;
text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.zodiac-title {
font-size: 16px;
font-weight: 650;
margin-bottom: 3px;
}
.zodiac-date {
font-size: 11px;
color: var(--text-faint);
margin-bottom: 12px;
}
.zodiac-bar {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 7px;
font-size: 12px;
}
.zodiac-bar-label {
width: 28px;
color: var(--text-soft);
flex-shrink: 0;
}
.zodiac-bar-track {
flex: 1;
height: 5px;
background: rgba(255,255,255,0.10);
border-radius: 999px;
overflow: hidden;
}
.zodiac-bar-fill {
height: 100%;
border-radius: 999px;
transition: width 0.6s ease;
}
.zodiac-bar-val {
width: 30px;
text-align: right;
font-size: 11px;
color: var(--text-soft);
flex-shrink: 0;
}
.zodiac-tags {
display: flex;
gap: 7px;
flex-wrap: wrap;
margin: 10px 0 9px;
}
.zodiac-tag {
font-size: 10px;
background: rgba(255,255,255,0.08);
padding: 4px 8px;
border-radius: 6px;
color: var(--text-soft);
border: 1px solid rgba(255,255,255,0.05);
}
.zodiac-summary {
font-size: 12px;
color: var(--text-soft);
line-height: 1.65;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* ===== AI 资讯 ===== */
.ainews-header {
font-size: 11px;
font-weight: 700;
color: var(--text-faint);
letter-spacing: 0;
margin-bottom: 14px;
}
.ainews-item {
display: flex;
gap: 14px;
margin-bottom: 12px;
padding-bottom: 12px;
border-bottom: 1px solid var(--card-line-soft);
min-height: 58px;
}
.ainews-item:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.ainews-img {
width: 92px;
height: 58px;
border-radius: 6px;
object-fit: cover;
flex-shrink: 0;
opacity: 0.92;
box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}
.ainews-body {
flex: 1;
min-width: 0;
}
.ainews-title-row {
display: flex;
align-items: baseline;
gap: 10px;
}
.ainews-title {
font-size: 14px;
font-weight: 650;
color: var(--text-main);
line-height: 1.4;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
min-width: 0;
}
.ainews-source {
font-size: 10px;
color: var(--text-faint);
flex-shrink: 0;
}
.ainews-desc {
font-size: 12px;
color: var(--text-soft);
line-height: 1.5;
margin-top: 5px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
@media (max-width: 1500px) {
:root {
--layout-x: 32px;
--layout-col-gap: 18px;
--right-panel: 360px;
--knowledge-panel: 380px;
--time-panel-h: 144px;
--zodiac-panel-h: 312px;
--photo-panel-h: 320px;
}
.time {
font-size: 64px;
}
.weather-forecast {
grid-template-columns: repeat(4, 1fr);
}
.daily-forecast {
grid-template-columns: repeat(4, 1fr);
}
}
/* ===== 知识卡片 ===== */
.knowledge-header {
font-size: 11px;
color: var(--text-faint);
margin-bottom: 10px;
display: flex;
align-items: center;
gap: 6px;
letter-spacing: 0;
font-weight: 700;
}
.knowledge-keyword-tag {
background: rgba(255,255,255,0.09);
padding: 3px 8px;
border-radius: 6px;
font-size: 10px;
color: var(--text-soft);
}
.knowledge-content {
font-size: 16px;
color: var(--text-main);
line-height: 1.55;
text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.divider {
height: 1px;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
margin: 18px 0;
}
#author {
position: fixed;
bottom: 60px;
right: 30px;
font-size: 16px;
color: rgba(255,255,255,0.42);
letter-spacing: 0;
z-index: 10;
pointer-events: none;
}
.weather-forecast::-webkit-scrollbar,
.daily-forecast::-webkit-scrollbar { display: none; }
/* ===== SINGLE 布局(现有) ===== */
body.layout-single #layout-single { display: block; }
body.layout-single #layout-multi { display: none; }
body.layout-single #info {
position: fixed;
top: 42px;
right: 42px;
text-align: left;
width: min(760px, calc(50vw - 52px));
max-height: calc(100vh - 84px);
z-index: 10;
}
body.layout-single #info .date {
text-align: left;
}
/* ===== MULTI 布局(独立卡片) ===== */
body.layout-multi #layout-single { display: none; }
body.layout-multi #layout-multi {
position: fixed;
inset: var(--layout-top) var(--layout-x) var(--layout-bottom);
z-index: 10;
display: grid;
grid-template-columns: minmax(420px, 1fr) minmax(360px, var(--knowledge-panel)) var(--right-panel);
grid-template-rows: var(--time-panel-h) var(--layout-gap) var(--zodiac-panel-h) minmax(32px, 1fr) auto;
grid-template-areas:
"photo knowledge time"
"photo knowledge ."
"photo knowledge zodiac"
". . ."
"news weather weather";
column-gap: var(--layout-col-gap);
row-gap: 0;
pointer-events: none;
}
body.layout-multi #layout-multi > .card {
pointer-events: none;
}
body.layout-multi #card-time {
grid-area: time;
text-align: left;
width: 100%;
height: 100%;
padding: 22px 30px;
}
body.layout-multi #card-zodiac {
grid-area: zodiac;
width: 100%;
height: 100%;
padding: 22px 28px;
}
body.layout-multi #card-knowledge {
grid-area: knowledge;
align-self: stretch;
width: 100%;
min-height: 0;
padding: 22px 26px;
}
body.layout-multi #card-knowledge .knowledge-content {
display: -webkit-box;
-webkit-line-clamp: 8;
-webkit-box-orient: vertical;
overflow: hidden;
}
body.layout-multi #card-ainews {
grid-area: news;
align-self: end;
width: 100%;
max-height: 390px;
}
body.layout-multi #card-weather {
grid-area: weather;
align-self: end;
width: 100%;
min-width: 0;
text-align: right;
padding: 22px 28px 24px;
}
body.layout-multi #card-photo {
grid-area: photo;
position: relative;
top: auto;
left: auto;
align-self: start;
width: 100%;
max-height: var(--photo-panel-h);
padding: 16px;
}
body.layout-multi #card-photo img {
max-height: calc(var(--photo-panel-h) - 32px);
}
/* ===== 卡片隐藏 ===== */
body.hide-time #card-time,
body.hide-time #info .time,
body.hide-time #info .date { display: none !important; }
body.hide-weather #card-weather,
body.hide-weather #info .weather-section,
body.hide-weather #info .current-weather,
body.hide-weather #info .forecast-title,
body.hide-weather #info .weather-forecast,
body.hide-weather #info .daily-forecast { display: none !important; }
body.hide-zodiac #card-zodiac,
body.hide-zodiac #info .zodiac-text { display: none !important; }
body.hide-ainews #card-ainews,
body.hide-ainews #info .ainews-section { display: none !important; }
body.hide-knowledge #card-knowledge,
body.hide-knowledge #info .knowledge-section { display: none !important; }
body.hide-photo #card-photo { display: none !important; }
/* ===== 相册 ===== */
#card-photo {
position: fixed;
top: 44px;
left: 48px;
width: min(860px, calc(50vw - 72px));
box-sizing: border-box;
z-index: 10;
padding: 16px;
}
.photo-wrap {
position: relative;
border-radius: 8px;
overflow: hidden;
}
#card-photo img {
width: 100%;
max-height: 450px;
object-fit: cover;
display: block;
border-radius: 8px;
transition: opacity 0.5s ease;
}
.photo-info {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 20px 14px 10px;
background: linear-gradient(transparent, rgba(0,0,0,0.5));
}
.photo-counter {
font-size: 11px;
opacity: 0.7;
display: block;
margin-bottom: 6px;
}
.photo-progress {
height: 3px;
background: rgba(255,255,255,0.15);
border-radius: 2px;
overflow: hidden;
}
.photo-progress-bar {
height: 100%;
width: 0%;
background: rgba(255,255,255,0.6);
border-radius: 2px;
}
/* ===== 电子相册模式 ===== */
body.photo-frame-mode #bg-layer { display: none !important; }
body.photo-frame-mode #card-photo { display: none !important; }
body.photo-frame-mode #layout-multi { display: none !important; }
body.photo-frame-mode #layout-single { display: none !important; }
body.photo-frame-mode #author { display: none !important; }
#photo-frame-bg {
display: none;
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 4;
object-fit: cover;
filter: blur(30px) brightness(0.5);
transform: scale(1.1);
transition: opacity 0.8s ease;
}
#photo-frame-img {
display: none;
position: fixed;
top: 0; left: 0;
width: 100%; height: 100%;
z-index: 5;
object-fit: contain;
transition: opacity 0.8s ease;
}
body.photo-frame-mode #photo-frame-bg { display: block; }
body.photo-frame-mode #photo-frame-img { display: block; }
/* 相册时钟叠加层 */
.photo-frame-clock {
position: fixed; top: 28px; right: 36px; z-index: 10;
font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
font-size: 52px; font-weight: 200; letter-spacing: 2px;
color: #fff;
text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 0 40px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.9);
pointer-events: none;
opacity: 0;
transition: opacity 0.5s ease;
}
body.photo-frame-mode .photo-frame-clock { opacity: 1; }
.photo-frame-date {
position: fixed; top: 86px; right: 38px; z-index: 10;
font-family: -apple-system, "SF Pro Display", "Segoe UI", sans-serif;
font-size: 15px; font-weight: 400;
color: rgba(255,255,255,0.8);
text-shadow: 0 0 12px rgba(0,0,0,0.7), 0 1px 3px rgba(0,0,0,0.8);
pointer-events: none;
opacity: 0;
transition: opacity 0.5s ease;
}
body.photo-frame-mode .photo-frame-date { opacity: 1; }
</style>
</head> </head>
<body class="layout-{{LAYOUT}} {{BODY_CLASSES}}"> <body>
{{BACKGROUND}} <div id="app"></div>
<!-- ===== SINGLE 布局 ===== -->
<div id="layout-single">
<div id="info" class="card">
<div class="date" id="date">1月1日 周一</div>
<div class="time" id="time">00:00</div>
<div class="divider"></div>
<div class="ainews-section">
<div class="ainews-header">🤖 AI 资讯</div>
<div id="ainews">加载中...</div>
</div>
<div class="divider"></div>
<div class="knowledge-section">
<div class="knowledge-header">💡 知识卡片 <span class="knowledge-keyword-tag" id="knowledgeTag"></span></div>
<div class="knowledge-content" id="knowledge">请设置知识关键字</div>
</div>
<div class="divider"></div>
<div>
<div class="current-weather" id="currentWeather">加载中...</div>
<div class="forecast-title">24小时预报</div>
<div class="weather-forecast" id="hourlyForecast"></div>
<div class="forecast-title" style="margin-top:12px">7日预报</div>
<div class="daily-forecast" id="dailyForecast"></div>
</div>
<div class="divider"></div>
<div class="zodiac-text" id="zodiac">加载中...</div>
</div>
</div>
<!-- ===== MULTI 布局 ===== -->
<div id="layout-multi">
<div id="card-time" class="card">
<div class="date" id="date2">1月1日 周一</div>
<div class="time" id="time2">00:00</div>
</div>
<div id="card-zodiac" class="card">
<div class="zodiac-text" id="zodiac2">加载中...</div>
</div>
<div id="card-knowledge" class="card">
<div class="knowledge-header">💡 知识卡片 <span class="knowledge-keyword-tag" id="knowledgeTag2"></span></div>
<div class="knowledge-content" id="knowledge2">请设置知识关键字</div>
</div>
<div id="card-ainews" class="card">
<div class="ainews-header">🤖 AI 资讯</div>
<div id="ainews2">加载中...</div>
</div>
<div id="card-weather" class="card">
<div class="current-weather" id="currentWeather2">加载中...</div>
<div class="forecast-title">24小时预报</div>
<div class="weather-forecast" id="hourlyForecast2"></div>
<div class="forecast-title" style="margin-top:12px">7日预报</div>
<div class="daily-forecast" id="dailyForecast2"></div>
</div>
<div id="card-photo" class="card" style="display:none">
<div class="photo-wrap">
<img id="photoImg" src="" alt="">
<div class="photo-info">
<span class="photo-counter" id="photoCounter"></span>
<div class="photo-progress"><div class="photo-progress-bar" id="photoProgress"></div></div>
</div>
</div>
</div>
</div>
<div id="author">绝尘</div>
<!-- 相册模式全屏图片 -->
<img id="photo-frame-bg" src="" alt="">
<img id="photo-frame-img" src="" alt="">
<!-- 相册模式时钟 -->
<div class="photo-frame-clock" id="photoFrameClock"></div>
<div class="photo-frame-date" id="photoFrameDate"></div>
<script>
var lastTimeStr='', lastDateStr='', lastZodiac='';
var horoscopeInfo=null;
var zodiacData = {
'白羊座':{icon:'♈',date:'3.21-4.19'},
'金牛座':{icon:'♉',date:'4.20-5.20'},
'双子座':{icon:'♊',date:'5.21-6.21'},
'巨蟹座':{icon:'♋',date:'6.22-7.22'},
'狮子座':{icon:'♌',date:'7.23-8.22'},
'处女座':{icon:'♍',date:'8.23-9.22'},
'天秤座':{icon:'♎',date:'9.23-10.23'},
'天蝎座':{icon:'♏',date:'10.24-11.22'},
'射手座':{icon:'♐',date:'11.23-12.21'},
'摩羯座':{icon:'♑',date:'12.22-1.19'},
'水瓶座':{icon:'♒',date:'1.20-2.18'},
'双鱼座':{icon:'♓',date:'2.19-3.20'}
};
var barColors={all:'#e0e0e0',love:'#ff6b9d',work:'#4fc3f7',money:'#ffd54f',health:'#81c784'};
function getUserZodiac(){ return window.userZodiac||'射手座'; }
function setEl(id,html){
var e=document.getElementById(id);
if(e) e.innerHTML=html;
}
function setText(id,txt){
var e=document.getElementById(id);
if(e) e.textContent=txt;
}
function escapeHTML(value){
return String(value == null ? '' : value)
.replace(/&/g,'&amp;')
.replace(/</g,'&lt;')
.replace(/>/g,'&gt;')
.replace(/"/g,'&quot;')
.replace(/'/g,'&#39;');
}
function safeImageURL(value){
var url=String(value || '').trim();
return /^(https?:|data:image\/)/i.test(url) ? url : '';
}
function buildBar(label,val,color){
var v=parseInt(val)||0;
return '<div class="zodiac-bar">'+
'<span class="zodiac-bar-label">'+label+'</span>'+
'<div class="zodiac-bar-track"><div class="zodiac-bar-fill" style="width:'+v+'%;background:'+color+'"></div></div>'+
'<span class="zodiac-bar-val">'+val+'%</span></div>';
}
function buildZodiacHTML(name){
var z=zodiacData[name]||{icon:'✨',date:''};
var html='<div class="zodiac-title">'+z.icon+' '+name+'运势</div>';
html+='<div class="zodiac-date">'+z.date+'</div>';
if(horoscopeInfo&&horoscopeInfo.zodiac===name){
html+=buildBar('综合',horoscopeInfo.all,barColors.all);
html+=buildBar('爱情',horoscopeInfo.love,barColors.love);
html+=buildBar('工作',horoscopeInfo.work,barColors.work);
html+=buildBar('财运',horoscopeInfo.money,barColors.money);
html+=buildBar('健康',horoscopeInfo.health,barColors.health);
html+='<div class="zodiac-tags">';
if(horoscopeInfo.luckyColor) html+='<span class="zodiac-tag">🎨 '+escapeHTML(horoscopeInfo.luckyColor)+'</span>';
if(horoscopeInfo.luckyNum) html+='<span class="zodiac-tag">🔢 '+escapeHTML(horoscopeInfo.luckyNum)+'</span>';
if(horoscopeInfo.noble) html+='<span class="zodiac-tag">⭐ '+escapeHTML(horoscopeInfo.noble)+'</span>';
html+='</div>';
if(horoscopeInfo.summary) html+='<div class="zodiac-summary">'+escapeHTML(horoscopeInfo.summary)+'</div>';
} else {
html+='<div style="opacity:0.4;font-size:12px;margin-top:8px">运势加载中...</div>';
}
return html;
}
function updateZodiacDisplay(){
var name=getUserZodiac();
if(name===lastZodiac) return;
lastZodiac=name;
var html=buildZodiacHTML(name);
setEl('zodiac',html);
setEl('zodiac2',html);
}
var holidays=[
{m:1,d:1,name:'元旦'},
{m:2,d:14,name:'情人节'},
{m:3,d:8,name:'妇女节'},
{m:4,d:5,name:'清明节'},
{m:5,d:1,name:'劳动节'},
{m:5,d:4,name:'青年节'},
{m:6,d:1,name:'儿童节'},
{m:7,d:1,name:'建党节'},
{m:8,d:1,name:'建军节'},
{m:9,d:10,name:'教师节'},
{m:10,d:1,name:'国庆节'},
{m:10,d:31,name:'万圣节'},
{m:12,d:25,name:'圣诞节'}
];
function getNextHoliday(now){
var y=now.getFullYear(), results=[];
for(var i=0;i<holidays.length;i++){
var h=holidays[i];
var target=new Date(y,h.m-1,h.d);
var diff=Math.ceil((target-now)/(1000*60*60*24));
if(diff>0&&diff<=60) results.push({diff:diff,name:h.name});
if(diff<0){
target=new Date(y+1,h.m-1,h.d);
diff=Math.ceil((target-now)/(1000*60*60*24));
if(diff>0&&diff<=60) results.push({diff:diff,name:h.name});
}
}
results.sort(function(a,b){return a.diff-b.diff;});
return results.length>0?'距'+results[0].name+'还有'+results[0].diff+'天':'';
}
window.setCardVisible=function(card,visible){
if(visible){document.body.classList.remove('hide-'+card);}
else{document.body.classList.add('hide-'+card);}
};
window.setWallpaperVisible=function(visible){
var bg=document.getElementById('bg-layer');
if(bg){bg.style.display=visible?'':'none';}
};
window.setPhotoFrameMode=function(enabled){
if(enabled){
document.body.classList.add('photo-frame-mode');
} else {
document.body.classList.remove('photo-frame-mode');
}
};
window._showSeconds={{SHOW_SECONDS}};
window.setShowSeconds=function(v){window._showSeconds=v; updateTime();};
function updateTime(){
var now=new Date();
var hh=String(now.getHours()).padStart(2,'0');
var mm=String(now.getMinutes()).padStart(2,'0');
var ss=String(now.getSeconds()).padStart(2,'0');
var month=now.getMonth()+1;
var day=now.getDate();
var week=['周日','周一','周二','周三','周四','周五','周六'][now.getDay()];
var timeStr=window._showSeconds?(hh+':'+mm+':'+ss):(hh+':'+mm);
var dateStr=month+'月'+day+'日 '+week;
if(timeStr!==lastTimeStr){
setText('time',timeStr); setText('time2',timeStr); lastTimeStr=timeStr;
if(mm==='00'&&ss==='00'){
['time','time2'].forEach(function(id){
var el=document.getElementById(id);
if(el){
el.classList.remove('hourly-glow');
void el.offsetWidth;
el.classList.add('hourly-glow');
el.addEventListener('animationend',function(){ el.classList.remove('hourly-glow'); },{once:true});
}
});
}
}
if(dateStr!==lastDateStr){
var holiday=getNextHoliday(now);
var displayStr=holiday?dateStr+' <span style="opacity:0.5;font-size:12px">「'+holiday+'」</span>':dateStr;
setEl('date',displayStr); setEl('date2',displayStr); lastDateStr=dateStr;
}
updateZodiacDisplay();
// 相册模式时钟
var fc=document.getElementById('photoFrameClock');
var fd=document.getElementById('photoFrameDate');
if(fc) fc.textContent=timeStr;
if(fd) fd.textContent=dateStr;
}
window.updateHoroscopeFromGo=function(data){
console.log('[horoscope] received:', typeof data, JSON.stringify(data).substring(0,100));
if(typeof data==='string') data=JSON.parse(data);
horoscopeInfo=data;
lastZodiac='';
window.userZodiac=data.zodiac;
updateZodiacDisplay();
};
window.updateAINewsFromGo=function(items){
if(typeof items==='string') items=JSON.parse(items);
if(!items||!items.length) return;
var html='';
var count=Math.min(items.length,5);
for(var i=0;i<count;i++){
var n=items[i];
var time=n.ctime||'';
if(time.length>10) time=time.substring(5,10);
html+='<div class="ainews-item">';
var picUrl=safeImageURL(n.picUrl);
if(picUrl){
html+='<img class="ainews-img" src="'+escapeHTML(picUrl)+'" loading="lazy" onerror="this.style.display=\'none\'">';
}
html+='<div class="ainews-body">';
html+='<div class="ainews-title-row"><span class="ainews-title">'+escapeHTML(n.title)+'</span><span class="ainews-source">'+escapeHTML(n.source)+' · '+escapeHTML(time)+'</span></div>';
if(n.description) html+='<div class="ainews-desc">'+escapeHTML(n.description)+'</div>';
html+='</div></div>';
}
setEl('ainews',html);
setEl('ainews2',html);
};
window.updateKnowledgeFromGo=function(data){
if(typeof data==='string') data=JSON.parse(data);
var ids=['knowledge','knowledge2'];
var tagIds=['knowledgeTag','knowledgeTag2'];
ids.forEach(function(id,i){
var el=document.getElementById(id);
if(el) el.textContent=data.content||'';
var tag=document.getElementById(tagIds[i]);
if(tag) tag.textContent=data.keyword?'#'+data.keyword:'';
});
};
window.updateWeatherFromGo=function(data){
if(typeof data==='string') data=JSON.parse(data);
function renderWeather(curId,hourlyId,dailyId){
if(data.current) setText(curId,data.current);
var fel=document.getElementById(hourlyId);
if(fel){
if(data.hourly&&data.hourly.length>0){
fel.innerHTML=data.hourly.map(function(item){
return '<div class="forecast-item"><div class="forecast-time">'+escapeHTML(item.time)+'</div><div class="forecast-icon">'+escapeHTML(item.icon)+'</div><div class="forecast-temp">'+escapeHTML(item.temp)+'</div>'+(item.pop&&item.pop!=='0'?'<div class="forecast-pop">'+escapeHTML(item.pop)+'%</div>':'')+'</div>';
}).join('');
} else { fel.innerHTML='<div style="font-size:11px;opacity:0.4">暂无数据</div>'; }
}
var del=document.getElementById(dailyId);
if(del){
if(data.daily&&data.daily.length>0){
del.innerHTML=data.daily.map(function(item){
return '<div class="daily-item"><div style="opacity:0.6;font-size:10px">'+escapeHTML(item.date)+'</div><div class="daily-icon">'+escapeHTML(item.icon)+'</div><div class="forecast-temp">'+escapeHTML(item.tempMin)+'°~'+escapeHTML(item.tempMax)+'°</div></div>';
}).join('');
} else { del.innerHTML='<div style="font-size:11px;opacity:0.4">暂无数据</div>'; }
}
}
renderWeather('currentWeather','hourlyForecast','dailyForecast');
renderWeather('currentWeather2','hourlyForecast2','dailyForecast2');
};
updateTime();
setInterval(updateTime,1000);
window.updatePhotoFromGo=function(data){
if(typeof data==='string') data=JSON.parse(data);
var pfImg=document.getElementById('photo-frame-img');
var pfBg=document.getElementById('photo-frame-bg');
if(document.body.classList.contains('photo-frame-mode')&&pfImg){
if(!data||!data.src) return;
pfImg.style.opacity='0';
pfBg.style.opacity='0';
setTimeout(function(){
pfBg.src=data.src;
pfImg.src=data.src;
pfImg.onload=function(){pfImg.style.opacity='1';pfBg.style.opacity='1';};
},400);
return;
}
var card=document.getElementById('card-photo');
if(!card) return;
if(!data||!data.src){card.style.display='none';return;}
card.style.display='';
var img=document.getElementById('photoImg');
var counter=document.getElementById('photoCounter');
var bar=document.getElementById('photoProgress');
img.style.opacity='0';
setTimeout(function(){
img.src=data.src;
img.onload=function(){img.style.opacity='1';};
},300);
if(data.counter) counter.textContent=data.counter;
bar.style.transition='none';
bar.style.width='0%';
requestAnimationFrame(function(){
requestAnimationFrame(function(){
bar.style.transition='width '+(data.interval||15)+'s linear';
bar.style.width='100%';
});
});
};
</script>
</body> </body>
</html> </html>
+21 -755
View File
@@ -1,762 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh"> <html lang="zh">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<style> <meta name="viewport" content="width=device-width, initial-scale=1.0">
:root { <script type="module" crossorigin>(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function s(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(r){if(r.ep)return;r.ep=!0;const i=s(r);fetch(r.href,i)}})();/**
--bg: #0f0f1a; * @vue/shared v3.5.34
--card-bg: rgba(255,255,255,0.04); * (c) 2018-present Yuxi (Evan) You and Vue contributors
--card-border: rgba(255,255,255,0.06); * @license MIT
--card-divider: rgba(255,255,255,0.04); **/function Qs(e){const t=Object.create(null);for(const s of e.split(","))t[s]=1;return s=>s in t}const G={},dt=[],Re=()=>{},nr=()=>!1,ps=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),hs=e=>e.startsWith("onUpdate:"),ie=Object.assign,en=(e,t)=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)},fi=Object.prototype.hasOwnProperty,H=(e,t)=>fi.call(e,t),R=Array.isArray,pt=e=>Ht(e)==="[object Map]",gs=e=>Ht(e)==="[object Set]",Sn=e=>Ht(e)==="[object Date]",F=e=>typeof e=="function",X=e=>typeof e=="string",ke=e=>typeof e=="symbol",U=e=>e!==null&&typeof e=="object",rr=e=>(U(e)||F(e))&&F(e.then)&&F(e.catch),ir=Object.prototype.toString,Ht=e=>ir.call(e),ui=e=>Ht(e).slice(8,-1),or=e=>Ht(e)==="[object Object]",tn=e=>X(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,At=Qs(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ms=e=>{const t=Object.create(null);return(s=>t[s]||(t[s]=e(s)))},ai=/-\w/g,ye=ms(e=>e.replace(ai,t=>t.slice(1).toUpperCase())),di=/\B([A-Z])/g,ct=ms(e=>e.replace(di,"-$1").toLowerCase()),lr=ms(e=>e.charAt(0).toUpperCase()+e.slice(1)),Es=ms(e=>e?`on${lr(e)}`:""),Me=(e,t)=>!Object.is(e,t),es=(e,...t)=>{for(let s=0;s<e.length;s++)e[s](...t)},cr=(e,t,s,n=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:n,value:s})},vs=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let Cn;const bs=()=>Cn||(Cn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ft(e){if(R(e)){const t={};for(let s=0;s<e.length;s++){const n=e[s],r=X(n)?mi(n):Ft(n);if(r)for(const i in r)t[i]=r[i]}return t}else if(X(e)||U(e))return e}const pi=/;(?![^(]*\))/g,hi=/:([^]+)/,gi=/\/\*[^]*?\*\//g;function mi(e){const t={};return e.replace(gi,"").split(pi).forEach(s=>{if(s){const n=s.split(hi);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function ze(e){let t="";if(X(e))t=e;else if(R(e))for(let s=0;s<e.length;s++){const n=ze(e[s]);n&&(t+=n+" ")}else if(U(e))for(const s in e)e[s]&&(t+=s+" ");return t.trim()}const vi="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",bi=Qs(vi);function fr(e){return!!e||e===""}function xi(e,t){if(e.length!==t.length)return!1;let s=!0;for(let n=0;s&&n<e.length;n++)s=Kt(e[n],t[n]);return s}function Kt(e,t){if(e===t)return!0;let s=Sn(e),n=Sn(t);if(s||n)return s&&n?e.getTime()===t.getTime():!1;if(s=ke(e),n=ke(t),s||n)return e===t;if(s=R(e),n=R(t),s||n)return s&&n?xi(e,t):!1;if(s=U(e),n=U(t),s||n){if(!s||!n)return!1;const r=Object.keys(e).length,i=Object.keys(t).length;if(r!==i)return!1;for(const o in e){const l=e.hasOwnProperty(o),f=t.hasOwnProperty(o);if(l&&!f||!l&&f||!Kt(e[o],t[o]))return!1}}return String(e)===String(t)}function yi(e,t){return e.findIndex(s=>Kt(s,t))}const ur=e=>!!(e&&e.__v_isRef===!0),ue=e=>X(e)?e:e==null?"":R(e)||U(e)&&(e.toString===ir||!F(e.toString))?ur(e)?ue(e.value):JSON.stringify(e,ar,2):String(e),ar=(e,t)=>ur(t)?ar(e,t.value):pt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((s,[n,r],i)=>(s[Is(n,i)+" =>"]=r,s),{})}:gs(t)?{[`Set(${t.size})`]:[...t.values()].map(s=>Is(s))}:ke(t)?Is(t):U(t)&&!R(t)&&!or(t)?String(t):t,Is=(e,t="")=>{var s;return ke(e)?`Symbol(${(s=e.description)!=null?s:t})`:e};/**
--text: #e0e0e0; * @vue/reactivity v3.5.34
--text-strong: #fff; * (c) 2018-present Yuxi (Evan) You and Vue contributors
--text-weak: rgba(255,255,255,0.25); * @license MIT
--text-muted: rgba(255,255,255,0.5); **/let re;class _i{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&re&&(re.active?(this.parent=re,this.index=(re.scopes||(re.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].pause();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,s;if(this.scopes)for(t=0,s=this.scopes.length;t<s;t++)this.scopes[t].resume();for(t=0,s=this.effects.length;t<s;t++)this.effects[t].resume()}}run(t){if(this._active){const s=re;try{return re=this,t()}finally{re=s}}}on(){++this._on===1&&(this.prevScope=re,re=this)}off(){if(this._on>0&&--this._on===0){if(re===this)re=this.prevScope;else{let t=re;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let s,n;for(s=0,n=this.effects.length;s<n;s++)this.effects[s].stop();for(this.effects.length=0,s=0,n=this.cleanups.length;s<n;s++)this.cleanups[s]();if(this.cleanups.length=0,this.scopes){for(s=0,n=this.scopes.length;s<n;s++)this.scopes[s].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}}function wi(){return re}let Y;const $s=new WeakSet;class dr{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,re&&(re.active?re.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,$s.has(this)&&($s.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||hr(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Tn(this),gr(this);const t=Y,s=_e;Y=this,_e=!0;try{return this.fn()}finally{mr(this),Y=t,_e=s,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)rn(t);this.deps=this.depsTail=void 0,Tn(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?$s.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Vs(this)&&this.run()}get dirty(){return Vs(this)}}let pr=0,Et,It;function hr(e,t=!1){if(e.flags|=8,t){e.next=It,It=e;return}e.next=Et,Et=e}function sn(){pr++}function nn(){if(--pr>0)return;if(It){let t=It;for(It=void 0;t;){const s=t.next;t.next=void 0,t.flags&=-9,t=s}}let e;for(;Et;){let t=Et;for(Et=void 0;t;){const s=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(n){e||(e=n)}t=s}}if(e)throw e}function gr(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function mr(e){let t,s=e.depsTail,n=s;for(;n;){const r=n.prevDep;n.version===-1?(n===s&&(s=r),rn(n),Si(n)):t=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=r}e.deps=t,e.depsTail=s}function Vs(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(vr(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function vr(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Dt)||(e.globalVersion=Dt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Vs(e))))return;e.flags|=2;const t=e.dep,s=Y,n=_e;Y=e,_e=!0;try{gr(e);const r=e.fn(e._value);(t.version===0||Me(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{Y=s,_e=n,mr(e),e.flags&=-3}}function rn(e,t=!1){const{dep:s,prevSub:n,nextSub:r}=e;if(n&&(n.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=n,e.nextSub=void 0),s.subs===e&&(s.subs=n,!n&&s.computed)){s.computed.flags&=-5;for(let i=s.computed.deps;i;i=i.nextDep)rn(i,!0)}!t&&!--s.sc&&s.map&&s.map.delete(s.key)}function Si(e){const{prevDep:t,nextDep:s}=e;t&&(t.nextDep=s,e.prevDep=void 0),s&&(s.prevDep=t,e.nextDep=void 0)}let _e=!0;const br=[];function He(){br.push(_e),_e=!1}function Ke(){const e=br.pop();_e=e===void 0?!0:e}function Tn(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const s=Y;Y=void 0;try{t()}finally{Y=s}}}let Dt=0;class Ci{constructor(t,s){this.sub=t,this.dep=s,this.version=s.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class on{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!Y||!_e||Y===this.computed)return;let s=this.activeLink;if(s===void 0||s.sub!==Y)s=this.activeLink=new Ci(Y,this),Y.deps?(s.prevDep=Y.depsTail,Y.depsTail.nextDep=s,Y.depsTail=s):Y.deps=Y.depsTail=s,xr(s);else if(s.version===-1&&(s.version=this.version,s.nextDep)){const n=s.nextDep;n.prevDep=s.prevDep,s.prevDep&&(s.prevDep.nextDep=n),s.prevDep=Y.depsTail,s.nextDep=void 0,Y.depsTail.nextDep=s,Y.depsTail=s,Y.deps===s&&(Y.deps=n)}return s}trigger(t){this.version++,Dt++,this.notify(t)}Line truncated
--input-bg: rgba(255,255,255,0.08); * @vue/runtime-core v3.5.34
--input-border: rgba(255,255,255,0.1); * (c) 2018-present Yuxi (Evan) You and Vue contributors
--input-border-focus: #4f8cff; * @license MIT
--accent: #4f8cff; **/function Ut(e,t,s,n){try{return n?e(...n):e()}catch(r){ys(r,t,s)}}function Fe(e,t,s,n){if(F(e)){const r=Ut(e,t,s,n);return r&&rr(r)&&r.catch(i=>{ys(i,t,s)}),r}if(R(e)){const r=[];for(let i=0;i<e.length;i++)r.push(Fe(e[i],t,s,n));return r}}function ys(e,t,s,n=!0){const r=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||G;if(t){let l=t.parent;const f=t.proxy,p=`https://vuejs.org/error-reference/#runtime-${s}`;for(;l;){const u=l.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,f,p)===!1)return}l=l.parent}if(i){He(),Ut(i,null,10,[e,f,p]),Ke();return}}Yi(e,s,r,n,o)}function Yi(e,t,s,n=!0,r=!1){if(r)throw e;console.error(e)}const ae=[];let Ee=-1;const ht=[];let qe=null,at=0;const Or=Promise.resolve();let rs=null;function Ar(e){const t=rs||Or;return e?t.then(this?e.bind(this):e):t}function Zi(e){let t=Ee+1,s=ae.length;for(;t<s;){const n=t+s>>>1,r=ae[n],i=Vt(r);i<e||i===e&&r.flags&2?t=n+1:s=n}return t}function un(e){if(!(e.flags&1)){const t=Vt(e),s=ae[ae.length-1];!s||!(e.flags&2)&&t>=Vt(s)?ae.push(e):ae.splice(Zi(t),0,e),e.flags|=1,Er()}}function Er(){rs||(rs=Or.then($r))}function Xi(e){R(e)?ht.push(...e):qe&&e.id===-1?qe.splice(at+1,0,e):e.flags&1||(ht.push(e),e.flags|=1),Er()}function On(e,t,s=Ee+1){for(;s<ae.length;s++){const n=ae[s];if(n&&n.flags&2){if(e&&n.id!==e.uid)continue;ae.splice(s,1),s--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function Ir(e){if(ht.length){const t=[...new Set(ht)].sort((s,n)=>Vt(s)-Vt(n));if(ht.length=0,qe){qe.push(...t);return}for(qe=t,at=0;at<qe.length;at++){const s=qe[at];s.flags&4&&(s.flags&=-2),s.flags&8||s(),s.flags&=-2}qe=null,at=0}}const Vt=e=>e.id==null?e.flags&2?-1:1/0:e.id;function $r(e){try{for(Ee=0;Ee<ae.length;Ee++){const t=ae[Ee];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Ut(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ee<ae.length;Ee++){const t=ae[Ee];t&&(t.flags&=-2)}Ee=-1,ae.length=0,Ir(),rs=null,(ae.length||ht.length)&&$r()}}let me=null,Mr=null;function is(e){const t=me;return me=e,Mr=e&&e.type.__scopeId||null,t}function Qi(e,t=me,s){if(!t||e._n)return e;const n=(...r)=>{n._d&&Nn(-1);const i=is(t);let o;try{o=e(...r)}finally{is(i),n._d&&Nn(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function lt(e,t){if(me===null)return e;const s=Cs(me),n=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[i,o,l,f=G]=t[r];i&&(F(i)&&(i={mounted:i,updated:i}),i.deep&&Le(o),n.push({dir:i,instance:s,value:o,oldValue:void 0,arg:l,modifiers:f}))}return e}function et(e,t,s,n){const r=e.dirs,i=t&&t.dirs;for(let o=0;o<r.length;o++){const l=r[o];i&&(l.oldValue=i[o].value);let f=l.dir[n];f&&(He(),Fe(f,s,8,[e.el,l,e,t]),Ke())}}function eo(e,t){if(de){let s=de.provides;const n=de.parent&&de.parent.provides;n===s&&(s=de.provides=Object.create(n)),s[e]=t}}function ts(e,t,s=!1){const n=tl();if(n||mt){let r=mt?mt._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(r&&e in r)return r[e];if(arguments.length>1)return s&&F(t)?t.call(n&&n.proxy):t}}const to=Symbol.for("v-scx"),so=()=>ts(to);function gt(e,t,s){return Rr(e,t,s)}function Rr(e,t,s=G){const{immediate:n,deep:r,flush:i,once:o}=s,l=ie({},s),f=t&&n||!t&&i!=="post";let p;if(Bt){if(i==="sync"){const O=so();p=O.__watcherHandles||(O.__watcherHandles=[])}else if(!f){const O=()=>{};return O.stop=Re,O.resume=Re,O.pause=Re,O}}const u=de;l.call=(O,L,k)=>Fe(O,u,L,k);let d=!1;i==="post"?l.scheduler=O=>{pe(O,u&&u.suspense)}:i!=="sync"&&(d=!0,l.scheduler=(O,L)=>{L?O():un(O)}),l.augmentJob=O=>{t&&(O.flags|=4),d&&(O.flags|=2,u&&(O.id=u.uid,O.i=u))};const y=zi(e,t,l);return Bt&&(p?p.push(y):f&&y()),y}function no(e,t,s){const n=this.proxy,r=X(e)?e.includes(".")?kr(n,e):()=>n[e]:e.bind(n,n);let i;F(t)?i=t:(i=t.handler,s=t);const o=Wt(this),l=Rr(r,i.bind(n),s);return o(),l}function kr(e,t){const s=t.split(".");return()=>{let n=e;for(let r=0;r<s.length&&n;r++)n=n[s[r]];return n}}const ro=Symbol("_vte"),io=e=>e.__isTeleport,oo=Symbol("_leaveCb");function an(e,t){e.shapeFlag&6&&e.component?(e.transition=t,an(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function ft(e,t){return F(e)?ie({name:e.name},t,{setup:e}):e}function Fr(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function An(e,t){let s;return!!((s=Object.getOwnPropertyDescriptor(e,t))&&!s.configurable)}const os=new WeakMap;function $t(e,t,s,n,r=!1){if(R(e)){e.forEach((k,$)=>$t(k,t&&(R(t)?t[$]:t),s,n,r));return}if(Mt(n)&&!r){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&$t(e,t,s,n.component.subTree);return}const i=n.shapeFlag&4?Cs(n.component):n.el,o=r?null:i,{i:l,r:f}=e,p=t&&t.r,u=l.refs===G?l.refs={}:l.refs,d=l.setupState,y=B(d),O=d===G?nr:k=>An(u,k)?!1:H(y,k),L=(k,$)=>!($&&An(u,$));if(p!=null&&p!==f){if(En(t),X(p))u[p]=null,O(p)&&(d[p]=null);else if(le(p)){const k=t;L(p,k.k)&&(p.value=null),k.k&&(u[k.k]=null)}}if(F(f))Ut(f,l,12,[o,u]);else{const k=X(f),$=le(f)Line truncated
--toggle-track: rgba(255,255,255,0.1); * @vue/runtime-dom v3.5.34
--toggle-thumb: rgba(255,255,255,0.5); * (c) 2018-present Yuxi (Evan) You and Vue contributors
--option-bg: #1a1a2e; * @license MIT
--footer-color: rgba(255,255,255,0.3); **/let zs;const Bn=typeof window<"u"&&window.trustedTypes;if(Bn)try{zs=Bn.createPolicy("vue",{createHTML:e=>e})}catch{}const oi=zs?e=>zs.createHTML(e):e=>e,cl="http://www.w3.org/2000/svg",fl="http://www.w3.org/1998/Math/MathML",je=typeof document<"u"?document:null,Hn=je&&je.createElement("template"),ul={insert:(e,t,s)=>{t.insertBefore(e,s||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,s,n)=>{const r=t==="svg"?je.createElementNS(cl,e):t==="mathml"?je.createElementNS(fl,e):s?je.createElement(e,{is:s}):je.createElement(e);return e==="select"&&n&&n.multiple!=null&&r.setAttribute("multiple",n.multiple),r},createText:e=>je.createTextNode(e),createComment:e=>je.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>je.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,s,n,r,i){const o=s?s.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),s),!(r===i||!(r=r.nextSibling)););else{Hn.innerHTML=oi(n==="svg"?`<svg>${e}</svg>`:n==="mathml"?`<math>${e}</math>`:e);const l=Hn.content;if(n==="svg"||n==="mathml"){const f=l.firstChild;for(;f.firstChild;)l.appendChild(f.firstChild);l.removeChild(f)}t.insertBefore(l,s)}return[o?o.nextSibling:t.firstChild,s?s.previousSibling:t.lastChild]}},al=Symbol("_vtc");function dl(e,t,s){const n=e[al];n&&(t=(t?[t,...n]:[...n]).join(" ")),t==null?e.removeAttribute("class"):s?e.setAttribute("class",t):e.className=t}const Kn=Symbol("_vod"),pl=Symbol("_vsh"),hl=Symbol(""),gl=/(?:^|;)\s*display\s*:/;function ml(e,t,s){const n=e.style,r=X(s);let i=!1;if(s&&!r){if(t)if(X(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();s[l]==null&&Ot(n,l,"")}else for(const o in t)s[o]==null&&Ot(n,o,"");for(const o in s){o==="display"&&(i=!0);const l=s[o];l!=null?bl(e,o,!X(t)&&t?t[o]:void 0,l)||Ot(n,o,l):Ot(n,o,"")}}else if(r){if(t!==s){const o=n[hl];o&&(s+=";"+o),n.cssText=s,i=gl.test(s)}}else t&&e.removeAttribute("style");Kn in e&&(e[Kn]=i?n.display:"",e[pl]&&(n.display="none"))}const Un=/\s*!important$/;function Ot(e,t,s){if(R(s))s.forEach(n=>Ot(e,t,n));else if(s==null&&(s=""),t.startsWith("--"))e.setProperty(t,s);else{const n=vl(e,t);Un.test(s)?e.setProperty(ct(n),s.replace(Un,""),"important"):e[n]=s}}const Wn=["Webkit","Moz","ms"],js={};function vl(e,t){const s=js[t];if(s)return s;let n=ye(t);if(n!=="filter"&&n in e)return js[t]=n;n=lr(n);for(let r=0;r<Wn.length;r++){const i=Wn[r]+n;if(i in e)return js[t]=i}return t}function bl(e,t,s,n){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&X(n)&&s===n}const Jn="http://www.w3.org/1999/xlink";function Gn(e,t,s,n,r,i=bi(t)){n&&t.startsWith("xlink:")?s==null?e.removeAttributeNS(Jn,t.slice(6,t.length)):e.setAttributeNS(Jn,t,s):s==null||i&&!fr(s)?e.removeAttribute(t):e.setAttribute(t,i?"":ke(s)?String(s):s)}function qn(e,t,s,n,r){if(t==="innerHTML"||t==="textContent"){s!=null&&(e[t]=t==="innerHTML"?oi(s):s);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const l=i==="OPTION"?e.getAttribute("value")||"":e.value,f=s==null?e.type==="checkbox"?"on":"":String(s);(l!==f||!("_value"in e))&&(e.value=f),s==null&&e.removeAttribute(t),e._value=s;return}let o=!1;if(s===""||s==null){const l=typeof e[t];l==="boolean"?s=fr(s):s==null&&l==="string"?(s="",o=!0):l==="number"&&(s=0,o=!0)}try{e[t]=s}catch{}o&&e.removeAttribute(r||t)}function nt(e,t,s,n){e.addEventListener(t,s,n)}function xl(e,t,s,n){e.removeEventListener(t,s,n)}const zn=Symbol("_vei");function yl(e,t,s,n,r=null){const i=e[zn]||(e[zn]={}),o=i[t];if(n&&o)o.value=n;else{const[l,f]=_l(t);if(n){const p=i[t]=Cl(n,r);nt(e,l,p,f)}else o&&(xl(e,l,o,f),i[t]=void 0)}}const Yn=/(?:Once|Passive|Capture)$/;function _l(e){let t;if(Yn.test(e)){t={};let n;for(;n=e.match(Yn);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ct(e.slice(2)),t]}let Ns=0;const wl=Promise.resolve(),Sl=()=>Ns||(wl.then(()=>Ns=0),Ns=Date.now());function Cl(e,t){const s=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=s.attached)return;Fe(Tl(n,s.value),t,5,[n])};return s.value=e,s.attached=Sl(),s}function Tl(e,t){if(R(t)){const s=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{s.call(e),e._stopped=!0},t.map(n=>r=>!r._stopped&&n&&n(r))}else return t}const Zn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Pl=(e,t,s,n,r,i)=>{const o=r==="svg";t==="class"?dl(e,n,o):t==="style"?ml(e,s,n):ps(t)?hs(t)||yl(e,t,s,n,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Ol(e,t,n,o))?(qn(e,t,n),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Gn(e,t,n,o,i,t!=="value")):e._isVueCE&&(Al(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!X(n)))?qn(e,ye(t),n,i,t):(t==="true-value"?e._trueValue=n:t==="false-value"&&(e._falseValue=n),Gn(e,t,n,o))};function Ol(e,t,s,n){if(n)return!!(t==="innerHTLine truncated
} <style rel="stylesheet" crossorigin>.switch[data-v-d838d577]{position:relative;width:36px;height:20px;flex-shrink:0}.switch input[data-v-d838d577]{display:none}.switch .track[data-v-d838d577]{position:absolute;inset:0;background:var(--toggle-track);border-radius:10px;cursor:pointer;transition:background .2s}.switch .thumb[data-v-d838d577]{position:absolute;width:14px;height:14px;top:3px;left:3px;background:var(--toggle-thumb);border-radius:50%;transition:all .2s;pointer-events:none}.switch input:checked+.track[data-v-d838d577]{background:var(--accent)}.switch input:checked+.track .thumb[data-v-d838d577]{transform:translate(16px);background:var(--text-strong)}.btn[data-v-c301f1ac]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:11px;padding:4px 10px;font-family:inherit;cursor:pointer;transition:background .15s;white-space:nowrap}.btn[data-v-c301f1ac]:hover{background:var(--card-border)}.btn-sm[data-v-c301f1ac]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:10px;padding:3px 8px;font-family:inherit;cursor:pointer;white-space:nowrap}.btn-sm[data-v-c301f1ac]:hover{background:var(--card-border)}.color-swatch[data-v-c301f1ac]{width:28px;height:28px;border-radius:6px;cursor:pointer;border:2px solid transparent;transition:border-color .15s;position:relative}.color-swatch[data-v-c301f1ac]:hover{border-color:var(--accent)}.color-swatch .del[data-v-c301f1ac]{display:none;position:absolute;top:-6px;right:-6px;width:14px;height:14px;border-radius:50%;background:#e53e3e;color:#fff;font-size:9px;line-height:14px;text-align:center;cursor:pointer}.color-swatch:hover .del[data-v-c301f1ac]{display:block}.btn[data-v-b7fb61bb]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:11px;padding:4px 10px;font-family:inherit;cursor:pointer;transition:background .15s;white-space:nowrap}.btn[data-v-b7fb61bb]:hover{background:var(--card-border)}.btn-sm[data-v-b7fb61bb]{background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;color:var(--text);font-size:10px;padding:3px 8px;font-family:inherit;cursor:pointer;white-space:nowrap}.btn-sm[data-v-b7fb61bb]:hover{background:var(--card-border)}.city-picker[data-v-f6ff8e37]{position:relative;background:var(--input-bg);border:1px solid var(--input-border);border-radius:6px;padding:4px 24px 4px 8px;cursor:pointer;font-size:11px;min-width:140px;max-width:180px}.city-picker[data-v-f6ff8e37]:focus,.city-picker.open[data-v-f6ff8e37]{border-color:var(--input-border-focus)}.city-panel[data-v-f6ff8e37]{display:none;position:absolute;right:-1px;bottom:calc(100% + 4px);background:var(--option-bg);border:1px solid var(--input-border);border-radius:8px;box-shadow:0 8px 24px #00000040;z-index:1000;width:260px;height:200px;overflow:hidden}.city-picker.open .city-panel[data-v-f6ff8e37]{display:flex}.city-col[data-v-f6ff8e37]{flex:1;overflow-y:auto;border-right:1px solid var(--card-divider)}.city-col[data-v-f6ff8e37]:last-child{border-right:none}.city-col div[data-v-f6ff8e37]{padding:5px 10px;font-size:11px;color:var(--text);cursor:pointer;white-space:nowrap}.city-col div[data-v-f6ff8e37]:hover{background:var(--input-bg)}.city-col div.active[data-v-f6ff8e37]{color:var(--accent);font-weight:600}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-oLine truncated
.light {
--bg: #f5f5f5;
--card-bg: rgba(0,0,0,0.03);
--card-border: rgba(0,0,0,0.08);
--card-divider: rgba(0,0,0,0.05);
--text: #333;
--text-strong: #111;
--text-weak: rgba(0,0,0,0.35);
--text-muted: rgba(0,0,0,0.55);
--input-bg: rgba(0,0,0,0.04);
--input-border: rgba(0,0,0,0.12);
--input-border-focus: #2b6cb0;
--accent: #2b6cb0;
--toggle-track: rgba(0,0,0,0.12);
--toggle-thumb: rgba(0,0,0,0.45);
--option-bg: #fff;
--footer-color: rgba(0,0,0,0.35);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
background: var(--bg);
color: var(--text);
padding: 16px 18px;
user-select: none;
-webkit-font-smoothing: antialiased;
overflow-y: auto;
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }
.light ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
.light ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }
.header { margin-bottom: 14px; }
.header h1 { font-size: 16px; font-weight: 600; color: var(--text-strong); }
.header p { font-size: 11px; color: var(--text-weak); margin-top: 2px; }
.section { margin-bottom: 12px; }
.section-label {
font-size: 10px; font-weight: 600; color: var(--text-weak);
text-transform: uppercase; letter-spacing: 1.5px;
margin-bottom: 4px; padding-left: 2px;
}
.card {
background: var(--card-bg);
border: 1px solid var(--card-border);
border-radius: 8px;
}
.item {
display: flex; justify-content: space-between; align-items: center;
padding: 8px 14px;
}
.item + .item { border-top: 1px solid var(--card-divider); }
.item-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.item-desc { font-size: 10px; color: var(--text-weak); margin-top: 1px; }
.item-sub { padding-left: 32px; }
/* Toggle */
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.switch .track {
position: absolute; inset: 0;
background: var(--toggle-track);
border-radius: 10px; cursor: pointer; transition: background 0.2s;
}
.switch .thumb {
position: absolute; width: 14px; height: 14px; top: 3px; left: 3px;
background: var(--toggle-thumb);
border-radius: 50%; transition: all 0.2s; pointer-events: none;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: var(--text-strong); }
/* Select */
select {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 3px 6px;
font-family: inherit; cursor: pointer; outline: none;
min-width: 80px; max-width: 160px;
}
select:focus { border-color: var(--input-border-focus); }
select option { background: var(--option-bg); color: var(--text); }
/* Button */
.btn {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 10px;
font-family: inherit; cursor: pointer; transition: background 0.15s; white-space: nowrap;
}
.btn:hover { background: var(--card-border); }
.btn:active { background: var(--input-bg); }
.btn.active { background: var(--accent); border-color: var(--accent); color: var(--text-strong); }
.btn-sm { padding: 3px 8px; font-size: 10px; }
.btn-group { display: flex; gap: 4px; }
.radio-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.bing-nav { display: flex; gap: 4px; align-items: center; }
.wp-type-section { display: none; }
.wp-type-section.visible { display: block; }
input[type="text"] {
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 8px;
font-family: inherit; outline: none; width: 140px;
}
input[type="text"]:focus { border-color: var(--input-border-focus); }
/* City Picker */
.city-picker {
position: relative;
background: var(--input-bg); border: 1px solid var(--input-border);
border-radius: 6px; padding: 4px 24px 4px 8px; cursor: pointer;
font-size: 11px; min-width: 140px; max-width: 180px;
}
.city-picker:focus, .city-picker.open { border-color: var(--input-border-focus); }
.city-picker-text { color: var(--text); }
.city-picker-arrow {
position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
color: var(--text-weak); font-size: 10px; pointer-events: none;
}
.city-panel {
display: none; position: absolute; right: -1px; bottom: calc(100% + 4px);
background: var(--option-bg); border: 1px solid var(--input-border);
border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
z-index: 1000; width: 260px; height: 200px; overflow: hidden;
}
.city-picker.open .city-panel { display: flex; }
.city-col {
flex: 1; overflow-y: auto; border-right: 1px solid var(--card-divider);
}
.city-col:last-child { border-right: none; }
.city-col div {
padding: 5px 10px; font-size: 11px; color: var(--text); cursor: pointer;
white-space: nowrap;
}
.city-col div:hover { background: var(--input-bg); }
.city-col div.active { color: var(--accent); font-weight: 600; }
/* Saved colors */
.color-swatch {
width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
border: 2px solid transparent; transition: border-color 0.15s; position: relative;
}
.color-swatch:hover { border-color: var(--accent); }
.color-swatch .del {
display: none; position: absolute; top: -6px; right: -6px;
width: 14px; height: 14px; border-radius: 50%;
background: #e53e3e; color: #fff; font-size: 9px; line-height: 14px;
text-align: center; cursor: pointer;
}
.color-swatch:hover .del { display: block; }
.footer {
text-align: center; font-size: 11px; color: var(--footer-color); margin-top: 12px;
padding: 6px 0; letter-spacing: 0.5px;
}
</style>
</head> </head>
<body> <body>
<div class="header"> <div id="app"></div>
<h1>桌面设置</h1>
<p>壁纸 · 布局 · 信息显示</p>
</div>
<!-- 显示控制 -->
<div class="section">
<div class="section-label">显示控制</div>
<div class="card">
<div class="item">
<div><div class="item-label">开机启动</div><div class="item-desc">系统启动时自动运行</div></div>
<label class="switch"><input type="checkbox" id="autoStart"><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">显示壁纸</div></div>
<label class="switch"><input type="checkbox" id="wallpaper" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">时间日期</div></div>
<label class="switch"><input type="checkbox" id="time" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item item-sub">
<div><div class="item-label">显示秒</div></div>
<label class="switch"><input type="checkbox" id="showSeconds" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">天气信息</div></div>
<label class="switch"><input type="checkbox" id="weather" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">星座运势</div></div>
<label class="switch"><input type="checkbox" id="zodiacCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">知识卡片</div></div>
<label class="switch"><input type="checkbox" id="knowledgeCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">AI 资讯</div></div>
<label class="switch"><input type="checkbox" id="ainewsCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
</div>
</div>
<!-- 壁纸类型 -->
<div class="section">
<div class="section-label">壁纸类型</div>
<div class="card">
<div class="item">
<div class="item-label">类型选择</div>
<div class="radio-tabs" id="wpTypeTabs">
<button class="btn" data-type="theme">主题</button>
<button class="btn" data-type="image">本地图片</button>
<button class="btn" data-type="bing">Bing</button>
<button class="btn" data-type="color">纯色/渐变</button>
</div>
</div>
</div>
</div>
<!-- 主题选择 -->
<div class="section wp-type-section" id="sec-theme">
<div class="section-label">壁纸主题</div>
<div class="card">
<div class="item">
<div class="item-label">选择主题</div>
<select id="themeSelect"></select>
</div>
<div class="item" id="textInputRow" style="display:none">
<div class="item-label">自定义文字</div>
<input type="text" id="wallpaperText" placeholder="输入显示文字">
</div>
</div>
</div>
<!-- 本地图片 -->
<div class="section wp-type-section" id="sec-image">
<div class="section-label">本地图片</div>
<div class="card">
<div class="item">
<div class="item-desc" id="imagePathDisplay">未选择图片</div>
<button class="btn" id="btnPickImage">选择图片</button>
</div>
</div>
</div>
<!-- Bing -->
<div class="section wp-type-section" id="sec-bing">
<div class="section-label">Bing 每日壁纸</div>
<div class="card">
<div class="item">
<div style="display:flex;align-items:center;gap:8px;flex:1;min-width:0">
<img id="bingPreview" style="width:64px;height:40px;object-fit:cover;border-radius:4px;flex-shrink:0;display:none">
<div style="min-width:0;overflow:hidden">
<div class="item-label" id="bingCopyright" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis">Bing 每日壁纸</div>
<div class="item-desc" id="bingIdx"></div>
</div>
</div>
<div class="bing-nav" style="flex-shrink:0">
<button class="btn btn-sm" id="btnBingPrev">◀</button>
<button class="btn btn-sm" id="btnBingNext">▶</button>
<button class="btn btn-sm" id="btnBingFav">☆</button>
</div>
</div>
<div class="item">
<div><div class="item-label">定时切换</div><div class="item-desc">每小时自动切换壁纸</div></div>
<label class="switch"><input type="checkbox" id="bingAutoRefresh"><span class="track"><span class="thumb"></span></span></label>
</div>
</div>
<div id="bingFavSection" style="display:none;margin-top:6px">
<div class="section-label">收藏列表</div>
<div class="card" id="bingFavList"></div>
</div>
</div>
<!-- 纯色/渐变 -->
<div class="section wp-type-section" id="sec-color">
<div class="section-label">纯色 / 渐变</div>
<div class="card">
<div class="item">
<div class="item-label">选择颜色</div>
<div class="btn-group">
<button class="btn" id="btnSolidColor">纯色</button>
<button class="btn" id="btnGradientColor">渐变</button>
</div>
</div>
<div class="item" id="currentColorRow" style="display:none">
<div class="item-label">当前颜色</div>
<div style="display:flex;align-items:center;gap:6px">
<span id="currentColorPreview" style="display:inline-block;width:24px;height:16px;border-radius:3px;border:1px solid var(--input-border)"></span>
<button class="btn btn-sm" id="btnSaveColor">收藏</button>
</div>
</div>
</div>
<div id="savedColorsSection" style="display:none;margin-top:6px">
<div class="card" id="savedColorsGrid" style="padding:8px 12px;display:flex;flex-wrap:wrap;gap:6px">
</div>
</div>
</div>
<!-- 布局 -->
<div class="section">
<div class="section-label">布局</div>
<div class="card">
<div class="item">
<div class="item-label">信息布局</div>
<select id="layout">
<option value="single">合并卡片</option>
<option value="multi">独立卡片</option>
</select>
</div>
</div>
</div>
<!-- 相册 -->
<div class="section">
<div class="section-label">相册</div>
<div class="card">
<div class="item">
<div><div class="item-label">相册展示</div></div>
<label class="switch"><input type="checkbox" id="photoCard" checked><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div><div class="item-label">电子相册模式</div><div class="item-desc">照片铺满整个壁纸</div></div>
<label class="switch"><input type="checkbox" id="photoFrameMode"><span class="track"><span class="thumb"></span></span></label>
</div>
<div class="item">
<div class="item-desc" id="photoDirDisplay">未选择目录</div>
<div class="btn-group">
<button class="btn" id="btnPickPhotoDir">选择目录</button>
<button class="btn btn-sm" id="btnClearPhotoDir" style="display:none">清除</button>
</div>
</div>
<div class="item">
<div class="item-label">切换间隔</div>
<select id="photoInterval">
<option value="5">5 秒</option>
<option value="10">10 秒</option>
<option value="15" selected>15 秒</option>
<option value="20">20 秒</option>
<option value="30">30 秒</option>
<option value="60">60 秒</option>
</select>
</div>
</div>
</div>
<!-- 星座 + 城市 -->
<div class="section">
<div class="section-label">个性化</div>
<div class="card">
<div class="item">
<div class="item-label">我的星座</div>
<select id="zodiacSelect">
<option>白羊座</option><option>金牛座</option><option>双子座</option>
<option>巨蟹座</option><option>狮子座</option><option>处女座</option>
<option>天秤座</option><option>天蝎座</option><option>射手座</option>
<option>摩羯座</option><option>水瓶座</option><option>双鱼座</option>
</select>
</div>
<div class="item">
<div><div class="item-label">知识关键字</div><div class="item-desc">AI 将根据关键字生成知识小卡片</div></div>
<input type="text" id="knowledgeKeyword" placeholder="如: 历史、科学、冷知识">
</div>
<div class="item">
<div><div class="item-label">知识提示词</div><div class="item-desc">补充风格或方向,系统会保证内容密度</div></div>
<input type="text" id="knowledgePrompt" placeholder="如: 偏实践、给出判断标准">
</div>
<div class="item" style="position:relative">
<div class="item-label">天气城市</div>
<div class="city-picker" id="cityPicker" tabindex="0">
<span class="city-picker-text" id="cityPickerText">未选择</span>
<span class="city-picker-arrow">▾</span>
<div class="city-panel" id="cityPanel">
<div class="city-col" id="provCol"></div>
<div class="city-col" id="cityCol"></div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">u-desktop v1.0</div>
<script>
var toggleKeys = ['autoStart', 'wallpaper', 'time', 'showSeconds', 'weather', 'zodiacCard', 'knowledgeCard', 'ainewsCard', 'photoCard', 'photoFrameMode'];
var initDone = false;
function sendToggle() {
if (!initDone) return;
var data = {};
toggleKeys.forEach(function(k) { data[k] = document.getElementById(k).checked; });
if (window.saveToggles) window.saveToggles(JSON.stringify(data));
}
toggleKeys.forEach(function(k) {
document.getElementById(k).addEventListener('change', sendToggle);
});
document.getElementById('layout').addEventListener('change', function() {
if (window.saveLayout) window.saveLayout(this.value);
});
document.getElementById('zodiacSelect').addEventListener('change', function() {
if (window.saveZodiac) window.saveZodiac(this.value);
});
var kwTimer = null;
document.getElementById('knowledgeKeyword').addEventListener('input', function() {
clearTimeout(kwTimer);
var val = this.value;
kwTimer = setTimeout(function() {
if (window.saveKnowledgeKeyword) window.saveKnowledgeKeyword(val);
}, 500);
});
var kpTimer = null;
document.getElementById('knowledgePrompt').addEventListener('input', function() {
clearTimeout(kpTimer);
var val = this.value;
kpTimer = setTimeout(function() {
if (window.saveKnowledgePrompt) window.saveKnowledgePrompt(val);
}, 500);
});
// City picker
var cityMap = {};
var selectedCityId = '';
var selectedCityName = '';
var picker = document.getElementById('cityPicker');
var pickerText = document.getElementById('cityPickerText');
var provCol = document.getElementById('provCol');
var cityCol = document.getElementById('cityCol');
var activeProv = '';
function renderProvinces(provinces) {
provCol.innerHTML = '';
provinces.forEach(function(p) {
var div = document.createElement('div');
div.textContent = p;
if (p === activeProv) div.className = 'active';
div.addEventListener('click', function(e) {
e.stopPropagation();
activeProv = p;
renderProvinces(provinces);
renderCities(p);
});
provCol.appendChild(div);
});
}
function renderCities(prov) {
cityCol.innerHTML = '';
var list = cityMap[prov] || [];
list.forEach(function(c) {
var div = document.createElement('div');
div.textContent = c.name;
if (c.id === selectedCityId) div.className = 'active';
div.addEventListener('click', function(e) {
e.stopPropagation();
selectedCityId = c.id;
selectedCityName = c.name;
pickerText.textContent = activeProv + ' · ' + c.name;
picker.classList.remove('open');
renderCities(prov);
if (window.saveCity) window.saveCity(c.id);
});
cityCol.appendChild(div);
});
}
picker.addEventListener('click', function(e) {
e.stopPropagation();
this.classList.toggle('open');
this.focus();
});
document.addEventListener('click', function(e) {
if (!picker.contains(e.target)) picker.classList.remove('open');
});
document.getElementById('themeSelect').addEventListener('change', function() {
if (window.saveWallpaperType) window.saveWallpaperType('theme', this.value);
document.getElementById('textInputRow').style.display = this.value === 'text' ? 'flex' : 'none';
});
document.getElementById('btnPickPhotoDir').addEventListener('click', function() {
if (!window.pickPhotoDir) return;
window.pickPhotoDir().then(function(dir) {
if (dir) {
document.getElementById('photoDirDisplay').textContent = dir;
document.getElementById('btnClearPhotoDir').style.display = '';
}
});
});
document.getElementById('btnClearPhotoDir').addEventListener('click', function() {
if (!window.clearPhotoDir) return;
window.clearPhotoDir().then(function() {
document.getElementById('photoDirDisplay').textContent = '未选择目录';
document.getElementById('btnClearPhotoDir').style.display = 'none';
});
});
document.getElementById('photoInterval').addEventListener('change', function() {
if (window.savePhotoInterval) window.savePhotoInterval(parseInt(this.value));
});
var textTimer = null;
document.getElementById('wallpaperText').addEventListener('input', function() {
clearTimeout(textTimer);
var val = this.value;
textTimer = setTimeout(function() {
if (window.saveWallpaperText) window.saveWallpaperText(val);
}, 500);
});
var wpTypeTabs = document.querySelectorAll('#wpTypeTabs .btn');
var currentWpType = '';
function setWpType(type) {
wpTypeTabs.forEach(function(b) { b.classList.toggle('active', b.dataset.type === type); });
document.querySelectorAll('.wp-type-section').forEach(function(s) { s.classList.remove('visible'); });
var sec = document.getElementById('sec-' + type);
if (sec) sec.classList.add('visible');
if (initDone && type === 'bing' && currentWpType !== 'bing') {
if (window.enableBing) window.enableBing();
}
currentWpType = type;
}
wpTypeTabs.forEach(function(b) {
b.addEventListener('click', function() { setWpType(b.dataset.type); });
});
document.getElementById('btnPickImage').addEventListener('click', function() {
if (!window.pickLocalImage) return;
window.pickLocalImage().then(function(path) {
if (path) document.getElementById('imagePathDisplay').textContent = path;
});
});
function updateBingUI(stateJson) {
if (!stateJson) return;
var s = JSON.parse(stateJson);
document.getElementById('btnBingFav').textContent = s.label;
document.getElementById('bingCopyright').textContent = s.copyright || 'Bing 每日壁纸';
document.getElementById('bingIdx').textContent = (s.total > 0) ? ((s.idx + 1) + ' / ' + s.total) : '';
// load preview thumbnail
if (s.filename && window.bingThumbDataURI) {
var preview = document.getElementById('bingPreview');
window.bingThumbDataURI(s.filename).then(function(uri) {
if (uri) { preview.src = uri; preview.style.display = 'block'; }
});
}
}
function loadBingFavorites() {
if (!window.getBingFavorites) return;
window.getBingFavorites().then(function(json) {
var favs = JSON.parse(json);
var sec = document.getElementById('bingFavSection');
var list = document.getElementById('bingFavList');
list.innerHTML = '';
if (!favs || favs.length === 0) { sec.style.display = 'none'; return; }
sec.style.display = 'block';
list.style.cssText = 'padding:8px 12px;display:flex;flex-wrap:wrap;gap:6px';
favs.forEach(function(f) {
var img = document.createElement('img');
img.style.cssText = 'width:64px;height:40px;object-fit:cover;border-radius:4px;cursor:pointer;border:2px solid transparent;transition:border-color 0.15s';
img.title = f.copyright + ' (' + f.date + ')';
img.addEventListener('click', function() {
if (window.bingSetByIdx) window.bingSetByIdx(f.idx).then(function(s) { updateBingUI(s); });
});
img.addEventListener('mouseenter', function() { this.style.borderColor = 'var(--accent)'; });
img.addEventListener('mouseleave', function() { this.style.borderColor = 'transparent'; });
list.appendChild(img);
if (window.bingThumbDataURI) {
window.bingThumbDataURI(f.filename).then(function(uri) {
if (uri) img.src = uri;
});
}
});
});
}
document.getElementById('btnBingPrev').addEventListener('click', function() {
if (window.bingPrev) window.bingPrev().then(function(s) { updateBingUI(s); });
});
document.getElementById('btnBingNext').addEventListener('click', function() {
if (window.bingNext) window.bingNext().then(function(s) { updateBingUI(s); });
});
document.getElementById('btnBingFav').addEventListener('click', function() {
if (window.bingToggleFavorite) {
window.bingToggleFavorite().then(function(s) { updateBingUI(s); loadBingFavorites(); });
}
});
document.getElementById('bingAutoRefresh').addEventListener('change', function() {
if (window.saveBingAutoRefresh) window.saveBingAutoRefresh(this.checked);
});
document.getElementById('btnSolidColor').addEventListener('click', function() {
if (window.pickSolidColor) {
window.pickSolidColor().then(function(c) {
if (c) { currentColor1 = c; currentColor2 = ''; currentGradient = false; updateColorPreview(); }
});
}
});
document.getElementById('btnGradientColor').addEventListener('click', function() {
if (window.pickGradientColor) {
window.pickGradientColor().then(function(res) {
if (res) {
var parts = res.split(',');
currentColor1 = parts[0]; currentColor2 = parts[1] || ''; currentGradient = true;
updateColorPreview();
}
});
}
});
// Color favorites
var currentColor1 = '', currentColor2 = '', currentGradient = false;
var savedColors = [];
function updateColorPreview() {
var row = document.getElementById('currentColorRow');
var preview = document.getElementById('currentColorPreview');
if (!currentColor1) { row.style.display = 'none'; return; }
row.style.display = 'flex';
if (currentGradient && currentColor2) {
preview.style.background = 'linear-gradient(135deg,' + currentColor1 + ',' + currentColor2 + ')';
} else {
preview.style.background = currentColor1;
}
}
function renderSavedColors() {
var sec = document.getElementById('savedColorsSection');
var grid = document.getElementById('savedColorsGrid');
grid.innerHTML = '';
if (!savedColors || savedColors.length === 0) { sec.style.display = 'none'; return; }
sec.style.display = 'block';
savedColors.forEach(function(sc, idx) {
var swatch = document.createElement('div');
swatch.className = 'color-swatch';
if (sc.gradient && sc.color2) {
swatch.style.background = 'linear-gradient(135deg,' + sc.color1 + ',' + sc.color2 + ')';
} else {
swatch.style.background = sc.color1;
}
var del = document.createElement('span');
del.className = 'del'; del.textContent = 'x';
del.addEventListener('click', function(e) {
e.stopPropagation();
if (window.removeSavedColor) window.removeSavedColor(idx).then(function() {
savedColors.splice(idx, 1);
renderSavedColors();
});
});
swatch.appendChild(del);
swatch.addEventListener('click', function() {
if (window.applySavedColor) window.applySavedColor(idx);
currentColor1 = sc.color1; currentColor2 = sc.color2; currentGradient = sc.gradient;
updateColorPreview();
});
grid.appendChild(swatch);
});
}
document.getElementById('btnSaveColor').addEventListener('click', function() {
if (!currentColor1) return;
if (window.addSavedColor) window.addSavedColor(currentColor1, currentColor2, currentGradient).then(function() {
savedColors.push({color1: currentColor1, color2: currentColor2, gradient: currentGradient});
renderSavedColors();
});
});
if (window.loadAllSettings) {
window.loadAllSettings().then(function(raw) {
var s = JSON.parse(raw);
// Apply system theme
if (s.lightTheme) {
document.documentElement.className = 'light';
}
// Province-city cascade
cityMap = s.citiesByProv || {};
selectedCityId = s.city || '';
activeProv = '';
if (s.provinces && s.provinces.length) {
for (var p in cityMap) {
for (var ci = 0; ci < cityMap[p].length; ci++) {
if (cityMap[p][ci].id === selectedCityId) { activeProv = p; selectedCityName = cityMap[p][ci].name; break; }
}
if (activeProv) break;
}
renderProvinces(s.provinces);
if (activeProv) renderCities(activeProv);
if (activeProv && selectedCityName) {
pickerText.textContent = activeProv + ' · ' + selectedCityName;
}
}
if (s.themes && s.themes.length) {
var themeSel = document.getElementById('themeSelect');
s.themes.forEach(function(t) {
var opt = document.createElement('option');
opt.value = t.value;
opt.textContent = t.label;
themeSel.appendChild(opt);
});
}
toggleKeys.forEach(function(k) {
if (s[k] !== undefined) document.getElementById(k).checked = s[k];
});
if (s.layout) document.getElementById('layout').value = s.layout;
if (s.zodiac) document.getElementById('zodiacSelect').value = s.zodiac;
if (s.theme) document.getElementById('themeSelect').value = s.theme;
if (s.wallpaperText) document.getElementById('wallpaperText').value = s.wallpaperText;
if (s.imagePath) document.getElementById('imagePathDisplay').textContent = s.imagePath;
if (s.knowledgeKeyword) document.getElementById('knowledgeKeyword').value = s.knowledgeKeyword;
if (s.knowledgePrompt) document.getElementById('knowledgePrompt').value = s.knowledgePrompt;
if (s.theme === 'text') document.getElementById('textInputRow').style.display = 'flex';
// Photo state
if (s.photoDir) {
document.getElementById('photoDirDisplay').textContent = s.photoDir;
document.getElementById('btnClearPhotoDir').style.display = '';
}
if (s.photoInterval) document.getElementById('photoInterval').value = s.photoInterval;
// Color state
if (s.color1) { currentColor1 = s.color1; currentColor2 = s.color2 || ''; currentGradient = s.colorGradient || false; }
if (s.wallpaperType === 'color') updateColorPreview();
savedColors = s.savedColors || [];
renderSavedColors();
setWpType(s.wallpaperType || 'theme');
// Bing state
if (s.wallpaperType === 'bing' && window.getBingInfo) {
window.getBingInfo().then(function(si) { updateBingUI(si); });
}
if (s.wallpaperType === 'bing') loadBingFavorites();
if (s.bingAutoRefresh !== undefined) document.getElementById('bingAutoRefresh').checked = s.bingAutoRefresh;
// resize window to fit content
setTimeout(function() {
var el = document.documentElement;
var cw = el.scrollWidth;
var ch = el.scrollHeight + 8;
if (window.resizeToFit) window.resizeToFit(cw, ch);
}, 100);
initDone = true;
});
}
</script>
</body> </body>
</html> </html>