Peach: Local-first video metadata scraper and media manager.
fix(web): 悬停不再描线,换一批放平,资料页标签与外链改对
longmeidao228e885b13da
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex e67050e8c..7a58c9983 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -1856,18 +1856,20 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains('<span class="sr-only">${esc(x.label)}</span></a>')self.assertPageContains('.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}')- def test_an_official_link_shows_its_domain_and_globe_on_every_profile(self):- # 域名是这条链接里唯一确定的东西,前面的地球说明它通向站外。站点自己声明的- # 图标不是可信的标识:事务所 ACT 的站标是旗下一位艺人的照片,摆在人物页的- # 官网那一格就成了一张认错人的脸。名字也不必在这里重复——公司页的标题就是- # 它,人物页的事务所名在别名行里,还带着通往那张资料页的链接。+ def test_an_official_link_shows_its_domain_next_to_the_sites_own_mark(self):+ # 文字是域名——这条链接里唯一确定的东西;图标是站点自己那枚,说的是「这是哪家」。+ # 两句话不重复,所以官网这一格两样都给。名字不在这里重复:公司页的标题就是它,+ # 人物页的事务所名在别名行里,还带着通往那张资料页的链接。+ # 已知例外:事务所 ACT 的站标是旗下一位艺人的照片,那一条会在人物页上摆出一张+ # 别人的脸。取不到图时 `data-drop="self"` 撤掉 img,露出底下那枚地球。self.assertPageContains('<a class="urllink" href="${esc(x.url)}"')self.assertPageContains("${esc(linkHost(x.url)||x.label)}")self.assertPageContains(".entitylinks a.urllink{padding:4px 12px 4px 4px")links = self.app_js[self.app_js.index("const links=(d.links||[]).map"):]links = links[:links.index(".join('');")]- self.assertNotIn("entityfavicon", links.split('class="iconlink"')[-1],- "非社媒的外链不得再取对方站点自己声明的图标")+ official = links.split('class="iconlink"')[-1]+ self.assertIn('<img class="entityfavicon" src="${esc(linkMarkUrl(x))}"', official)+ self.assertIn('data-drop="self"', official)def test_entity_loading_and_detail_autoplay_share_their_entry_contracts(self):self.assertPageContains("showEntityLoading(ROUTE_ENTITIES[path.split('/')[1]])")@@ -7670,6 +7672,54 @@ class WebUiSourceTests(unittest.TestCase):self.assertIn("const selector='.managebar-menu,.board-local-nav:not(.settingscard>.board-local-nav)';",controls)self.assertNotIn(".insighttabs{display:flex", board)+ # 原样式把线挂在选中态上,权重比 `button::after` 高:只写后者,滑块底下还压着一条线。+ self.assertIn(".insighttabs button::after,.insighttabs button[aria-selected=\"true\"]::after"+ "{content:none}", board)++ def test_hovering_a_button_raises_the_fill_and_leaves_its_outline_alone(self):+ """悬停只抬填充。按钮静止态已经带一圈 1px,悬停再把它加深就是一排边框忽明忽暗。++ 药丸、标签和外链卡的边各有自己的颜色来源,所以逐类钉回静止值;它们和按钮同一条。+ """+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")+ for rule in re.findall(r"[^\n{}]*:hover[^\n{}]*\{[^}]*\}", board):+ selector, _, body = rule.partition("{")+ if not re.search(r"\.geist-button|\.fbtn|\.resourceaction|\.pill|\.brandpill|\.tg\b", selector):+ continue+ self.assertNotIn("--color-border-button-hover", body,+ f"悬停不改按钮那圈线:{selector.strip()}")+ self.assertIn("body .pill:hover,body .brandpill:hover{border-color:var(--field-ring)}", board)+ # 边不动之后悬停还得剩点东西:玻璃条上的药丸提文字色。+ self.assertIn(".board-filter-frame.board-filter-frame .pill:hover{color:var(--ink)}", board)+ self.assertIn("body .entitylinks a:hover{border-color:var(--line)}", board)++ def test_the_shuffle_key_sits_as_flat_as_the_sort_keys_beside_it(self):+ """换一批和排序键同一条,静止态一样平:单独铺一层面就是一排透明按钮里露出一块灰片。"""+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")+ self.assertIn(".sorts #batchAction,.entitycollectionhead .sorts .entitybatch"+ "{color:var(--ink);background:none;border:0;border-radius:7px;box-shadow:none}", board)+ # 选中态归排序键,换一批只有悬停。+ self.assertIn(".sorts #batchAction:hover,.entitycollectionhead .sorts .entitybatch:hover"+ "{background:var(--hover);color:var(--ink)}", board)++ def test_profile_tags_are_the_same_pill_as_the_ones_on_the_home_filter_bar(self):+ """资料页的标签跟首页筛选条上的标签是同一个控件,只是换了个位置。"""+ board = (Path(__file__).resolve().parents[1] / "web/board.css").read_text(encoding="utf-8")+ self.assertIn(".entitytags .pill{height:30px;padding:0 10px;font-size:13px;line-height:20px;"+ "border-radius:8px;border:1px solid var(--line);color:var(--ink-2)}", board)+ self.assertIn(".entitytags .pill[aria-pressed=\"true\"]{border-color:transparent;"+ "background:var(--picked);color:var(--ink)}", board)+ self.assertIn(".board-filter-frame #tagbar .pill{height:30px;padding:0 10px;font-size:13px;", board)++ def test_a_profile_website_link_shows_the_sites_own_mark(self):+ """官网那一格的文字是域名,图标是站点自己的那枚;取不到才露出地球。"""+ app = self.app_js+ self.assertIn("<a class=\"urllink\"", app)+ urllink = app[app.index("<a class=\"urllink\""):]+ urllink = urllink[:urllink.index("</a>")]+ self.assertIn("linkMarkUrl(x)", urllink)+ self.assertIn("data-drop=\"self\"", urllink)+ self.assertIn("linkHost(x.url)", urllink)def test_a_collapsed_ranking_fades_its_last_row_instead_of_covering_it(self):"""收起的排名靠 mask 淡掉最后一行,不是拿一块渐变色盖上去。diff --git a/web/app.js b/web/app.jsindex 5c842ffd4..4abbdcdbb 100644--- a/web/app.js+++ b/web/app.js@@ -7193,11 +7193,10 @@ async function openEntity(kind,name,push=true){// 纯图标的链接自己不带可读文字,得把标签留给辅助技术。return `<a class="iconlink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}">${mark}<span class="sr-only">${esc(x.label)}</span></a>`;}- /* 官网这一格只给域名。域名是这条链接里唯一确定的东西:谁的站、点过去到哪,都在- 它里面;前面的地球说明这是条外链。站点自己声明的图标不一定是标识——事务所- ACT 的站标是旗下一位艺人的照片,摆在人物页上就是一张认错人的脸。事务所的名字- 另有去处,在上面那行别名里,点进去是它的资料页。 */- return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}</span><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;+ /* 官网这一格的文字是域名,图标是站点自己的那枚。域名说的是「点过去到哪」,图标说的+ 是「这是哪家」,两句话不重复,所以图标不退回地球。取不到图时 `data-drop="self"`+ 把 img 撤掉,露出底下那枚地球。 */+ return `<a class="urllink" href="${esc(x.url)}" target="_blank" rel="noreferrer" title="${esc(x.label)}"><span class="entitylinkicon">${icon('globe')}<img class="entityfavicon" src="${esc(linkMarkUrl(x))}" alt="" loading="lazy" referrerpolicy="no-referrer" data-drop="self"></span><span class="entitylinklabel">${esc(linkHost(x.url)||x.label)}</span></a>`;}).join('');const tags=(d.tags||[]).map(x=>`<button class="pill" data-entity-tag="${esc(x.k)}" aria-pressed="${tagPressed(filters.tag,x.k)}">${esc(tagLabel(x.k))}<small>${x.n.toLocaleString()}</small></button>`).join('');/* 事务所名下的这批人不摆在这排小圆头像里:那是「同台艺人」,一条附注;名册是这一页diff --git a/web/board.css b/web/board.cssindex 42e894dba..f4604d71d 100644--- a/web/board.css+++ b/web/board.css@@ -41,7 +41,9 @@.board-filter-frame.board-filter-frame .pill,.board-filter-frame.board-filter-frame .sorts button{color:var(--glass-text)}.board-filter-frame.board-filter-frame #tagbar .pill[data-tag]:not([aria-pressed="true"]){border-color:var(--glass-low)}.board-filter-frame.board-filter-frame #tagbar .pill[data-state][aria-pressed="true"],.board-filter-frame.board-filter-frame .sorts button[aria-pressed="true"]{background:color-mix(in srgb,var(--ink) 10%,transparent)}-.board-filter-frame.board-filter-frame .sorts #batchAction,.entitycollectionhead .sorts .entitybatch{color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:8px;box-shadow:inset 0 1px 0 #ffffff0a,0 1px 2px #00000012}+/* 换一批跟同一条上的排序键一样平:给它单独铺一层面加一圈线,静止态就在一排透明+ 按钮里露出一块灰片,看着像图标背后还垫了个东西。选中态归排序键,它只有悬停。 */+.board-filter-frame.board-filter-frame .sorts #batchAction,.entitycollectionhead .sorts .entitybatch{color:var(--ink);background:none;border:0;border-radius:7px;box-shadow:none}.top.top,body.board-scrolled .top.top{background:transparent;box-shadow:none;backdrop-filter:none;border:0}.top .search.search{border-radius:999px;padding-left:16px}.top.top>.ib{border-radius:50%}@@ -213,6 +215,12 @@ body::before{display:none}.board-filter-frame #tagbar .pill[data-state]{border:0;background:none}.board-filter-frame #tagbar .pill[data-state][aria-pressed="true"]{background:var(--picked);color:var(--ink)}.board-filter-frame #tagbar .pill[data-tag]:not([aria-pressed="true"]){border:1px solid var(--line);background:transparent}+/* 资料页的标签跟首页筛选条上的标签是同一个控件,只是换了个位置:那边 30px 高、8px+ 圆角、13px 字,这边还留着 40px 高的大药丸,同一个人的标签在两页上大一圈小一圈。+ 计数跟着缩到 Caption。 */+.entitytags .pill{height:30px;padding:0 10px;font-size:13px;line-height:20px;border-radius:8px;border:1px solid var(--line);color:var(--ink-2)}+.entitytags .pill[aria-pressed="true"]{border-color:transparent;background:var(--picked);color:var(--ink)}+.entitytags .pill small{margin-left:5px;font:var(--board-caption)}.board-filter-frame .count{padding:8px 12px;min-height:46px;gap:12px}.board-filter-frame .sorts{gap:4px}.board-filter-frame .sorts button{height:30px;min-height:30px;font-size:12px;padding:0 8px;border:0;border-radius:7px;background:transparent}.board-filter-frame .sorts button[aria-pressed="true"]{background:var(--picked)}@@ -507,7 +515,9 @@ button,input,select,textarea{font-family:inherit}body,.disp{font-family:var(--board-font);letter-spacing:0}body{font:var(--board-body)}button,input,textarea,select{font-family:var(--board-font)}.pagetitle,.listtitle,body #manageTitle,.index .ihead h2,.indexheading,.playlistpage h2{font:var(--board-title);letter-spacing:0}.settingscard .settingshead h2,.configfieldset h2,.configfieldset h3,.cleanupfieldset h3,.followmanage .fsechead h3,.resourcesync>h2{font:var(--board-heading);letter-spacing:0}.metricstrip>button .board-stat-value,.tastesummary>.board-stat-value{font:var(--board-figure);letter-spacing:0}.drawer .dnav button,.board-library-rows button,.settingrow b,.fsource.frow>b{font:var(--board-body)}.fmeta,.confighelp,.settingrow small{font:var(--board-compact)}.board-stat-footer,.board-watch-measures small,.tasterank small,.insighttoolbar p{font:var(--board-caption);letter-spacing:.15px}.geist-button,.fbtn,.resourceaction{background-color:var(--color-background-primary-default);border-color:var(--color-border-button-default);color:var(--color-text-primary);transition:background-color .15s ease,border-color .15s ease,color .15s ease}-.geist-button:hover:not(:disabled),.fbtn:hover:not(:disabled),.resourceaction:hover:not(:disabled){background-color:var(--color-background-primary-hover);border-color:var(--color-border-button-hover);color:var(--color-text-primary)}+/* 悬停只抬填充,那圈线一步不动:按钮静止态已经带一圈 1px,悬停再把它加深,+ 鼠标扫过一排次级键就是一排边框忽明忽暗,而键本身并没有变化。 */+.geist-button:hover:not(:disabled),.fbtn:hover:not(:disabled),.resourceaction:hover:not(:disabled){background-color:var(--color-background-primary-hover);color:var(--color-text-primary)}.geist-button.primary,.geist-button.primary:hover:not(:disabled),.tagselection button.primary,.tagselection button.primary:hover:not(:disabled){background:var(--board-blue);color:var(--color-text-white);transition:filter .15s ease}.geist-button.primary:hover:not(:disabled),.tagselection button.primary:hover:not(:disabled){filter:brightness(1.08)}.drawer.drawer .dnav button[aria-pressed=true],.drawer.drawer .dnav button[aria-pressed=true]:hover{background:var(--board-blue);color:var(--color-text-white);transition:filter .15s ease}.geist-button.danger:hover:not(:disabled),.fbtn.danger:hover:not(:disabled),.resourceaction.danger:hover:not(:disabled){background:var(--drop);color:#fff}@@ -520,7 +530,15 @@ body,.disp{font-family:var(--board-font);letter-spacing:0}body{font:var(--board-/* Board secondary:实体细边框、轻阴影和统一的三档控件尺寸。 */body :is(.geist-button,.fbtn,.resourceaction,.fcredactions button,.fpickactions button,.batchbar button,.reviewpickhead button,.tagselection button,.geist-fieldset-footer>a,.geist-fieldset-footer>button):not(.primary,.danger,.error,.warning){box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:4px;height:36px;min-height:36px;padding:8px 12px;border:1px solid var(--color-border-button-default);border-radius:10px;background:var(--color-background-primary-default);color:var(--color-text-primary);box-shadow:0 1px 2px #0000000d;font:var(--board-body-medium);white-space:nowrap;text-decoration:none;transition:background-color .15s ease,border-color .15s ease}-body :is(.geist-button,.fbtn,.resourceaction,.fcredactions button,.fpickactions button,.batchbar button,.reviewpickhead button,.tagselection button,.geist-fieldset-footer>a,.geist-fieldset-footer>button):not(.primary,.danger,.error,.warning):hover:not(:disabled,[aria-disabled=true]){background:var(--color-background-primary-hover);border-color:var(--color-border-button-hover)}+body :is(.geist-button,.fbtn,.resourceaction,.fcredactions button,.fpickactions button,.batchbar button,.reviewpickhead button,.tagselection button,.geist-fieldset-footer>a,.geist-fieldset-footer>button):not(.primary,.danger,.error,.warning):hover:not(:disabled,[aria-disabled=true]){background:var(--color-background-primary-hover)}+/* 药丸、标签和外链卡跟按钮同一条。它们的边各有自己的颜色来源,所以逐类钉回静止值,+ 不能统一写成一个 token。 */+body .pill:hover,body .brandpill:hover{border-color:var(--field-ring)}+/* 玻璃条上的药丸这样一来没有任何悬停反馈:那层 `--glass-text` 的权重比基线的+ `.pill:hover` 高,把提亮文字色的那半也一起吃掉了。横排互斥选项的悬停就是提文字色。 */+.board-filter-frame.board-filter-frame .pill:hover{color:var(--ink)}+body .index .index-tags .tg:hover{border-color:color-mix(in srgb,var(--tag-color) 32%,transparent)}+body .entitylinks a:hover{border-color:var(--line)}body :is(.geist-button,.fbtn,.resourceaction,.fcredactions button,.fpickactions button,.batchbar button,.reviewpickhead button,.tagselection button):not(.primary,.danger,.error,.warning):is(:disabled,[aria-disabled=true]){background:var(--ground);border-color:var(--line);color:var(--muted);box-shadow:none}body :is(.geist-button,.fbtn,.resourceaction,.tagselection button).primary:not(:disabled){background:var(--board-blue);border:1px solid transparent;color:#fff;box-shadow:0 1px 2px #0000000d;transition:filter .15s ease}body :is(.geist-button,.fbtn,.resourceaction,.tagselection button).primary:hover:not(:disabled){background:var(--board-blue);color:#fff;filter:brightness(1.08)}@@ -696,7 +714,10 @@ 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)}-.insighttabs button::after{content:none}+/* 取消基线那条下划线要连选中态一起写:原样式把线挂在+ `.insighttabs button[aria-selected="true"]:after` 上,只写 `button::after` 权重更低,+ 于是滑块底下还压着一条 2px 墨线。原样式留着给 `original-design` 那条退路用。 */+.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/07-entity.css b/web/css/07-entity.cssindex 6c255efa9..fba826772 100644--- a/web/css/07-entity.css+++ b/web/css/07-entity.css@@ -55,7 +55,7 @@.entitylinkicon.brand svg{width:100%;height:100%;stroke:none;filter:none}/* 纯图标的社媒链接:收成圆形,没有文字就不给文字留位置。 */.entitylinks a.iconlink{padding:4px;gap:0;border-radius:50%}-/* 官网域名前显示地球图标,与带名称的链接共用间距。 */+/* 官网域名前显示站点自己那枚图标,取不到才露出地球;与带名称的链接共用间距。 */.entitylinks a.urllink{padding:4px 12px 4px 4px;letter-spacing:.02em}.entityskeletontext{width:100%}.entityskeletontext .entitytitle .skeleton{width:60%;height:auto}