主题与字号从页面顶栏搬进设置页的「外观」,顶部导航加上预设入口。

顶栏那套汉堡菜单在每页都要单独挂载、样式也重复,收进设置页后只剩一处改;顺手把「整组都没有曾用型号」的配置组整组收起,不再留空卡片。
This commit is contained in:
2026-10-26 01:09:43 +08:00
parent f3303038fe
commit e2413b0677
11 changed files with 251 additions and 462 deletions
+2 -55
View File
@@ -23,17 +23,7 @@ import {
isModuleOpeningWaiting,
renderQuestionsCard,
} from "./questions-ui.js";
import {
applyColorTheme,
bumpUiFontScale,
getStoredColorTheme,
getStoredUiFontScale,
initColorTheme,
initUiFontScale,
themeById,
UI_FONT_SCALE_MAX,
UI_FONT_SCALE_MIN,
} from "./theme.js";
import { initColorTheme, initUiFontScale } from "./theme.js";
import {
applyMarkdownRender,
initMarkdownRender,
@@ -1366,29 +1356,6 @@ function syncMarkdownMenuUi() {
});
}
function syncThemeMenuUi() {
const colorId = document.documentElement.getAttribute("data-color-theme") || getStoredColorTheme();
const percent = getStoredUiFontScale();
const colorMeta = themeById(colorId);
const sum = $("theme-menu-sum");
if (sum) {
sum.title = `${colorMeta.name} · 字号 ${percent}`;
if (!sum.querySelector(".hamburger-icon")) {
sum.innerHTML = `<span class="hamburger-icon" aria-hidden="true"></span>`;
}
}
document.querySelectorAll("[data-color-theme].more-theme-item").forEach((btn) => {
btn.classList.toggle("is-active", btn.getAttribute("data-color-theme") === colorMeta.id);
});
const valueEl = $("theme-font-scale-value");
if (valueEl) valueEl.textContent = String(percent);
const minus = document.querySelector("[data-font-scale-bump='-1']");
const plus = document.querySelector("[data-font-scale-bump='1']");
if (minus) minus.disabled = percent <= UI_FONT_SCALE_MIN;
if (plus) plus.disabled = percent >= UI_FONT_SCALE_MAX;
syncMarkdownMenuUi();
}
function stashComposerDraftFromDom() {
if (skipComposerStash) {
skipComposerStash = false;
@@ -4598,26 +4565,6 @@ $("btn-save-instance")?.addEventListener("click", () => {
void saveCurrentInstance();
});
$("theme-menu")?.addEventListener("click", (e) => {
const menu = $("theme-menu");
if (!menu) return;
const colorBtn = e.target.closest("[data-color-theme]");
if (colorBtn && menu.contains(colorBtn)) {
e.preventDefault();
applyColorTheme(colorBtn.getAttribute("data-color-theme"));
syncThemeMenuUi();
menu.removeAttribute("open");
return;
}
const bumpBtn = e.target.closest("[data-font-scale-bump]");
if (bumpBtn && menu.contains(bumpBtn)) {
e.preventDefault();
e.stopPropagation();
bumpUiFontScale(bumpBtn.getAttribute("data-font-scale-bump"));
syncThemeMenuUi();
}
});
$("composer")?.addEventListener("click", (e) => {
const menu = e.target.closest("#composer-more-menu");
if (!menu) return;
@@ -4764,7 +4711,7 @@ async function init() {
initUiFontScale();
initMarkdownRender();
initPlayAuxLlmBubbles();
syncThemeMenuUi();
syncMarkdownMenuUi();
try {
await Promise.all([loadBooks(), loadPersonas(), loadApiProfiles()]);
if (books.length) {