Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(web): 女优页看片那一行不再贴着卡底,订阅新作卡片底行写女优名

longmeidaoe291e61c9e95
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 5984432c4..ab1fc6846 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -2368,19 +2368,20 @@ class WebUiSourceTests(unittest.TestCase):
"background:transparent;")
def test_the_portrait_grows_with_the_identity_column_on_wide_screens(self):
- """头像跟着右边那列的高度长,不再钉死一个尺寸。
+ """头像跟着右边那列的行数长:四行都在时 160px,其余 120px。
身份列有几行是看这个人有多少东西:只有名字和别名是两行,加上外链和看片那一行
- 就是四行。钉住 120px 的话卡上下空出一截,圆框反倒比文字轻。下限保住原尺寸,
- 上限免得内容再多时圆框把这一页的主角抢了。
+ 就是四行。钉住 120px 的话卡上下空出一截,圆框反倒比文字轻。尺寸按行定而不取
+ 行高的百分比:那样圆框宽、列宽、别名折行、行高绕成一个圈,Chromium 只解第一轮,
+ 折行多出的高度压进卡底内边距。
"""
self.assertPageContains(
".entityprofile{display:grid;grid-template-columns:auto minmax(0,1fr);")
self.assertPageContains(
- ".entityprofile>.entityportraitwrap{align-self:stretch;"
- "display:flex;align-items:center}")
+ ".entityprofile:has(>.entityidentity>.entitylinks):has(>.entityidentity>.entrymarks)"
+ "{--portrait-size:160px}")
self.assertPageContains(
- ".entityportrait{height:100%;min-height:120px;max-height:160px;width:auto;")
+ ".entityportrait{height:var(--portrait-size);width:auto;")
def test_the_entity_hero_is_a_centred_single_column_on_phones(self):
# 左像右文那套是给宽屏的:手机上 96px 头像旁边只剩两百多像素,别名和链接被挤成
@@ -8528,7 +8529,7 @@ class WebUiSourceTests(unittest.TestCase):
".followpageaction .fmeta",
".fsechead .fmeta",
".frow>b",
- ".feednewcard .meta .s>.feednewstudio", ".fvkind", ".idname",
+ ".feednewcard .meta .s>.feednewperformers", ".fvkind", ".idname",
".meta .t", ".meta .who", ".mixcopy b,.mixcopy span",
# 小窗信息栏与播放器右键菜单:标题、来源和菜单标签都是语义文本,尾部省略。
".miniplayertitle", ".miniplayersub", ".playermenuitem>span",
diff --git a/web/app.js b/web/app.js
index 8b8ef18d4..497c43d60 100644
--- a/web/app.js
+++ b/web/app.js
@@ -4449,14 +4449,13 @@ function feedNewCoverHtml(item){
` src="${esc(item.cover_url)}" referrerpolicy="no-referrer" data-panel-prior="1"`);
}
function feedNewCardHtml(item){
- // 厂牌与发行日各占一段:放不下时只收厂牌,日期整段留着。
- const label=[item.studio&&`<span class="feednewstudio">${esc(item.studio)}</span>`,
+ // 女优名与发行日各占一段:订阅按人订,底行说是谁的新片;放不下时只收女优名,日期整段留着。
+ const label=[item.performers&&`<span class="feednewperformers">${esc(item.performers)}</span>`,
item.release_date&&`<span>${esc(item.release_date)}</span>`].filter(Boolean)
.join('<span aria-hidden="true">·</span>');
const cover=feedNewCoverHtml(item);
// 番号与标题排在同一个两行的标题块里,和资产卡一样:番号加粗打头,标题接在后面截断。
- const heading=javTitleHtml({is_jav:true,code:item.code,name:item.code,
- display_title:item.title||item.performers||''});
+ const heading=javTitleHtml({is_jav:true,code:item.code,name:item.code,display_title:item.title||''});
/* 点击区自己一个类,不共用 `.cardopenhit`:那一个是「在 Peach 里打开这条」的落点,
全站按它认站内跳转(`test_follow_web` 盯着它不许变成外链)。这一条通向别人的站。 */
const open=item.link
@@ -4467,7 +4466,7 @@ function feedNewCardHtml(item){
<button type="button" data-feed-action="ignore" title="不想看" aria-label="不想看 ${esc(item.code)}">${icon('x')}</button>
<button type="button" data-feed-action="read" title="标为已看过" aria-label="标为已看过 ${esc(item.code)}">${icon('check')}</button></div></div>
<div class="meta"><div class="mtext"><span class="t">${heading}</span>
- <div class="s mono">${label||(item.title||item.performers?'':'资料还没取到')}</div></div></div></article>`;
+ <div class="s mono">${label||(item.title?'':'资料还没取到')}</div></div></div></article>`;
}
/* 订阅了这位时,新作那一行先按真卡的轮廓占住位置:取数回来再整行换掉,没有就收起。
diff --git a/web/css/07-entity.css b/web/css/07-entity.css
index c606f67c7..dc55a6f11 100644
--- a/web/css/07-entity.css
+++ b/web/css/07-entity.css
@@ -3,12 +3,15 @@
圆角裁掉。 */
.entityhero{display:flex;flex-direction:column;margin:0 0 22px;border-radius:var(--floating-radius);
background:var(--ground);overflow:hidden;min-width:0;max-width:100%}
-/* 头像跟着右边那列的高度长。身份列有几行是看这个人有多少东西:只有名字和别名时是两行,
+/* 头像跟着右边那列的行数长。身份列有几行是看这个人有多少东西:只有名字和别名时是两行,
加上外链和看片那一行就是四行,头像钉死 120px 的话卡上下会空出一截,圆框反倒比文字轻。
- 所以这一列不再写死宽度:圆框拉满这一行的高度,宽由 `aspect-ratio` 推出来,下限 120px
- 保住原来的尺寸,上限 160px 免得内容再多时圆框把这一页的主角抢了。 */
+ 所以四行都在时圆框放到 160px,其余 120px;上限 160px 免得圆框把这一页的主角抢了。
+ 尺寸按有哪几行定,不取这一行高度的百分比:圆框的宽决定头像那一列多宽,列宽又决定
+ 别名会不会折行、身份列有多高,取百分比就成了一个圈。Chromium 只解这个圈的第一轮,
+ 别名折行后多出的那截会压进卡底的内边距,看片那一行贴到同台艺人的分隔线上。 */
.entityprofile{display:grid;grid-template-columns:auto minmax(0,1fr);gap:20px;padding:20px;
- align-items:center;min-width:0}
+ align-items:center;min-width:0;--portrait-size:120px}
+.entityprofile:has(>.entityidentity>.entitylinks):has(>.entityidentity>.entrymarks){--portrait-size:160px}
.entityprofile>.entityportraitwrap{align-self:stretch;display:flex;align-items:center}
/* 女优有资料时多出第三栏:右边那张资料表(ADR-0069),和身份信息之间隔一道竖线。
宽 280–360px:生日、身材一行放得下,出道片名截断后还剩一半字。
@@ -37,16 +40,16 @@
/* 圆框外面这一层只为换头像那枚加号存在:圆框自己是 `overflow:hidden`(图要被裁成
圆的),贴在它边上的按钮放进去就没了。 */
.entityportraitwrap{position:relative;width:max-content;max-width:100%}
-/* 外面这一层拉满整行的高,圆框却封顶 160px、竖直居中:资料表的标签折成几行时,行比圆框高,
+/* 外面这一层拉满整行的高,圆框却竖直居中:资料表的标签折成几行时,行比圆框高,
加号贴这一层的角就掉到圆框下面去了。所以挂加号的宿主叠成和圆框一样大、一样位置的一块,
- 高度与居中取圆框同一个 `clamp`,加号的 `right/bottom` 就量在圆框上。它盖在脸上,不接指针。
- 不用 `transform` 居中:它会给弹层的 `fixed` 遮罩另起包含块。 */
-.entityportraitwrap>[data-avatar-picker]{position:absolute;left:0;right:0;height:clamp(120px,100%,160px);
- top:calc((100% - clamp(120px,100%,160px)) / 2);pointer-events:none}
+ 高度与居中取圆框同一个 `--portrait-size`,加号的 `right/bottom` 就量在圆框上。它盖在脸上,
+ 不接指针。不用 `transform` 居中:它会给弹层的 `fixed` 遮罩另起包含块。 */
+.entityportraitwrap>[data-avatar-picker]{position:absolute;left:0;right:0;height:var(--portrait-size);
+ top:calc((100% - var(--portrait-size)) / 2);pointer-events:none}
.entityportraitwrap>[data-avatar-picker]>*{pointer-events:auto}
/* `position:relative` 是给人脸放大留的包含块:放大后的 img 转成绝对定位,偏移必须
相对这个圆框算,否则会挂到最近的定位祖先上去。见 app.js 的 avatarFrame。 */
-.entityportrait{height:100%;min-height:120px;max-height:160px;width:auto;
+.entityportrait{height:var(--portrait-size);width:auto;
aspect-ratio:1;border-radius:50%;overflow:hidden;background:var(--overlay-5);
display:grid;place-items:center;font-size:var(--fs-4xl);color:var(--muted);max-width:100%;
position:relative}
@@ -186,7 +189,7 @@
.entityskeletontext .entitytitle .skeleton{width:60%;height:auto}
.entityskeletontext .alias .skeleton{display:block;width:40%;height:20px}
.entityskeletontext .entitylinks .skeleton{width:180px;height:36px}
-[data-skeleton^="entity/"] .entityportrait{height:auto}
+[data-skeleton^="entity/"] .entityportrait{height:var(--portrait-size)}
[data-skeleton^="entity/"] .entityfacts dt .skeleton{display:block;width:56px;height:16px;margin-block:3px}
[data-skeleton^="entity/"] .entityfacts dd .skeleton{display:block;width:70%;height:16px;margin-block:3px}
[data-skeleton^="entity/"] .entitycollectionhead .skeleton{width:90px;height:20px}
diff --git a/web/css/12-cards.css b/web/css/12-cards.css
index 45f37c070..994edd394 100644
--- a/web/css/12-cards.css
+++ b/web/css/12-cards.css
@@ -414,10 +414,10 @@ body[data-density="dense"] .card .meta .why{display:none}
.feednewtools button{width:32px;height:32px}
.feednewtools button svg{width:17px;height:17px}
.feednewcard .meta .t{font-size:var(--fs-sm)}
-/* 厂牌加发行日一行放完,放不下截掉厂牌的尾巴:折成两行时断在日期中间,读成两个数。 */
+/* 女优名加发行日一行放完,放不下截掉女优名的尾巴:折成两行时断在日期中间,读成两个数。 */
.feednewcard .meta .s{flex-wrap:nowrap;white-space:nowrap}
.feednewcard .meta .s>span{flex:none}
-.feednewcard .meta .s>.feednewstudio{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
+.feednewcard .meta .s>.feednewperformers{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis}
/* 占位卡直接套真卡的 `.t` 与 `.s`:标题块是两行 2.7em,下面那行放一个零宽字符,行高
跟真卡那行字同一套规则,到货那一下整行不跳。 */
.feednewskeleton{pointer-events:none}
diff --git a/web/css/19-immersive.css b/web/css/19-immersive.css
index 8209b3d3e..4456c570d 100644
--- a/web/css/19-immersive.css
+++ b/web/css/19-immersive.css
@@ -182,8 +182,10 @@ body:has(#batchbar:not([hidden])) #stage{padding-bottom:180px}
左像右文那套是给宽屏的:手机上 92 px 头像旁边只剩两百多像素,别名和链接被挤成
两三行,头像下面又空着一大片。居中之后名字和链接都拿到整行宽度。 */
.entityprofile{grid-template-columns:minmax(0,1fr);gap:12px;padding:16px;justify-items:center;text-align:center}
- /* 单列时头像上下各是一整行,没有「右边那列有多高」可跟,尺寸就还是钉住的 96px。 */
+ /* 单列时头像上下各是一整行,没有「右边那列有多高」可跟,尺寸就还是钉住的 96px。
+ 换头像加号的宿主按 `--portrait-size` 叠在圆框上,写在外层自己身上才压得过资料卡按行数给的那一档。 */
.entityportrait{height:96px;min-height:96px;max-height:96px;width:96px}.entityhero h2{font-size:var(--fs-xl)}
+ .entityportraitwrap{--portrait-size:96px}
.entityidentity{width:100%}
.entityfoot{padding:10px 16px}
/* 标题行是 flex,`text-align:center` 管不到它,得自己居中。 */