Peach: Local-first video metadata scraper and media manager.
feat: give the narrow search bar a back button instead of filling the row
Peach local maintenance781d0fb64480
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 829b76006..8a118e04b 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -129,6 +129,20 @@ class WebUiSourceTests(unittest.TestCase):"const avatarName=identity.kind?identity.name:""(performer||it.creator||it.studio||who);")+ def test_narrow_search_has_a_way_out(self):+ """窄屏展开搜索后必须有退出入口。++ 失焦那条 140ms 的兜底只在输入框为空时才收起搜索栏,输入过内容就没有出口了。+ 返回箭头无条件收起,并让整条顶栏恢复——展开期间筛选和品牌要让位,否则筛选+ 按钮会和返回箭头叠在同一个位置上。+ """+ self.assertPageContains('id="searchBack"')+ self.assertPageContains("$('#searchBack').onclick=()=>{")+ self.assertPageContains(".top:has(.search.open) #filterBtn,")+ self.assertPageContains(".top:has(.search.open) .searchback{display:inline-flex")+ # 搜索框不铺满:左边留出返回按钮的位置。+ self.assertPageContains(".search{position:absolute;left:52px;right:8px;top:8px")+def test_avatar_tiles_do_not_inherit_the_text_link_underline(self):"""取消规则必须真的压过 `.entitylink:hover`,不能只是写在文件里。diff --git a/web/app.css b/web/app.cssindex 3bab84c16..bc65d15df 100644--- a/web/app.css+++ b/web/app.css@@ -838,9 +838,21 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.brand h1{font-size:17px}.ib{width:36px;height:36px}.ib svg{width:19px;height:19px}- .search{position:absolute;left:8px;right:8px;top:8px;max-width:none;margin:0;+ /* 展开的搜索栏不铺满整条:左边留出返回按钮,和 YouTube 手机版一致——+ 否则进了搜索就没有退出的入口,只能靠失焦或 Esc。 */+ .search{position:absolute;left:52px;right:8px;top:8px;max-width:none;margin:0;display:none;z-index:5;background:var(--surface)}.search.open{display:flex}+ /* 展开搜索时整条顶栏让位:筛选、品牌和右侧动作全部收起,只留返回箭头和输入框。+ 不收起的话筛选按钮和返回箭头会叠在同一个位置上。 */+ .top:has(.search.open) #filterBtn,+ .top:has(.search.open) .brand,+ .top:has(.search.open) #searchBtn,+ .top:has(.search.open) #immerseBtn,+ .top:has(.search.open) #selectMode,+ .top:has(.search.open) #refresh,+ .top:has(.search.open) #settingsBtn{display:none!important}+ .top:has(.search.open) .searchback{display:inline-flex;position:absolute;left:6px;top:8px;z-index:6}.searchmenu{position:fixed;left:8px;right:8px;top:56px;max-height:70vh;overflow:auto}#searchBtn{display:inline-flex!important}/* 移动端不需要密度切换和筛选抽屉按钮挤在一起 */@@ -856,6 +868,7 @@ body.drawer-open .edge{opacity:0;pointer-events:none} /* 展开时窄栏让位.ctags .tg:nth-child(n+3){display:none}}#searchBtn{display:none}+.searchback{display:none}.reviewimage{width:160px;height:112px;border-radius:8px;overflow:hidden;background:#000;margin:8px 0}.reviewimage img{width:100%;height:100%;object-fit:contain;display:block}/* JAV 版式条。只在 JAV 语境出现——首页混着创作者作品与素人流出,diff --git a/web/app.js b/web/app.jsindex ba8444c12..848b914f5 100644--- a/web/app.js+++ b/web/app.js@@ -1877,6 +1877,13 @@ $('#immerseBtn').onclick=()=>openTok();$('#searchBtn').onclick=()=>{const s=$('.search');s.classList.toggle('open');if(s.classList.contains('open'))$('#q').focus()};+/* 窄屏退出搜索。失焦那条 140ms 的兜底只在输入框为空时才收起搜索栏,+ 输入过内容就没有出口了;返回按钮无条件收起,并清掉下拉栏。 */+$('#searchBack').onclick=()=>{+ $('.search').classList.remove('open');+ $('#searchMenu').hidden=true;+ $('#q').blur();+};$('#q').addEventListener('blur',()=>setTimeout(()=>{if(!$('#q').value&&!$('#searchMenu').matches(':hover'))$('.search').classList.remove('open');$('#searchMenu').hidden=true},140));$('#brandHome').onclick=e=>{e.preventDefault();state={loc:state.loc,creator:'',studio:'',tag:'',len:'',dur_min:'',dur_max:'',orient:'',state:'',sort:appSettings.defaultSort,seed:String((Date.now()^(Math.random()*1e9|0))%99991),q:'',thumb:'1'};diff --git a/web/index.html b/web/index.htmlindex 835c6cfde..64df607b8 100644--- a/web/index.html+++ b/web/index.html@@ -55,6 +55,7 @@<header class="top"><button class="ib" id="filterBtn" title="筛选"><svg viewBox="0 0 24 24"><use href="#i-sliders-horizontal"/></svg></button><a class="brand" href="#" id="brandHome"><img class="mark" src="/peach-logo.png" alt=""><h1 class="disp">Peach</h1><span class="sub mono">蜜桃</span></a>+ <button class="ib searchback" id="searchBack" title="退出搜索" aria-label="退出搜索"><svg viewBox="0 0 24 24"><use href="#i-chevron-left"/></svg></button><div class="search"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="#i-search"/></svg><input id="q" type="search" placeholder="FC2" autocomplete="off"><div class="searchmenu" id="searchMenu" hidden></div></div>