Peach: Local-first video metadata scraper and media manager.
fix(web): 界面只留 Board 一套,设置里的分隔线和滚动条各归各位
longmeidaoe4398fd61ea2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f363c1961..94f5fca3d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,7 +32,7 @@ Removed / Fixed / Security。### 变更-- **界面**:整套界面换成 Board 风格:顶栏、侧栏和吸顶浮层是半透明玻璃,卡片、按钮、输入框和菜单按同一套尺寸、圆角与间距重画,明暗两个主题各成一套。设置里勾上「使用旧版 UI」再刷新可以换回另一套界面;「增加对比度」关掉玻璃的透明与折射,改用实色背景。+- **界面**:整套界面换成 Board 风格:顶栏、侧栏和吸顶浮层是半透明玻璃,卡片、按钮、输入框和菜单按同一套尺寸、圆角与间距重画,明暗两个主题各成一套。设置里的「增加对比度」关掉玻璃的透明与折射,改用实色背景。- **配置**:配置页搬进右上角的设置里,成为「这台电脑」这一块,按「通用 / 媒体 / 网络与访问 / 更新与维护」分开列,管理菜单不再单列「配置」。在别的设备上打开设置仍看得到这一块,里面写明这几项要在运行 Peach 的那台电脑上改。### 修复@@ -41,6 +41,7 @@ Removed / Fixed / Security。- **复核**:复核页顶上的工具条和分组条从进页面起就是玻璃,两条合成一块,左右和标题、卡片同一条边;上面那排页签也回到同一条左边,选中那块底色不再往左溢出。- **界面**:首页整理提示和它下面那块筛选浮层之间,留出和别处一样宽的空当。- **界面**:数据管理页资源面板里的进度环,和它下面那几组链接表对齐。+- **界面**:设置里「增加对比度」和「左侧导航」之间只剩一条分隔线,右端和上面几行齐平;设置打开时页面右缘不再多出一条拖不动的滚动条。## [0.31.0] - 2026-09-08diff --git a/README.en.md b/README.en.mdindex 4952aafdf..b8ddba0cc 100644--- a/README.en.md+++ b/README.en.md@@ -40,7 +40,7 @@ Follow sources include FANBOX, Patreon, SubscribeStar, Kemono, Pawchive, Coomer,Interface preferences are saved in the current browser and live under Settings: default sort, official covers or preview images for JAV works, autoplay when details open, and SFW mode, which blurs, desaturates and dims images and video and stops hover previews.-The interface uses Board styling. Select “Use classic UI” in Settings and apply with a refresh to use the classic interface. “Increase contrast” disables navigation transparency and refraction. Numeric preferences accept custom values within their supported ranges, with switches for optional features.+The interface uses Board styling. “Increase contrast” in Settings disables navigation transparency and refraction. Numeric preferences accept custom values within their supported ranges, with switches for optional features.Choose a media library at the top of the sidebar; theme and settings controls are fixed at the bottom. Set library names and icons in Configuration; matching names group folders into one library. Library selection filters work lists and facets. Cloud libraries use locally served provider icons by default.diff --git a/README.md b/README.mdindex d0c5bb120..a77577f94 100644--- a/README.md+++ b/README.md@@ -40,7 +40,7 @@ Peach 是单用户、本地优先的个人媒体系统。在自己的电脑上界面偏好保存在当前浏览器,在右上角「设置」里改:默认排序、JAV 封面用官方封面还是预览图、打开详情是否自动播放,以及把图像模糊降饱和、关掉悬停预览的「SFW 模式」。-界面采用 Board 风格。设置中可选择「使用旧版 UI」并应用刷新;「增加对比度」关闭导航玻璃的透明与折射。数量和时间支持范围内自定义,可关闭的功能使用开关控制。+界面采用 Board 风格。设置里的「增加对比度」关闭导航玻璃的透明与折射。数量和时间支持范围内自定义,可关闭的功能使用开关控制。侧栏顶部选择媒体库,底部切换明暗主题并打开设置。配置中可设置媒体库名称和图标,同名文件夹归入一库;库选择限定作品列表与筛选项。网盘默认显示本机提供的网盘图标。diff --git a/docs/BOARD_UI.md b/docs/BOARD_UI.mdindex 97fc92576..526c9bec5 100644--- a/docs/BOARD_UI.md+++ b/docs/BOARD_UI.md@@ -31,7 +31,8 @@ Peach 使用 Board 的视觉与组件语义,保留 Vite、Preact、FastAPI 和## 设计边界-- `web/board.css` 是可独立关闭的视觉层。设置「使用旧版 UI」后应用并刷新,首屏加载前决定是否启用。+- `web/board.css` 是盖在 `web/css/` 上的视觉层,随页面一起加载,没有开关。两份要一起读:+ 尺寸、颜色和布局的底稿在 `web/css/`,board.css 只做覆盖,选择器权重必须压得过底稿。- 「增加对比度」关闭透明与折射;系统降低透明度偏好也使用实色。折射只作用于导航背景,不扭曲文字。- 设置标题与控件在桌面同排,手机宽度不足时换行。单位与数值属于同一输入框;可关闭的功能显示开关,关闭时隐藏数值。- 数值非法时不保存;关闭搜索记录后不读取或记入搜索记录,关闭相关推荐后不请求该模块。diff --git a/docs/PRODUCT_BACKLOG.md b/docs/PRODUCT_BACKLOG.mdindex cac3d3a20..c9e00734b 100644--- a/docs/PRODUCT_BACKLOG.md+++ b/docs/PRODUCT_BACKLOG.md@@ -4,9 +4,9 @@## BoardUI 正式前端迁移-用户已授权正式前端全量迁移,保留设置中的「使用旧版 UI」,应用后刷新生效。以现有 Preact/Vite 架构实施;审查所有页面和原有设计意图,覆盖管理、视频详情、设置、响应式布局及关联选项。布尔开关对应 Board Switch,互斥选择对应 Segmented Control;其余控件逐项取证与映射。玻璃默认折射,「增加对比度」使用实色背景。数值配置支持合法范围内自定义,可关闭功能用 Switch,开启才展示数字输入。+用户已授权正式前端全量迁移,Board 视觉层是唯一一套界面,没有切换开关。以现有 Preact/Vite 架构实施;审查所有页面和原有设计意图,覆盖管理、视频详情、设置、响应式布局及关联选项。布尔开关对应 Board Switch,互斥选择对应 Segmented Control;其余控件逐项取证与映射。玻璃默认折射,「增加对比度」使用实色背景。数值配置支持合法范围内自定义,可关闭功能用 Switch,开启才展示数字输入。-正式工作树已实现共享视觉层、管理与详情卡片、设置布局、数值输入和旧版隔离;18984 使用该工作树的完整构建快照进行只读验收。生产尚未切换。Remix Icon 候选审查在预览 `/icon-review.html`,现有已选图标保留至用户筛选。迁移不包含版本号或其他分支发布工作。+正式工作树已实现共享视觉层、管理与详情卡片、设置布局和数值输入;18984 使用该工作树的完整构建快照进行只读验收。生产尚未切换。Remix Icon 候选审查在预览 `/icon-review.html`,现有已选图标保留至用户筛选。迁移不包含版本号或其他分支发布工作。统计与口味已接入 Stat Cards、可展开排名、雷达、媒体库与网盘环形卡;浏览历史支持时间范围、真实访问热图和网站到创作者线索的流向。侧栏使用同一导航的 60/260px 宽窄态,手机从左侧滑入。设置滚动渐隐、手机输入字号、焦点环留白及登录保持时长已接入。Pro 组件使用公开行为的独立适配,范围见 [Board 适配](BOARD_UI.md)。diff --git a/src/peach/routes_pages.py b/src/peach/routes_pages.pyindex 534a6ef8c..cbee116f9 100644--- a/src/peach/routes_pages.py+++ b/src/peach/routes_pages.py@@ -331,11 +331,9 @@ def _document(title: str, body: str) -> str:def board_entry_style() -> str:- """入口页内联公共视觉层,保留设备上的旧版界面偏好。"""+ """入口页内联公共视觉层。首启和登录页不加载 app.js,样式得随 HTML 一起送到。"""css = (PROJECT_ROOT / "web/board-entry.css").read_text(encoding="utf-8")- return (f'<style id="boardEntryStyles">{css}</style>'- '<script>try{document.getElementById("boardEntryStyles").disabled='- 'localStorage.getItem("peach.legacy-ui")==="true"}catch(e){}</script>')+ return f'<style id="boardEntryStyles">{css}</style>'def _check_html(name: str, text_html: str, *, checked: bool) -> str:diff --git a/tests/test_follow_web.py b/tests/test_follow_web.pyindex e4f0510c2..19fa97463 100644--- a/tests/test_follow_web.py+++ b/tests/test_follow_web.py@@ -1729,7 +1729,7 @@ class FollowWebSourceTests(unittest.TestCase):self.assertPageContains('target="_blank" rel="noreferrer noopener"')self.assertPageContains("${esc(search.query)}")- def test_follow_author_groups_use_fixed_scrolling_cards_and_link_to_the_original_page(self):+ def test_follow_author_groups_are_one_card_per_author_and_link_to_the_original_page(self):self.assertPageContains('class="frows fsources"')grid = self.page[self.page.index(".fsources{"):]self.assertIn("repeat(auto-fit,minmax(430px,1fr))", grid[:grid.index("}")])@@ -1744,11 +1744,11 @@ class FollowWebSourceTests(unittest.TestCase):self.assertIn("height:280px", author_rule)self.assertIn("border:1px solid var(--border-10)", author_rule)self.assertIn("grid-template-rows:auto minmax(0,1fr)", author_rule)- self.assertPageContains("scrollerHtml(sourceRows,{")- self.assertPageContains("className:'fauthorsources',label:`${name} 的关注来源`")- # 滚动条由 attachOverlayScrollbar() 统一自绘,这里只留出滑块那一档的右内边距。- self.assertPageContains(".fauthorsources .geist-scroller-container{padding-right:12px}")- self.assertPageContains("wireScrollers(root)")+ # 一个作者一张卡,来源直接铺在卡里:卡片高度由 Board 层放开(`.followmanage .fauthor`+ # 的 `height:auto`),来源那一格不再自带滚动区。+ self.assertPageContains('<div class="fauthorsources" id="follow-author-${group[0].id}"'+ ' aria-label="${esc(name)} 的关注来源">${sourceRows}</div>')+ self.assertBoardContains(".followmanage .fauthorsources{height:auto;max-height:none;overflow:visible}")def test_source_actions_are_icon_only_and_stay_on_one_row(self):row = self.page[self.page.index("function followSourceCells(source,selectable=false)"):]@@ -2150,7 +2150,7 @@ class FollowWebSourceTests(unittest.TestCase):self.assertPageContains("wireIconSwitch(root,'data-follow-layout',setFollowListLayout)")self.assertPageContains('<div class="frows fsources" data-layout="${followListLayout()}">${sourceList}</div>')self.assertPageContains(- "return followListLayout()==='table'?followSourceTable(groups,!legacy)")+ "return followListLayout()==='table'?followSourceTable(groups,true)")# 切换只换列表本身:页头那枚开关留在原地,滑块才有得滑。self.assertPageContains("const list=document.querySelector('#stats .fsources');\n"" if(!list){renderFollowManage(followCredentials||{});return}\n"@@ -2158,8 +2158,8 @@ class FollowWebSourceTests(unittest.TestCase):" list.innerHTML=followSourceListHtml(followAuthorGroups(followData.sources||[]));\n"" wireFollowManage(followCredentials?.providers||[]);")self.assertPageContains("const sourceList=followSourceListHtml(groups);")- self.assertPageContains("const collapsed=!legacy&&collapsedFollowAuthors.has(key);")- self.assertPageContains("group.map(source=>followSourceRow(source,!legacy))")+ self.assertPageContains("const collapsed=collapsedFollowAuthors.has(key);")+ self.assertPageContains("group.map(source=>followSourceRow(source,true))")self.assertPageContains("data-follow-selection-remove")self.assertPageContains("data-follow-author-toggle")self.assertPageContains("button.disabled=!ids.length||!!followRuntime?.ledger_read_only")@@ -2248,7 +2248,7 @@ class FollowWebSourceTests(unittest.TestCase):# 表格滚动层与复核页标签条同一份接线:两端渐隐、鼠标停在上面时竖向滚轮转横向。components = (ROOT / "web" / "js" / "ui-components.js").read_text(encoding="utf-8")self.assertIn("const BOARD_EDGE_SCROLLERS='.reviewtabs,.ftablewrap';", components)- self.assertIn("if(el.matches(BOARD_EDGE_SCROLLERS)&&localStorage.getItem('peach.legacy-ui')!=='true'){", components)+ self.assertIn("if(el.matches(BOARD_EDGE_SCROLLERS)){", components)self.assertIn("'.reviewtabs','.junkfilters','.ftablewrap',", components)self.assertBoardContains(".followmanage .ftable th{color:var(--color-text-tertiary);background:var(--color-background-secondary-default);border-color:var(--color-separator-border)}")diff --git a/tests/test_metadata_library.py b/tests/test_metadata_library.pyindex eb5228c26..ef5fa7144 100644--- a/tests/test_metadata_library.py+++ b/tests/test_metadata_library.py@@ -158,7 +158,7 @@ class LibraryNfoTests(unittest.TestCase):self.assertIn("needsAttention?' open':''", source)self.assertIn('还没有内容标签', source)self.assertIn('还没有存储来源', source)- self.assertIn("totalVideos?locationRows:catalogEmptyHtml", source)+ self.assertIn("catalogEmptyHtml({configurable:runtimeConfigurable})}</div>", source)self.assertIn("unmountIsland($('#libraryProcessingNotice'))", source)self.assertIn("mode:'notice'", source)configuration = (root / 'frontend/src/islands/configuration.tsx').read_text(encoding='utf-8')diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex e056de04f..0e18e69ec 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -581,8 +581,7 @@ class WebUiSourceTests(unittest.TestCase):self.assertNotIn("$('#drawer').insertAdjacentHTML(", source)self.assertPageContains("const scroll=$('#drawerScroll'),key=surfacePath()+location.search;")self.assertPageContains("scroll.innerHTML=`<div style=\"display:flex;align-items:center;justify-content:space-between;margin-bottom:10px\">")- self.assertPageContains("scroll.insertAdjacentHTML('beforeend',document.documentElement.classList.contains('original-design')?")- self.assertPageContains("sidebarSectionHtml('内容标签',tagBody,'','online')")+ self.assertPageContains("scroll.insertAdjacentHTML('beforeend',sidebarSectionHtml('内容标签',tagBody,'','online'));")# 换页面的判据记在滚动层上:syncSidebarSurface() 判定换页就 replaceChildren(),# 传宿主进去会连 #drawerScroll 一起清掉,和整块 innerHTML 是同一种失败。self.assertPageContains("syncSidebarSurface(scroll,key)")@@ -4137,6 +4136,37 @@ class WebUiSourceTests(unittest.TestCase):"items.forEach(item=>item.nodes.forEach(node=>node.classList.remove('board-group-active')));")self.assertPageContains("items[index].nodes.forEach(node=>node.classList.add('board-group-active'));")+ def test_one_hairline_separates_the_settings_rows_from_the_block_under_them(self):+ """「左侧导航」那一块和它上面那行之间只有一条线,而且和上面几条一样长。++ 两侧各画各的时,一条 1px 的下边线和一条 1px 的上边线落在同一个 y 上,看着就是+ 一道 2px 的粗线;而这一块不让出滑块那 16px 的话,它的线还会比上面几行长一截,+ 一直贴到卡片边上。线归行的下沿,右边这一格跟着行走。+ """+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")+ self.assertIn(".settingscard .settingsscroll .settingrow+.sidebarsetting{border-top:0}", board)+ self.assertIn(".settingscard .settingsscroll .sidebarsetting"+ "{padding:16px 12px 12px 0!important;margin:0 16px 0 0!important}", board)+ self.assertIn(".settingscard .settingsscroll .settingrow{min-height:52px;"+ "padding:10px 10px 10px 0;gap:16px;border-top:0;"+ "border-bottom:1px solid var(--line-soft)}", board)++ def test_a_locked_page_does_not_keep_drawing_its_own_scrollbar(self):+ """弹层盖住页面时只剩弹层自己那条滚动条。++ 页面这时是 `overflow:hidden`,整页那条轨道拖不动、也读不出任何进度,留着就是+ 弹层旁边多一条竖线。判据跟着锁走:加 `overflow:hidden` 的就是这两个类。+ """+ base = (Path(__file__).resolve().parents[1] / "web/css/01-base.css").read_text(encoding="utf-8")+ self.assertIn("body.settings-open>.ovtrack.page,body.photolight-open>.ovtrack.page"+ "{display:none}", base)+ settings = (Path(__file__).resolve().parents[1]+ / "web/css/16-settings.css").read_text(encoding="utf-8")+ self.assertIn("body.settings-open{overflow:hidden}", settings)+ photos = (Path(__file__).resolve().parents[1]+ / "web/css/08-photos.css").read_text(encoding="utf-8")+ self.assertIn("body.photolight-open{overflow:hidden}", photos)+def test_the_this_computer_group_is_a_page_not_a_row_list(self):"""「这台电脑」那一格装的是整张配置页,外面不套开关行那圈底。@@ -6158,9 +6188,9 @@ class WebUiSourceTests(unittest.TestCase):"""详情展开后停在最后一层粘着的东西下面 8px。名单要跟着粘的那一层走:`#tagbar` 与 `#count` 被收进 `.board-filter-frame` 之后- 自己是 `position:relative`,只按这两个旧名字量就只剩顶栏那 64px,详情停在 144px、- 浮层底边却在 168px,最上面 24px 连同关闭键一起压在它下面。两个旧名字留着,- `original-design` 那条退路下粘的仍是它们自己。+ 自己是 `position:relative`,只按这两个名字量就只剩顶栏那 64px,详情停在 144px、+ 浮层底边却在 168px,最上面 24px 连同关闭键一起压在它下面。这两个名字仍留在名单里:+ `syncFilterFrame()` 判定不是馆藏版式时会把它们放回原位,那时粘着的是它们自己。顶栏那一段另有出处:`html` 的 `scroll-padding-top` 已经替它留好,而它和`scroll-margin-top` 是叠加的,再算一遍就把落点压低整整一个顶栏(要 176px,@@ -6688,7 +6718,6 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("wireDragReorder(root,{selector:'[data-sidebar-row]',attribute:'data-sidebar-row',")self.assertPageContains("wireDragReorder(list,{selector:'[data-queue-row]',attribute:'data-queue-row',")self.assertPageContains("function wireNavigationDrag(root){")- self.assertPageContains("clearTimeout(edgeT);edgeT=null;drawerSuppressUntil=Date.now()+900")self.assertPageContains("wireNavigationDrag($('#edge'))")self.assertPageContains("wireNavigationDrag($('#drawer').querySelector('.dnav'))")self.assertPageContains('data-nav="${k}" draggable="true"')@@ -9306,14 +9335,29 @@ class CoverSleeveThresholdTests(unittest.TestCase):class BoardStyleIsolationTests(unittest.TestCase):- def test_board_assets_and_legacy_choice_are_available_before_app_start(self):+ def test_the_board_layer_is_the_only_interface_and_ships_unconditionally(self):+ """board.css 随页面一起加载,页面上没有第二套界面可选。++ 它是盖在 `web/css/` 上的覆盖层,两份一起才画得出一个界面。留一个开关把它摘掉,+ 剩下的是一屏对不上的类名——`.board-*` 那些节点仍在 DOM 里,谁也不给它们样式。+ 判据落在四处:入口 HTML 无条件引它、首屏那段脚本不再读任何界面偏好、+ `web/` 下没有 `peach.legacy-ui` 与 `original-design` 的消费者、设置里只剩对比度+ 这一个开关。+ """root = Path(__file__).resolve().parents[1]html = (root / "web/index.html").read_text(encoding="utf-8")- self.assertIn('id="boardStyles"', html)- self.assertIn('href="/board.css"', html)- self.assertLess(html.index('peach.legacy-ui'), html.index('src="/app.js"'))- css = (root / "web/css/16-settings.css").read_text(encoding="utf-8")- self.assertIn('#applyUISetting[hidden]{display:none}', css)+ self.assertIn('<link rel="stylesheet" href="/board.css">', html)+ entry = (root / "src/peach/routes_pages.py").read_text(encoding="utf-8")+ self.assertIn("return f'<style id=\"boardEntryStyles\">{css}</style>'", entry)+ for path in sorted((root / "web").rglob("*")):+ if path.suffix not in {".js", ".css", ".html"} or "dist" in path.parts:+ continue+ text = path.read_text(encoding="utf-8")+ for token in ("peach.legacy-ui", "original-design"):+ self.assertNotIn(token, text, f"{path.name} 仍在读第二套界面的开关")+ app = (root / "web/app.js").read_text(encoding="utf-8")+ self.assertIn("if(!group||document.getElementById('glassContrastSetting'))return;", app)+ self.assertNotIn("legacyUISetting", app)def test_icon_centering_does_not_override_toolbar_visibility(self):root = Path(__file__).resolve().parents[1]diff --git a/web/app.js b/web/app.jsindex 46c3db21e..09722fca5 100644--- a/web/app.js+++ b/web/app.js@@ -21,7 +21,7 @@ import {} from './js/ui-components.js';initMiddleTruncate(document);-if(localStorage.getItem('peach.legacy-ui')!=='true')initBoardControls();+initBoardControls();wireBusyActions(document);attachOverlayScrollbar(document.documentElement,{variant:'page'});attachOverlayScrollbar($('#drawerScroll'));@@ -81,7 +81,6 @@ let entityPhotos=null,entityMediaView=emptyMediaView(),photoWallItems=[];艺人,切到视频是这一次浏览的选择,不是这类页面的常态。 */let agencyRosterView='people',agencyRoster=[];let sidebarDragKey=null;-let edgeT=null;/* 搜索下拉里被键盘选中的那一项。列表每次重建都要归零,否则索引会指向已经不存在的行。 */let searchActive=-1;/* ────────────────────────────────────────────────────────────────────────── */@@ -275,7 +274,7 @@ const MANAGEMENT_PLACEHOLDERS={${pageSkeletonHtml('正在读取采集来源',{cards:true,count:4,fill:false,className:'cleanup-skeleton'})}</div>`,};const managementPlaceholder=path=>- (localStorage.getItem('peach.legacy-ui')!=='true'&&boardPageSkeleton(path))||+ boardPageSkeleton(path)||(MANAGEMENT_PLACEHOLDERS[path]||(()=>pageSkeletonHtml('正在读取页面')))();/* 顶部三层只属于首页。深链启动时先画一遍再由路由收起来,等于向管理页和索引页承诺了三条永远不会到货的横条。 */@@ -673,12 +672,11 @@ const toast=(message,{timeout=6000,warn=false,action=null}={})=>{const root=$('#toasts');const item=document.createElement('div');item.className='toast'+(warn?' warn':'');- const board=localStorage.getItem('peach.legacy-ui')!=='true';const initial=toastBody(message);const paint=(body,alert)=>{item.classList.toggle('warn',!!alert);item.setAttribute('role',alert?'alert':'status');- item.innerHTML=`${board?`<span class="board-notification-icon" aria-hidden="true">${icon(alert?'circle-alert':'check')}</span>`:alert?icon('alert'):''}<p>${body}</p>${+ item.innerHTML=`<span class="board-notification-icon" aria-hidden="true">${icon(alert?'circle-alert':'check')}</span><p>${body}</p>${action&&!alert&&body===initial?`<button class="tact">${esc(action.label)}</button>`:''}<button class="tclose" title="关闭" aria-label="关闭提示">${icon('x')}</button>`;item.querySelector('.tclose').onclick=close;@@ -3207,7 +3205,7 @@ async function buildBars(){data-val="${esc(it.k)}">${dot}<span class="chip-label">${esc(it.label||tagLabel(it.k))}</span>${it.n!=null?`<span class="n">${it.n.toLocaleString()}</span>`:''}</button>`;}).join('')+`</div>`:'';// 按语义类别区分来源、创作者、内容和技术规格。- const sec=(t,b,x,cat)=>document.documentElement.classList.contains('original-design')?(b?`<div class="sec${cat?' cat-'+cat:''}"><h3>${t}${x||''}</h3>${b}</div>`:''):sidebarSectionHtml(t,b,x,cat);+ const sec=(t,b,x,cat)=>sidebarSectionHtml(t,b,x,cat);const scopedCreators=context.type==='entity'&&context.kind==='creator'? facetData.creators.filter(item=>item.k!==context.name):facetData.creators;// 与窄栏共用 EDGE_ICONS —— 两边条目必须一致,抽屉不另写一份硬编码@@ -3415,9 +3413,6 @@ async function openStats(push=true){const metricTab=(key,label,value,detail,selected=false)=>`<button type="button" role="tab" data-stats-metric="${key}"aria-selected="${selected}" aria-controls="stats-detail-${key}" tabindex="${selected?'0':'-1'}">${statCardBody(label,value,detail,{inventory:'database',viewing:'eye',coverage:'tags',storage:'hard-drive'}[key])}</button>`;- const locationRows=d.by_loc.map(row=>{const label=row.k==='online'?'已保存在线':(LOC[row.k]||row.k);return `<div class="insightbarrow"><div><span>${label}</span><b>${row.videos.toLocaleString()}</b></div>- ${progressHtml(`${label}:${row.videos.toLocaleString()} / ${totalVideos.toLocaleString()}`,row.videos,totalVideos)}- <small>${gb(row.bytes)} · ${pct(row.videos,totalVideos)}%</small></div>`}).join('');const tagsTable=d.top_tags.length?`<ol class="insightranking">${d.top_tags.map((t,index)=>`<li><button type="button" class="insightrankrow" data-k="${esc(t.k)}"><span class="insightrankpos">${index+1}</span><span>${esc(tagLabel(t.k))}</span><b>${t.n.toLocaleString()}</b></button></li>`).join('')}</ol>`:emptyStateHtml('tags','还没有内容标签','补全资料或添加标签后,这里会显示馆藏中的内容标签。');@@ -3447,7 +3442,7 @@ async function openStats(push=true){</div><section class="insightdetail"><div id="stats-detail-inventory" role="tabpanel" data-stats-detail="inventory" class="insightdetailbody">- ${localStorage.getItem('peach.legacy-ui')==='true'?(totalVideos?locationRows:catalogEmptyHtml({configurable:runtimeConfigurable})):(totalVideos?`<div class="board-inventory-charts">${radialCardHtml(d.by_loc.map(row=>({name:LOC[row.k]||row.k,value:row.videos,detail:gb(row.bytes)})),'网盘与本地')}${radialCardHtml((d.by_library||[]).map(row=>({name:row.name,value:row.videos,detail:gb(row.bytes)})),'媒体库')}</div>`:catalogEmptyHtml({configurable:runtimeConfigurable}))}</div>+ ${totalVideos?`<div class="board-inventory-charts">${radialCardHtml(d.by_loc.map(row=>({name:LOC[row.k]||row.k,value:row.videos,detail:gb(row.bytes)})),'网盘与本地')}${radialCardHtml((d.by_library||[]).map(row=>({name:row.name,value:row.videos,detail:gb(row.bytes)})),'媒体库')}</div>`:catalogEmptyHtml({configurable:runtimeConfigurable})}</div><div id="stats-detail-viewing" role="tabpanel" data-stats-detail="viewing" class="insightdetailbody" hidden><div class="insightcopy"><span>观看</span><h2>${cs.played.toLocaleString()}</h2><b>个作品有播放记录</b><p>累计 ${hrs(cs.play_seconds)}</p></div>@@ -3477,7 +3472,7 @@ async function openStats(push=true){</div>`;const statsRoot=$('#stats');wireRadialCards(statsRoot);- if(localStorage.getItem('peach.legacy-ui')!=='true')wireExpandableRanks(statsRoot);+ wireExpandableRanks(statsRoot);statsRoot.querySelectorAll('[data-stats-metric]').forEach(button=>button.onclick=()=>{statsRoot.querySelectorAll('[data-stats-metric]').forEach(tab=>{const selected=tab===button;tab.setAttribute('aria-selected',String(selected));tab.tabIndex=selected?0:-1});@@ -3861,7 +3856,7 @@ function renderTaste(d){const root=$('#stats'),stateEl=root.querySelector('[data-taste-state]'),file=root.querySelector('[data-taste-file]');wireActivityCharts(root);wireCreatorSankey(root);- if(localStorage.getItem('peach.legacy-ui')!=='true')wireExpandableRanks(root);+ wireExpandableRanks(root);wireTasteHistoryGuide(root,localStorage);root.querySelectorAll('input[name="taste-evidence"]').forEach(input=>input.onchange=()=>{tasteEvidence=input.value;@@ -5618,16 +5613,13 @@ function followAuthorName(group){const collapsedFollowAuthors=new Set();function followAuthorBlock(group){const name=followAuthorName(group);- const legacy=localStorage.getItem('peach.legacy-ui')==='true';const key=String(group[0].author_key||group[0].id);- const collapsed=!legacy&&collapsedFollowAuthors.has(key);+ const collapsed=collapsedFollowAuthors.has(key);const bad=group.filter(s=>s.last_status==='error'||s.last_status==='unauthorized').length;- const sourceRows=group.map(source=>followSourceRow(source,!legacy)).join('');- const sources=localStorage.getItem('peach.legacy-ui')==='true'- ?scrollerHtml(sourceRows,{className:'fauthorsources',label:`${name} 的关注来源`})- :`<div class="fauthorsources" id="follow-author-${group[0].id}" aria-label="${esc(name)} 的关注来源">${sourceRows}</div>`;- return `<${legacy?'div':'details'} class="fauthor${bad?' bad':''}"${!legacy&&!collapsed?' open':''}>- <${legacy?'div':'summary'} class="fauthorhead">${followAuthorAvatar(group)}+ const sourceRows=group.map(source=>followSourceRow(source,true)).join('');+ const sources=`<div class="fauthorsources" id="follow-author-${group[0].id}" aria-label="${esc(name)} 的关注来源">${sourceRows}</div>`;+ return `<details class="fauthor${bad?' bad':''}"${collapsed?'':' open'}>+ <summary class="fauthorhead">${followAuthorAvatar(group)}<b>${esc(name)}</b><button type="button" class="frowicon" data-follow-check="" data-follow-sources="${group.filter(s=>s.enabled).map(s=>s.id).join(',')}"${group.some(s=>s.enabled)?'':'disabled'} title="检查此作者" aria-label="检查 ${esc(name)} 的全部来源">${icon('refresh-cw')}</button>@@ -5635,9 +5627,9 @@ function followAuthorBlock(group){? group.map(source=>sourceIcon(source.provider)).join(''): sourceIcon(group[0].provider)+esc(group[0].provider_label)}</span>${bad?`<span class="fmeta warn">${bad} 个失败</span>`:''}- ${legacy?'':`<span class="board-author-actions"><button type="button" class="fbtn small" data-follow-author-select aria-pressed="false" aria-label="全选 ${esc(name)} 的来源">全选该作者</button><button type="button" class="frowicon board-author-toggle" data-follow-author-toggle="${esc(key)}" aria-controls="follow-author-${group[0].id}" aria-expanded="${!collapsed}" aria-label="${collapsed?'展开':'收起'} ${esc(name)} 的来源">${icon('chevron-down')}</button></span>`}- </${legacy?'div':'summary'}>- ${sources}</${legacy?'div':'details'}>`;+ <span class="board-author-actions"><button type="button" class="fbtn small" data-follow-author-select aria-pressed="false" aria-label="全选 ${esc(name)} 的来源">全选该作者</button><button type="button" class="frowicon board-author-toggle" data-follow-author-toggle="${esc(key)}" aria-controls="follow-author-${group[0].id}" aria-expanded="${!collapsed}" aria-label="${collapsed?'展开':'收起'} ${esc(name)} 的来源">${icon('chevron-down')}</button></span>+ </summary>+ ${sources}</details>`;}const followSourceSelection=new Set();@@ -5822,9 +5814,7 @@ function setFollowListLayout(value){wireFollowManage(followCredentials?.providers||[]);}function followSourceListHtml(groups){- const legacy=localStorage.getItem('peach.legacy-ui')==='true';- return followListLayout()==='table'?followSourceTable(groups,!legacy)- :legacy?groups.map(followAuthorBlock).join('')+ return followListLayout()==='table'?followSourceTable(groups,true):`<div class="board-follow-list">${groups.map(followAuthorBlock).join('')}</div>`;}@@ -5834,7 +5824,6 @@ function followSourceListHtml(groups){行与行之间也只用分隔线,不各自套框。控件尺寸按实测 Geist:32px 高、6px 圆角、14px。 */function renderFollowManage(credentials){const sources=followData.sources||[],counts=followData.counts||{};- const legacy=localStorage.getItem('peach.legacy-ui')==='true';const groups=followAuthorGroups(sources);const sourceList=followSourceListHtml(groups);const broken=sources.filter(s=>s.last_status==='error'||s.last_status==='unauthorized');@@ -5846,17 +5835,17 @@ function renderFollowManage(credentials){$('#stats').innerHTML=`<div class="follow followmanage">${locked?`<div class="runtimegate">${icon('info')}<span>${esc(followRuntime.ledger_read_only_message||'本机当前只能浏览')}</span>${writer?`<a href="${esc(writer)}">前往写入端管理关注</a>`:''}</div>`:''}- ${legacy?'':`<div class="fmanageoverview" aria-label="关注概览">+ <div class="fmanageoverview" aria-label="关注概览"><div><span>关注作者</span><b>${groups.length}<small> 位</small></b></div><div><span>启用来源</span><b>${sources.filter(source=>source.enabled).length}<small> / ${sources.length}</small></b></div><div><span>检查失败</span><b>${broken.length}<small> 个来源</small></b></div><div><span>未看更新</span><b>${counts.new||0}<small> 条</small></b></div>- </div>`}- ${legacy?'':`<div class="follow-workspace-switch" role="tablist" aria-label="关注管理区域">+ </div>+ <div class="follow-workspace-switch" role="tablist" aria-label="关注管理区域"><button type="button" role="tab" aria-selected="true" data-follow-workspace="list">关注列表</button><button type="button" role="tab" aria-selected="false" data-follow-workspace="add">添加关注</button><button type="button" role="tab" aria-selected="false" data-follow-workspace="source">来源管理</button>- </div>`}+ </div><div class="fmain"><section class="fsec" data-follow-workspace-panel="add"><div class="fsechead"><h3>添加关注</h3></div>@@ -5887,7 +5876,7 @@ function renderFollowManage(credentials){icon('refresh-cw')}检查全部</button><button class="fbtn" data-follow-view>${icon('rss')}去看更新</button></div>${followCheckReport?followCheckFailNote(followCheckReport):''}- ${sources.length&&localStorage.getItem('peach.legacy-ui')!=='true'?`<div class="board-follow-selection"><label>${checkboxHtml('data-follow-select-all aria-label="全选来源"')}全选</label><span data-follow-selected-count>已选 0</span><button class="fbtn" data-follow-check="" data-follow-sources="" data-follow-selection-action disabled>检查所选</button><button class="fbtn" data-follow-selection-enabled="true" data-follow-selection-action disabled>启用</button><button class="fbtn" data-follow-selection-enabled="false" data-follow-selection-action disabled>暂停</button><button class="fbtn danger" data-follow-selection-remove data-follow-selection-action disabled>删除</button></div>`:''}+ ${sources.length?`<div class="board-follow-selection"><label>${checkboxHtml('data-follow-select-all aria-label="全选来源"')}全选</label><span data-follow-selected-count>已选 0</span><button class="fbtn" data-follow-check="" data-follow-sources="" data-follow-selection-action disabled>检查所选</button><button class="fbtn" data-follow-selection-enabled="true" data-follow-selection-action disabled>启用</button><button class="fbtn" data-follow-selection-enabled="false" data-follow-selection-action disabled>暂停</button><button class="fbtn danger" data-follow-selection-remove data-follow-selection-action disabled>删除</button></div>`:''}${sources.length?`<div class="frows fsources" data-layout="${followListLayout()}">${sourceList}</div>${counts.new?`<div class="fsecfoot"><p class="fnote fbulkrow"><span class="fbulkcounts">未看 ${counts.new} · 已看 ${counts.seen||0}· 已保存 ${counts.saved||0} · 已忽略 ${counts.ignored||0}</span>@@ -5907,7 +5896,9 @@ function renderFollowManage(credentials){</section></div></div>`;wireFollowManage(creds);- if(!legacy){const tabs=[...$('#stats').querySelectorAll('[data-follow-workspace]')],panels=[...$('#stats').querySelectorAll('[data-follow-workspace-panel]')];tabs.forEach(tab=>tab.onclick=()=>{const key=tab.dataset.followWorkspace;tabs.forEach(t=>t.setAttribute('aria-selected',String(t===tab)));panels.forEach(panel=>panel.hidden=panel.dataset.followWorkspacePanel!==key)});panels.forEach(panel=>panel.hidden=panel.dataset.followWorkspacePanel!=='list')}+ const tabs=[...$('#stats').querySelectorAll('[data-follow-workspace]')],panels=[...$('#stats').querySelectorAll('[data-follow-workspace-panel]')];+ tabs.forEach(tab=>tab.onclick=()=>{const key=tab.dataset.followWorkspace;tabs.forEach(t=>t.setAttribute('aria-selected',String(t===tab)));panels.forEach(panel=>panel.hidden=panel.dataset.followWorkspacePanel!==key)});+ panels.forEach(panel=>panel.hidden=panel.dataset.followWorkspacePanel!=='list');void wireFollowProgress();if(locked)$('#stats').querySelectorAll('#followAdd input,#followAdd button,[data-follow-remove],[data-follow-check],'+@@ -7158,7 +7149,7 @@ async function openPhotoLightbox(index,source=null){// 上下滚也翻页:看图时手在滚轮上,没人愿意为了换一张去够左右键或按钮。mousewheel:{enabled:true,forceToAxis:false},thumbs:{swiper:strip},- pagination:localStorage.getItem('peach.legacy-ui')==='true'?undefined:{el:box.querySelector('.board-carousel-pagination'),clickable:true,dynamicBullets:true,dynamicMainBullets:3,renderBullet:(at,className)=>`<button type="button" class="${className}" aria-label="查看第 ${at+1} 张图片"></button>`},+ pagination:{el:box.querySelector('.board-carousel-pagination'),clickable:true,dynamicBullets:true,dynamicMainBullets:3,renderBullet:(at,className)=>`<button type="button" class="${className}" aria-label="查看第 ${at+1} 张图片"></button>`},navigation:{prevEl:box.querySelector('.photonav.back'),nextEl:box.querySelector('.photonav.fwd')},on:{slideChange(){counter.textContent=`${this.activeIndex+1} / ${items.length}`;centerThumb(this.activeIndex)}}});@@ -7388,7 +7379,6 @@ async function openEntity(kind,name,push=true){window.scrollTo({top:0,behavior:'smooth'});}-let drawerSuppressUntil=0;/* 抽屉里所有重画都只写 #drawerScroll:#drawer 本身是定位宿主,覆盖式滚动条的轨道和这层滚动容器都挂在它身上,整块 innerHTML 一换就把 buildBars() 要写的容器连轨道一起抹掉,首页从此停在骨架态。换页面的判据 data-surface 也记在滚动层上:@@ -7418,18 +7408,18 @@ function renderFollowDrawer(items){const tagBody=`<div class="chips">${counts.map(([tag,n])=>`<button class="chip online" data-follow-drawer-tag="${esc(tag)}" aria-pressed="${followTags.has(tag)}"><span class="chip-label">${esc(tagLabel(tag))}</span><span class="n">${n}</span></button>`).join('')}</div>`;- scroll.insertAdjacentHTML('beforeend',document.documentElement.classList.contains('original-design')?`<div class="sec cat-online"><h3>内容标签</h3>${tagBody}</div>`:sidebarSectionHtml('内容标签',tagBody,'','online'));+ scroll.insertAdjacentHTML('beforeend',sidebarSectionHtml('内容标签',tagBody,'','online'));$('#drawer').querySelectorAll('[data-follow-drawer-tag]').forEach(b=>b.onclick=()=>{followTags=new Set([b.dataset.followDrawerTag]);openDrawer(false);route(followViewPath());openFollow(false)});}function openDrawer(v){const drawer=$('#drawer'),restore=!v&&drawer.contains(document.activeElement);- drawer.inert=!v&&(innerWidth<=760||document.documentElement.classList.contains('original-design'));+ drawer.inert=!v&&innerWidth<=760;drawer.classList.toggle('open',v);$('#scrim').classList.toggle('on',v);document.body.classList.toggle('drawer-open',!!v);document.dispatchEvent(new Event('board:sidebar'));$('#filterBtn').setAttribute('aria-expanded',String(!!v));$('#filterBtn').setAttribute('aria-controls','drawer');$('#filterBtn').setAttribute('aria-label',v?'收起侧栏':'展开侧栏');if(restore)$('#filterBtn').focus();sessionStorage.setItem('board.sidebar',v?'open':'closed')}-function closeDrawerAfterNav(){drawerSuppressUntil=Date.now()+650;if(innerWidth<=760||document.documentElement.classList.contains('original-design'))openDrawer(false)}+function closeDrawerAfterNav(){if(innerWidth<=760)openDrawer(false)}$('#filterBtn').onclick=()=>openDrawer(!$('#drawer').classList.contains('open'));/* 常驻窄图标条:点即切视图,鼠标停留 180ms 展开完整抽屉 */const EDGE_ICONS=[@@ -7447,7 +7437,7 @@ const EDGE_ICONS=[归右上角。三个名字都带「管」「设」的字,字形就得把它们分开。 */['manage','管理','wrench'],];-function navigationIcon(key,glyph){return key===''&&localStorage.getItem('peach.legacy-ui')!=='true'?'<img class="board-home-logo" src="/peach-logo.png" alt="">':icon(glyph)}+function navigationIcon(key,glyph){return key===''?'<img class="board-home-logo" src="/peach-logo.png" alt="">':icon(glyph)}/* 每个管理页的身份(标题、图标、可直达的 URL)。用户仍可在设置里把其中任何一个加到顶层侧栏,所以这里保留全部页面,不因为它进了数据管理就删掉。 */const MANAGE_SECTIONS=[@@ -7526,10 +7516,6 @@ function wireNavigationDrag(root){if(!root)return;const items=[...root.querySelectorAll(':scope > [data-nav]')];items.forEach(item=>{- if(root.id==='edge')item.onpointerdown=()=>{- // 按下时就决定是点击或拖动;不能让 180ms 悬停计时器在按住期间把窄栏换成抽屉。- clearTimeout(edgeT);edgeT=null;drawerSuppressUntil=Date.now()+900;- };item.ondragstart=e=>{sidebarDragKey=item.dataset.nav;item.classList.add('nav-dragging');e.dataTransfer.effectAllowed='move';e.dataTransfer.setData('text/plain',sidebarDragKey||'__home__');@@ -7881,8 +7867,6 @@ function buildEdge(){wireNavigationDrag($('#edge'));syncHeaderActions();}-$('#edge').addEventListener('mouseenter',()=>{if(!document.documentElement.classList.contains('original-design')||Date.now()<drawerSuppressUntil)return;- edgeT=setTimeout(()=>openDrawer(true),180)});/* 滚动期间挂起悬停预览:内容在鼠标下滑过会连续触发 mouseenter,每次都新建 video 并发起 /stream 请求,直接把页面拖垮。 */window.__scrolling=false; let scrollT=null;@@ -7910,10 +7894,6 @@ window.addEventListener('scroll',()=>{},{passive:true});window.addEventListener('resize',()=>{scheduleStickySurfaces();alignFollowImageControls()},{passive:true});-/* 只在真正进入 72 px 图标栏时展开;内容区左缘不再设隐形热区。 */-$('#edge').addEventListener('mouseleave',()=>clearTimeout(edgeT));-$('#drawer').addEventListener('mouseleave',()=>{if(!document.documentElement.classList.contains('original-design'))return;- setTimeout(()=>{if(!$('#drawer').matches(':hover')&&!$('#edge').matches(':hover'))openDrawer(false)},240)});$('#scrim').onclick=()=>openDrawer(false);/* ── 列表 ── */@@ -9366,22 +9346,14 @@ loadSourceStatus();(()=>{/* Board 外壳与设置导航。 */-const legacyUI=localStorage.getItem('peach.legacy-ui')==='true';document.documentElement.classList.toggle('board-high-contrast',localStorage.getItem('peach.high-contrast')==='true');-document.documentElement.classList.toggle('original-design',legacyUI);function installUISetting(){const group=document.querySelector('.settingsscroll .settinggroup');- if(!group||document.getElementById('legacyUISetting'))return;- const row=document.createElement('div');row.className='settingrow';- row.innerHTML='<label for="legacyUISetting"><b>使用旧版 UI</b><small style="display:block">保留 Peach 原有界面,刷新页面后生效。</small></label><input type="checkbox" id="legacyUISetting" class="ptoggle" role="switch"><button type="button" class="geist-button" id="applyUISetting" hidden>应用并刷新</button>';- group.querySelector('.settingrow').after(row);- const field=row.querySelector('input'),apply=row.querySelector('button');field.checked=legacyUI;- field.onchange=()=>{localStorage.setItem('peach.legacy-ui',String(field.checked));apply.hidden=field.checked===legacyUI};- apply.onclick=()=>location.reload();+ if(!group||document.getElementById('glassContrastSetting'))return;const contrastRow=document.createElement('div');contrastRow.className='settingrow';contrastRow.innerHTML='<label for="glassContrastSetting"><b>增加对比度</b><small style="display:block">关闭玻璃折射与透明效果,使用实色背景。</small></label><input type="checkbox" id="glassContrastSetting" class="ptoggle" role="switch">';- row.after(contrastRow);+ group.querySelector('.settingrow').after(contrastRow);const contrast=contrastRow.querySelector('input');contrast.checked=document.documentElement.classList.contains('board-high-contrast');contrast.onchange=()=>{localStorage.setItem('peach.high-contrast',String(contrast.checked));document.documentElement.classList.toggle('board-high-contrast',contrast.checked)};}@@ -9467,7 +9439,6 @@ function buildSettingsTabs(){refreshSettingsTabs=buildSettingsTabs;function decorate(){installUISetting();- if(legacyUI)return;/* 只认管理区那一份配置页。它现在还长在设置弹层的「这台电脑」里,那一份已经由外面那圈设置分区页签管着,再给它自己叠一排页签就是页签套页签。 */const config=document.querySelector('#stats .configpage');@@ -9486,40 +9457,34 @@ function decorate(){let filterFrame;const boardBrand=document.querySelector('#brandHome');boardBrand.setAttribute('aria-label','Peach 首页');-let libraryPicker;-if(!legacyUI){- libraryPicker=document.createElement('div');libraryPicker.className='board-library-menu';libraryPicker.id='boardLibraryMenu';libraryPicker.hidden=true;libraryPicker.setAttribute('popover','manual');libraryPicker.setAttribute('role','dialog');libraryPicker.setAttribute('aria-label','媒体库');- document.body.append(libraryPicker);- boardBrand.setAttribute('aria-haspopup','dialog');boardBrand.setAttribute('aria-controls',libraryPicker.id);- boardBrand.insertAdjacentHTML('beforeend','<svg class="board-library-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m5 6 3-3 3 3M5 10l3 3 3-3"/></svg>');- boardBrand.onclick=event=>{event.preventDefault()};- const floating=wireAnchoredMenu(document.querySelector('#drawer'),boardBrand,libraryPicker,{side:true});- libraryPicker.addEventListener('toggle',event=>{if(event.newState==='open')libraryPicker.querySelector('button')?.focus()});- libraryPicker.addEventListener('keydown',event=>{if(event.key==='Escape'){event.stopPropagation();floating.setOpen(false);boardBrand.focus()}});- api('/api/libraries').then(data=>{- const choices=[['','全部媒体库','database'],...data.libraries.map(row=>[row.id,row.name,row.icon||'database'])];- const selected=sessionStorage.getItem('peach.library')||'';- if(!choices.some(row=>row[0]===selected)){sessionStorage.removeItem('peach.library');location.reload();return}- const current=sessionStorage.getItem('peach.library')||'';- boardBrand.querySelector('h1').textContent=current||'全部媒体库';- const libraryMark=glyph=>MEDIA_SOURCE_ICONS[glyph]?.startsWith('data:')?`<img src="${MEDIA_SOURCE_ICONS[glyph]}" alt="">`:icon(glyph==='local'?'hard-drive':glyph);- const mark=document.createElement('span');mark.className='mark';mark.setAttribute('aria-hidden','true');- mark.innerHTML=libraryMark(choices.find(row=>row[0]===current)?.[2]||'database');boardBrand.querySelector('.mark').replaceWith(mark);- libraryPicker.innerHTML=`<p>媒体库</p><div class="board-library-rows">${choices.map(([id,name,glyph])=>`<button type="button" data-library="${esc(id)}" aria-pressed="${id===current}"><span class="board-library-avatar">${libraryMark(glyph)}</span><span>${esc(name)}</span></button>`).join('')}</div><footer><button type="button" class="geist-button" data-library-manage>管理媒体库</button></footer>`;- libraryPicker.querySelectorAll('[data-library]').forEach(button=>button.onclick=()=>{sessionStorage.setItem('peach.library',button.dataset.library);location.assign('/')});- libraryPicker.querySelector('[data-library-manage]').onclick=()=>{floating.setOpen(false);openDrawer(false);location.assign('/configuration')};- }).catch(()=>{libraryPicker.hidden=true});-}+const libraryPicker=document.createElement('div');libraryPicker.className='board-library-menu';libraryPicker.id='boardLibraryMenu';libraryPicker.hidden=true;libraryPicker.setAttribute('popover','manual');libraryPicker.setAttribute('role','dialog');libraryPicker.setAttribute('aria-label','媒体库');+document.body.append(libraryPicker);+boardBrand.setAttribute('aria-haspopup','dialog');boardBrand.setAttribute('aria-controls',libraryPicker.id);+boardBrand.insertAdjacentHTML('beforeend','<svg class="board-library-chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="m5 6 3-3 3 3M5 10l3 3 3-3"/></svg>');+boardBrand.onclick=event=>{event.preventDefault()};+const libraryFloating=wireAnchoredMenu(document.querySelector('#drawer'),boardBrand,libraryPicker,{side:true});+libraryPicker.addEventListener('toggle',event=>{if(event.newState==='open')libraryPicker.querySelector('button')?.focus()});+libraryPicker.addEventListener('keydown',event=>{if(event.key==='Escape'){event.stopPropagation();libraryFloating.setOpen(false);boardBrand.focus()}});+api('/api/libraries').then(data=>{+ const choices=[['','全部媒体库','database'],...data.libraries.map(row=>[row.id,row.name,row.icon||'database'])];+ const selected=sessionStorage.getItem('peach.library')||'';+ if(!choices.some(row=>row[0]===selected)){sessionStorage.removeItem('peach.library');location.reload();return}+ const current=sessionStorage.getItem('peach.library')||'';+ boardBrand.querySelector('h1').textContent=current||'全部媒体库';+ const libraryMark=glyph=>MEDIA_SOURCE_ICONS[glyph]?.startsWith('data:')?`<img src="${MEDIA_SOURCE_ICONS[glyph]}" alt="">`:icon(glyph==='local'?'hard-drive':glyph);+ const mark=document.createElement('span');mark.className='mark';mark.setAttribute('aria-hidden','true');+ mark.innerHTML=libraryMark(choices.find(row=>row[0]===current)?.[2]||'database');boardBrand.querySelector('.mark').replaceWith(mark);+ libraryPicker.innerHTML=`<p>媒体库</p><div class="board-library-rows">${choices.map(([id,name,glyph])=>`<button type="button" data-library="${esc(id)}" aria-pressed="${id===current}"><span class="board-library-avatar">${libraryMark(glyph)}</span><span>${esc(name)}</span></button>`).join('')}</div><footer><button type="button" class="geist-button" data-library-manage>管理媒体库</button></footer>`;+ libraryPicker.querySelectorAll('[data-library]').forEach(button=>button.onclick=()=>{sessionStorage.setItem('peach.library',button.dataset.library);location.assign('/')});+ libraryPicker.querySelector('[data-library-manage]').onclick=()=>{libraryFloating.setOpen(false);openDrawer(false);location.assign('/configuration')};+}).catch(()=>{libraryPicker.hidden=true});const boardToggle=document.querySelector('#filterBtn'),toggleHome=document.createComment('sidebar toggle');boardToggle.before(toggleHome);-if(!legacyUI){- const foot=document.createElement('div');foot.className='board-sidebar-foot';- foot.innerHTML=`<div class="board-theme-toggle" role="group" aria-label="明暗主题"><span class="board-theme-thumb" aria-hidden="true"></span><button type="button" data-board-theme="light" aria-label="浅色主题">${icon('sun')}</button><button type="button" data-board-theme="dark" aria-label="深色主题">${icon('moon')}</button></div>`;- foot.append(document.querySelector('#settingsBtn'));document.querySelector('#drawer').append(foot);- foot.querySelectorAll('[data-board-theme]').forEach(button=>button.onclick=()=>{if(button.getAttribute('aria-pressed')==='true')return;transitionTheme(button,()=>{appSettings.theme=button.dataset.boardTheme;saveSettings();applyTheme();renderThemeSetting()})});- applyTheme();-}+const boardFoot=document.createElement('div');boardFoot.className='board-sidebar-foot';+boardFoot.innerHTML=`<div class="board-theme-toggle" role="group" aria-label="明暗主题"><span class="board-theme-thumb" aria-hidden="true"></span><button type="button" data-board-theme="light" aria-label="浅色主题">${icon('sun')}</button><button type="button" data-board-theme="dark" aria-label="深色主题">${icon('moon')}</button></div>`;+boardFoot.append(document.querySelector('#settingsBtn'));document.querySelector('#drawer').append(boardFoot);+boardFoot.querySelectorAll('[data-board-theme]').forEach(button=>button.onclick=()=>{if(button.getAttribute('aria-pressed')==='true')return;transitionTheme(button,()=>{appSettings.theme=button.dataset.boardTheme;saveSettings();applyTheme();renderThemeSetting()})});+applyTheme();function placeBrand(){- if(legacyUI)return;const close=document.querySelector('#drawerClose');if(close){const head=close.parentElement;head.classList.add('board-sidebar-head');boardBrand.setAttribute('aria-label','选择媒体库');@@ -9542,7 +9507,6 @@ const boardTagbar=document.querySelector('#tagbar'),countbar=document.querySelecconst tagHome=document.createComment('filter position');boardTagbar.before(tagHome);const countHome=document.createComment('sort position');countbar.before(countHome);function syncFilterFrame(){- if(legacyUI)return;const catalog=!boardTagbar.hidden&&!countbar.hidden&&getComputedStyle(boardTagbar).display!=='none'&&getComputedStyle(countbar).display!=='none';if(catalog&&!filterFrame){filterFrame=document.createElement('div');filterFrame.className='board-filter-frame';countHome.after(filterFrame);filterFrame.append(boardTagbar,countbar)}else if(!catalog&&filterFrame){tagHome.after(boardTagbar);countHome.after(countbar);filterFrame.remove();filterFrame=null}@@ -9556,7 +9520,6 @@ new MutationObserver(syncFilterFrame).observe(countbar,{attributes:true,attributdecorate();new MutationObserver(decorate).observe(document.querySelector('#stats'),{childList:true,subtree:true});new MutationObserver(decorate).observe(document.querySelector('#managebar'),{childList:true});-/* The selected design is loaded on refresh, not hot-swapped in a running page. */let floatingScheduled=false;function updateFloating(){@@ -9564,10 +9527,10 @@ function updateFloating(){document.body.classList.toggle('board-scrolled',scrollY>8);if(filterFrame){const top=parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--topH'))||64;filterFrame.classList.toggle('board-is-stuck',filterFrame.getBoundingClientRect().top<=top+9)}}-if(!legacyUI){addEventListener('scroll',()=>{if(!floatingScheduled){floatingScheduled=true;requestAnimationFrame(updateFloating)}},{passive:true});addEventListener('resize',updateFloating);updateFloating()}+addEventListener('scroll',()=>{if(!floatingScheduled){floatingScheduled=true;requestAnimationFrame(updateFloating)}},{passive:true});addEventListener('resize',updateFloating);updateFloating();/* Generate an edge-normal displacement field; only the backdrop is refracted. */-if(!legacyUI && /Chrome|Chromium|Edg\//.test(navigator.userAgent)){+if(/Chrome|Chromium|Edg\//.test(navigator.userAgent)){const ns='http://www.w3.org/2000/svg';const svg=document.createElementNS(ns,'svg');svg.setAttribute('width','0');svg.setAttribute('height','0');svg.setAttribute('aria-hidden','true');svg.style.position='fixed';svg.style.pointerEvents='none';const defs=document.createElementNS(ns,'defs');svg.append(defs);document.body.append(svg);@@ -9601,4 +9564,4 @@ if(!legacyUI && /Chrome|Chromium|Edg\//.test(navigator.userAgent)){})();-if(!document.documentElement.classList.contains('original-design'))openDrawer(innerWidth>760&&sessionStorage.getItem('board.sidebar')!=='closed');+openDrawer(innerWidth>760&&sessionStorage.getItem('board.sidebar')!=='closed');diff --git a/web/board.css b/web/board.cssindex cbe90a5c4..07c4d0541 100644--- a/web/board.css+++ b/web/board.css@@ -1,5 +1,7 @@@import url('/vendor/inter/5.3.0/index.css');-.settingscard .settingsscroll .sidebarsetting{padding:16px 12px 12px 0!important;margin:0!important}+/* 右边这 16px 和设置行一样,是给覆盖式滑块让出的道;不留的话这一块会比上面几行宽出+ 一截,它那条上边线直贴到卡片边上。 */+.settingscard .settingsscroll .sidebarsetting{padding:16px 12px 12px 0!important;margin:0 16px 0 0!important}.settingscard .settingsscroll .settingsortcontrols>[hidden]{display:none}.board-optional-number{display:flex;align-items:center;gap:12px;flex-direction:row-reverse}.board-number-fields[hidden]{display:none}.board-number-control input::-webkit-inner-spin-button,.board-number-control input::-webkit-outer-spin-button{appearance:none;margin:0}.board-number-control input{appearance:textfield;-moz-appearance:textfield}@@ -31,6 +33,9 @@.settingscard .machinesettings :is(.gselectfield,.geist-input,input.geist-input,.board-icon-trigger){background:var(--color-background-primary-default)}.settingscard .settingsscroll .settingrow{min-height:52px;padding:10px 10px 10px 0;gap:16px;border-top:0;border-bottom:1px solid var(--line-soft)}.settingscard .settingsscroll .settingrow:last-child{border-bottom:0}+/* 一组里排在设置行后面的分区(「左侧导航」是唯一一处)不自己画上边线:这一层的线挂在+ 行的下沿,两条 1px 落在同一条 y 上就成了一道 2px 的粗线。 */+.settingscard .settingsscroll .settingrow+.sidebarsetting{border-top:0}.settingscard .settingsscroll .settingrow b{font-size:14px;line-height:20px;font-weight:400}.settingscard .settingsscroll .settingrow small{font-size:12px;line-height:18px;margin-top:2px;max-width:none}.settingscard .settingsscroll .gselect{min-width:90px;min-height:32px;height:32px;padding:6px 8px;font-size:13px;border-radius:8px}@@ -774,9 +779,9 @@ html.board-high-contrast :is(.selectiondock,.reviewcontrols.is-stuck,.reviewgrou.insightpanel>header:has(.insighttabs){padding:12px 16px;min-height:0}.insighttabs{position:relative;display:inline-flex;align-items:center;gap:2px;width:auto;max-width:100%;min-height:0;margin:0;padding:4px;border:0;border-radius:10px;background:var(--color-background-tertiary-default);overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.insighttabs button{position:relative;z-index:1;display:inline-flex;flex:none;align-items:center;gap:6px;height:auto;min-height:28px;margin:0;padding:4px 10px;border:0;border-radius:6px;background:none;box-shadow:none;color:var(--color-text-secondary);font:var(--board-body);white-space:nowrap;transition:color .2s cubic-bezier(.4,0,.2,1)}-/* 取消基线那条下划线要连选中态一起写:原样式把线挂在+/* 取消基线那条下划线要连选中态一起写:`web/css` 那份把线挂在`.insighttabs button[aria-selected="true"]:after` 上,只写 `button::after` 权重更低,- 于是滑块底下还压着一条 2px 墨线。原样式留着给 `original-design` 那条退路用。 */+ 于是滑块底下还压着一条 2px 墨线。 */.insighttabs button::after,.insighttabs button[aria-selected="true"]::after{content:none}.insighttabs button:hover{background:none;color:var(--color-text-primary)}.insighttabs button[aria-selected="true"]{background:none;color:var(--color-text-primary);font:var(--board-body-medium)}diff --git a/web/css/01-base.css b/web/css/01-base.cssindex d6942d78e..e574a024c 100644--- a/web/css/01-base.css+++ b/web/css/01-base.css@@ -289,6 +289,10 @@ button.danger:not(.frowicon):disabled{@media (pointer:fine){.ovtrack.page .ovthumb{pointer-events:auto}}.ovtrack.page:hover .ovthumb{width:3px}.ovtrack.page .ovthumb:hover,.ovtrack.page.dragging .ovthumb{width:6px}+/* 弹层盖住页面时整页那条轨道要收起来:页面已经 overflow:hidden,它拖不动也没有对应的+ 滚动可读,留着就是弹层旁边多一条竖线。判据跟着锁走——下面两个类就是加 overflow:hidden+ 的那两处,弹层自己那条轨道挂在卡片上,不受这条影响。 */+body.settings-open>.ovtrack.page,body.photolight-open>.ovtrack.page{display:none}/* 原生滚动条在挂上覆盖式那条之后才藏:属性是 attachOverlayScrollbar() 挂上去的,脚本没跑到的容器就还留着系统滚动条,不会变成一个既没有滑块也拖不动的死框。 */[data-overlay-scrollbar]{scrollbar-width:none}diff --git a/web/css/05-insights.css b/web/css/05-insights.cssindex acf005760..84f0c5558 100644--- a/web/css/05-insights.css+++ b/web/css/05-insights.css@@ -17,7 +17,7 @@.insightcopy{padding:28px 24px;border-right:1px solid var(--line-soft);display:flex;flex-direction:column;align-items:flex-start}.insightcopy>span{color:var(--muted);font-size:var(--fs-xs)}.insightcopy h2{margin:10px 0 2px;font-size:var(--fs-4xl);line-height:1;font-variant-numeric:tabular-nums}.insightcopy>b{font-size:var(--fs-sm)}.insightcopy p{max-width:38ch;margin:24px 0 0;padding-top:18px;border-top:1px solid var(--line-soft);color:var(--muted);font-size:var(--fs-sm);line-height:1.55}.insightcopy small{margin-top:auto;padding-top:18px;color:var(--muted);font-size:var(--fs-xs)}.insightvisual,.insightfacts,.tastebars{min-width:0;padding:24px;align-self:center}.insightfacts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0}.insightfacts .kv{min-height:56px;padding:10px 12px;border-right:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft)}.insightfacts .kv:nth-child(odd){border-left:1px solid var(--line-soft)}.insightfacts .kv:nth-child(-n+2){border-top:1px solid var(--line-soft)}.insightfacts:has(.kv:last-child:nth-child(odd))::after{content:"";border-right:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft)}-.insightbarrow,.tastebar{padding:8px 0 12px;border-bottom:1px solid var(--line-soft)}.insightbarrow:last-child,.tastebar:last-child{border-bottom:0}.insightbarrow>div:first-child,.tastebar>div:first-child{display:flex;justify-content:space-between;gap:12px;font-size:var(--fs-sm)}.insightbarrow small{display:block;margin-top:5px;color:var(--muted);font-size:var(--fs-xs)}+.tastebar{padding:8px 0 12px;border-bottom:1px solid var(--line-soft)}.tastebar:last-child{border-bottom:0}.tastebar>div:first-child{display:flex;justify-content:space-between;gap:12px;font-size:var(--fs-sm)}.insightpanel{overflow:hidden;border:1px solid var(--line-soft);border-radius:var(--floating-radius);background:var(--ground)}.insightpanel>header{min-height:52px;display:flex;align-items:center;padding:0 16px;border-bottom:1px solid var(--line-soft)}.insightpanel>header h3{margin:0;font-size:var(--fs-md)}.insightpanel>header p{margin:2px 0 0;color:var(--muted);font-size:var(--fs-xs)}.insightpanelbody{min-width:0;padding:14px 16px 16px}.insighttabs{min-width:0;display:flex;align-self:stretch;align-items:stretch;gap:24px;overflow-x:auto;overscroll-behavior-x:contain}.insighttabs button{position:relative;flex:none;border:0;background:transparent;color:var(--muted);font:inherit;font-size:var(--fs-sm);cursor:pointer}.insighttabs button:hover,.insighttabs button[aria-selected="true"]{color:var(--ink)}.insighttabs button[aria-selected="true"]:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--ink)}.insightempty{padding:16px}.insightranking{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:0;padding:0;border-top:1px solid var(--line-soft);border-left:1px solid var(--line-soft);list-style:none}.insightranking>li{min-width:0}.insightrankrow{width:100%;min-width:0;min-height:44px;display:grid;grid-template-columns:30px minmax(0,1fr) auto;align-items:center;gap:9px;padding:8px 12px;border:0;border-right:1px solid var(--line-soft);border-bottom:1px solid var(--line-soft);background:transparent;color:var(--ink);text-align:left;cursor:pointer}.insightrankrow:hover{background:var(--overlay-5)}.insightrankrow>span:nth-child(2){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.insightrankrow b{color:var(--ink-2);font-weight:500;font-variant-numeric:tabular-nums}.insightrankpos{color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}diff --git a/web/css/16-settings.css b/web/css/16-settings.cssindex ebd581356..891402805 100644--- a/web/css/16-settings.css+++ b/web/css/16-settings.css@@ -92,4 +92,3 @@ body.settings-open{overflow:hidden}.settingrow:has(input[type="checkbox"]){grid-template-columns:minmax(0,1fr) auto;gap:12px}.settingrow .gselect{width:100%;min-width:0}.settingrow .pcheck{justify-self:start}}.sidebaradd .sidebaraddmenu button{justify-items:start}-#applyUISetting[hidden]{display:none}diff --git a/web/index.html b/web/index.htmlindex 9bf7c2972..8a5101180 100644--- a/web/index.html+++ b/web/index.html@@ -9,16 +9,13 @@<link rel="stylesheet" href="/vendor/videojs/8.24.0/video-js.min.css"><title>Peach · 蜜桃</title><link rel="stylesheet" href="/app.css">-<link rel="stylesheet" href="/board.css" id="boardStyles">+<link rel="stylesheet" href="/board.css"><!-- 主题必须在第一次绘制之前定下来。app.js 是 module,等同 defer:轮到它跑的时候浏览器已经按系统色画过一帧,手动选了浅色的人每次进页面都要先看一下深色。这段只做两件事——把选择写到 <html> 的 data-theme、把地址栏色块切到同一档;色板只在 web/css/01-base.css 一份,切换逻辑只在 app.js 的 applyTheme() 一份。 --><script>(()=>{try{- const legacy=localStorage.getItem('peach.legacy-ui')==='true';- document.documentElement.classList.toggle('original-design',legacy);- document.getElementById('boardStyles').disabled=legacy;document.documentElement.classList.toggle('board-high-contrast',localStorage.getItem('peach.high-contrast')==='true');const choice=JSON.parse(localStorage.getItem('peach.settings.v1')||'{}').theme;if(choice!=='light'&&choice!=='dark')return;diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex c8f90f0be..4a7ce62dd 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -437,7 +437,7 @@ export function attachOverlayScrollbar(container,{variant=''}={}){export function wireOverlayScrollbars(root=document){root.querySelectorAll(OVERLAY_SCROLLERS).forEach(el=>{if(deferReviewScroller(el))return;- if(el.matches(BOARD_EDGE_SCROLLERS)&&localStorage.getItem('peach.legacy-ui')!=='true'){+ if(el.matches(BOARD_EDGE_SCROLLERS)){const edges=()=>{el.dataset.overflowLeft=String(el.scrollLeft>1);el.dataset.overflowRight=String(el.scrollLeft+el.clientWidth<el.scrollWidth-1)};if(!el.dataset.boardScroll){el.dataset.boardScroll='true';el.addEventListener('scroll',edges,{passive:true});el.addEventListener('wheel',event=>{if(Math.abs(event.deltaY)>Math.abs(event.deltaX)&&el.scrollWidth>el.clientWidth){const before=el.scrollLeft;el.scrollLeft+=event.deltaY;if(before!==el.scrollLeft)event.preventDefault()}},{passive:false});new ResizeObserver(edges).observe(el)}edges();return;