Skip to content

armgit / peach

Public Imported from GitHub
0

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

feat(cards): 悬浮控件统一皮肤,分卷卡改翻动并认出带版次后缀的卷号

longmeidaoc58ee62f658a
diff --git a/docs/reference-snapshots/hover-seek-controls-user-screenshot.md b/docs/reference-snapshots/hover-seek-controls-user-screenshot.md
index 829b6fbbb..ab0ad3b17 100644
--- a/docs/reference-snapshots/hover-seek-controls-user-screenshot.md
+++ b/docs/reference-snapshots/hover-seek-controls-user-screenshot.md
@@ -32,13 +32,15 @@
## Peach 采用与差异
-- `.hovertools.seektools button` 去掉 `border`、`background` 与 `backdrop-filter`,图标提到
- 34px、描边 1.5;命中区域仍是共用规则给的 58px 圆,触摸目标不缩。
-- 秒数改由 `title` 与 `aria-label` 承担(「后退 10 秒」),DOM 里不再有数字角标。秒数本身仍
- 可在设置里改,只是不再压在图标上。
-- 图标继续用本地 Lucide 的 `rotate-ccw`/`rotate-cw`,不复制 beeg 的 SVG 路径。
-- Peach 主动保留:一层 `drop-shadow` 描边投影。裸白图标落在浅色封面上会消失,而 Peach 的
- 封面亮度不可控;beeg 侧没有这条依据,是本地必需的可读性补偿。
-- Peach 主动保留:同组第三颗「打开详情」沿用同一裸图标写法,一排三颗不混两种外观。
-- 右下角「稍后看」按钮不在此列,继续用磨砂圆底——它是持久状态而不是瞬时控件,
- `aria-pressed` 的开态需要一块面来承载。
+- **「不画底色、边框和磨砂层」这一条不采用**。2026-09-05 用户当场指定:这三颗与右下角
+ 「稍后看」同款,只是尺寸大一号,要有背景和框。用户的界面决定优先于这份截图证据,
+ 这里只记录取舍,不据截图回推。
+- `.hovertools.seektools button` 只覆盖图标尺寸(34px)。底色、边框、磨砂和悬停填充全部
+ 由 `.hovertools button` 共用规则给出,命中区域仍是 58px 圆。58/34 与「稍后看」的
+ 36/21 是同一个比例,一排控件因此读成一组。
+- 秒数由 `title` 与 `aria-label` 承担(「后退 10 秒」),DOM 里没有数字角标。秒数本身仍
+ 可在设置里改。
+- 图标用本地 Lucide 的 `rotate-ccw`/`rotate-cw`,不复制 beeg 的 SVG 路径。
+- 同组第三颗「打开详情」沿用同一外观,一排三颗不混两种写法。
+- 右下角「稍后看」按钮的磨砂圆底不变——它是持久状态而不是瞬时控件,`aria-pressed`
+ 的开态需要一块面来承载。
diff --git a/src/peach/catalog_rules.py b/src/peach/catalog_rules.py
index 8b2616901..e9cb1c16e 100644
--- a/src/peach/catalog_rules.py
+++ b/src/peach/catalog_rules.py
@@ -673,6 +673,39 @@ def _bare_first_part_plausible(bare: dict, parts: list[dict]) -> bool:
return min(rest) / PART_DURATION_SPREAD <= own <= max(rest) * PART_DURATION_SPREAD
+def names_without_shared_part_tail(items: list[dict]) -> list[str]:
+ """把这一组文件名共有的那段尾缀剥掉,卷号才回到扩展名前面。
+
+ `PPT-018-1-uncensored.mp4`/`-2-`/`-3-` 是库里成批出现的写法:版次、修复标记和
+ 分辨率跟在卷号后面(实测还有 `_prob3`、`-4K修复`、`_8k`、`.1080p`),卷号不紧邻
+ 扩展名,三卷于是各占一张卡、标题还一模一样。
+
+ 判据是组内共有而不是词表:只剥每个文件名都带的那一段,且它必须从分隔符起头。
+ `040221-001-carib-1080p` 与 `-720p` 的公共尾部是 `0p`,不从分隔符起头,剥不动——
+ 那两份是同一段画面的两个清晰度,本来就不该合成分卷。剥不出东西时返回空列表。
+ """
+ names = [str(item.get("name") or "") for item in items]
+ stems = [name.rpartition(".")[0] for name in names]
+ if len(stems) < 2 or not all(stems):
+ return []
+ common = stems[0]
+ for stem in stems[1:]:
+ while common and not stem.endswith(common):
+ common = common[1:]
+ separator = re.search(r"[-_. ]", common)
+ tail = common[separator.start():] if separator else ""
+ if not tail:
+ return []
+ stripped = []
+ for name in names:
+ stem, dot, suffix = name.rpartition(".")
+ head = stem[: len(stem) - len(tail)]
+ if not head:
+ return [] # 整个名字都是尾缀,剥完什么都不剩
+ stripped.append(f"{head}{dot}{suffix}")
+ return stripped
+
+
def ordered_multipart_items(items: list[dict]) -> list[dict]:
"""Return one unambiguous, contiguous multipart release in playback order.
@@ -684,8 +717,19 @@ def ordered_multipart_items(items: list[dict]) -> list[dict]:
盗版站常把第一卷留成裸名、后续卷才加 `-2`/`-3`(TRE-080 实测:9163/11255/8530 秒)。
裸名也可能是整部完整版,所以只在数字标记、标记正好从 2 连续排起、且裸名时长与
其他卷相差不大时,才把它当第 1 卷;字母卷缺 A 时无从判断裸名是不是 A,不猜。
+
+ 文件名原样认不出卷号时再按 `names_without_shared_part_tail` 剥一次共有尾缀重试:
+ 先原样、后剥缀,已经成组的那些走的仍是第一条路,判据一个没松。
"""
- marked = [(item, part_marker(str(item.get("name") or ""))) for item in items]
+ ordered = _ordered_by_markers(items, [str(item.get("name") or "") for item in items])
+ if ordered:
+ return ordered
+ stripped = names_without_shared_part_tail(items)
+ return _ordered_by_markers(items, stripped) if stripped else []
+
+
+def _ordered_by_markers(items: list[dict], names: list[str]) -> list[dict]:
+ marked = [(item, part_marker(name)) for item, name in zip(items, names)]
if len(marked) < 2:
return []
bare = [item for item, marker in marked if not marker]
diff --git a/src/peach/web_catalog.py b/src/peach/web_catalog.py
index a6130ac3a..554747fda 100644
--- a/src/peach/web_catalog.py
+++ b/src/peach/web_catalog.py
@@ -18,6 +18,7 @@ from .catalog_rules import (
collapse_superseded_taste_tags,
is_jav_asset,
jav_display_metadata,
+ names_without_shared_part_tail,
normalise_code_key,
ordered_multipart_items,
part_marker,
@@ -561,9 +562,12 @@ def q_parts(contract: WebContract, args):
if not group or not any(item["id"] == asset_id for item in group):
return {"error": "multipart release not found"}
items = []
- for position, row in enumerate(group, 1):
+ # 卷号后面还挂着版次或修复标记时(`PPT-018-1-uncensored.mp4`),剥掉组内共有的
+ # 那段尾缀才取得到卷标;这一步和分组用的是同一个判据。
+ stripped = names_without_shared_part_tail(group) or [""] * len(group)
+ for position, (row, bare) in enumerate(zip(group, stripped), 1):
item = q_item(contract, row["id"])
- marker = part_marker(str(row.get("name") or ""))
+ marker = part_marker(str(row.get("name") or "")) or part_marker(bare)
# 裸名首卷没有标记,卷标按队列位置给;有标记时沿用文件名里的写法。
item["part_label"] = (marker.upper() if marker.isalpha() else marker) or str(position)
items.append(item)
diff --git a/tests/test_rm_web.py b/tests/test_rm_web.py
index 8091b921d..d2376d8a3 100644
--- a/tests/test_rm_web.py
+++ b/tests/test_rm_web.py
@@ -2222,6 +2222,46 @@ class DuplicateDetectionTests(unittest.TestCase):
self.assertEqual(rm_web.ordered_multipart_items(duplicate), [])
self.assertEqual(rm_web.ordered_multipart_items(gapped), [])
+ def test_parts_group_when_the_edition_suffix_sits_after_the_volume_number(self):
+ """卷号后面挂着版次或修复标记时,剥掉组内共有尾缀仍认得出这是一部片的几卷。
+
+ 实测 PPT-018:三份 `PPT-018-N-uncensored.mp4`(11785/10511/6551 秒)各占一张卡、
+ 标题完全相同,点开只能靠时长认是哪一卷。库里同形的还有 `_prob3`、`-4K修复`、
+ `_8k`;全库 156 个同番号多文件组里,这条判据把成组数从 83 抬到 92。
+ """
+ uncensored = [
+ {"id": 31442, "name": "PPT-018-1-uncensored.mp4", "duration": 11785.8},
+ {"id": 31443, "name": "PPT-018-2-uncensored.mp4", "duration": 10511.7},
+ {"id": 31444, "name": "PPT-018-3-uncensored.mp4", "duration": 6551.6},
+ ]
+ self.assertEqual(
+ [item["id"] for item in rm_web.ordered_multipart_items(uncensored)],
+ [31442, 31443, 31444])
+ restored = [
+ {"id": 2, "name": "FC2-PPV-1083921-2-4K修复.mp4"},
+ {"id": 1, "name": "FC2-PPV-1083921-1-4K修复.mp4"},
+ ]
+ self.assertEqual(
+ [item["id"] for item in rm_web.ordered_multipart_items(restored)], [1, 2])
+
+ def test_two_resolutions_of_one_film_are_not_a_multipart_release(self):
+ """共有尾部不从分隔符起头就剥不动,两个清晰度因此仍是两条独立记录。
+
+ 实测 040221-001(carib):`-1080p` 与 `-720p` 的公共尾部只有 `0p`。按字符去剥
+ 会把 `1080p` 拆成 `10` 加 `80p`,同一段画面就成了「第 10 卷和第 8 卷」。
+ `ABF-234` 与 `ABF-234-UN` 同理,它们归版次组。
+ """
+ resolutions = [
+ {"id": 1, "name": "040221-001-carib-1080p.mp4"},
+ {"id": 2, "name": "040221-001-carib-720p.mp4"},
+ ]
+ self.assertEqual(rm_web.ordered_multipart_items(resolutions), [])
+ editions = [
+ {"id": 1, "name": "ABF-234.mp4"},
+ {"id": 2, "name": "ABF-234-UN.mp4"},
+ ]
+ self.assertEqual(rm_web.ordered_multipart_items(editions), [])
+
def test_a_bare_first_part_joins_numbered_parts_when_durations_agree(self):
# TRE-080 实测:首卷 `TRE-080.mp4` 没有标记,后两卷是 -2/-3,时长 9163/11255/8530 秒。
items = [
@@ -2280,6 +2320,42 @@ class DuplicateDetectionTests(unittest.TestCase):
["TRE-080.mp4", "TRE-080-2.mp4", "TRE-080-3.mp4"])
self.assertEqual([item["part_label"] for item in parts["items"]], ["1", "2", "3"])
+ def test_volumes_that_carry_an_edition_suffix_still_collapse_into_one_card(self):
+ """PPT-018 的三卷把版次写在卷号后面,仍然折成一张卡和一条 1/2/3 的队列。
+
+ 实测三份 `PPT-018-N-uncensored.mp4`:11785/10511/6551 秒。它们此前各占一张卡,
+ 标题、女优、厂牌完全一样,在目录里只有时长能区分是哪一卷。
+ """
+ connection = sqlite3.connect(self.db_path)
+ connection.executemany(
+ "INSERT INTO asset(id,location,path,name,medium,size,studio,code,duration,"
+ "width,height,first_seen) VALUES(?,'115',?,?,'video',?,'Prestige','PPT-018',?,"
+ "1920,1080,'2026-08-13')",
+ [
+ (11, r"B:\PPT-018\PPT-018-2-uncensored.mp4", "PPT-018-2-uncensored.mp4",
+ 8_913_529_270, 10511.7),
+ (12, r"B:\PPT-018\PPT-018-1-uncensored.mp4", "PPT-018-1-uncensored.mp4",
+ 10_015_751_441, 11785.8),
+ (13, r"B:\PPT-018\PPT-018-3-uncensored.mp4", "PPT-018-3-uncensored.mp4",
+ 5_560_132_404, 6551.6),
+ ],
+ )
+ connection.commit(); connection.close()
+
+ listed = rm_web.q_items(
+ self.contract, {"q": "PPT-018", "sort": "new", "limit": "10"},
+ )["items"]
+ self.assertEqual({row["part_group"]["count"] for row in listed}, {3})
+ self.assertEqual(listed[0]["part_group"]["seed_id"], 12, "卷号 1 那份是第一卷")
+ self.assertTrue(all("edition_group" not in row for row in listed),
+ "同一版次的分卷不是多版本")
+
+ parts = rm_web.q_parts(self.contract, {"id": "11"})
+ self.assertEqual([item["name"] for item in parts["items"]],
+ ["PPT-018-1-uncensored.mp4", "PPT-018-2-uncensored.mp4",
+ "PPT-018-3-uncensored.mp4"])
+ self.assertEqual([item["part_label"] for item in parts["items"]], ["1", "2", "3"])
+
class TopsRotationTests(unittest.TestCase):
"""顶部三层要跟着「换一批」真的换人,否则刷新后上面纹丝不动。"""
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 1a197c567..1aac3490c 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -4282,6 +4282,30 @@ class WebUiSourceTests(unittest.TestCase):
# 队列长度不能被悬浮预取剪短:两边用同一个 limit。
self.assertPageContains("api('/api/related?id='+seedId+'&limit=28')")
+ def test_multipart_cards_flip_through_their_parts_on_hover(self):
+ """分卷卡悬浮翻各卷画面,版次卡继续走分段视频预览。
+
+ 有码、中字、无码是同一段画面的几个来源,翻过去前后两张几乎一样,看着像图
+ 卡住了;各卷是不同画面,翻动才说明这张卡代表不止一条。分卷卡因此也不带
+ 倒计时环和快退/快进那三颗——它们要操作的 `video.hv` 在这种卡上不存在。
+ 各卷只取一次,悬浮预取后点开分卷队列不再发第二个请求。
+ """
+ self.assertPageContains(
+ """${parts?'<div class="mixfaces" data-mix-faces hidden></div>':''}""")
+ self.assertPageContains("function wirePartFlip(el,it){")
+ self.assertPageContains("if(it?.part_group)wirePartFlip(el,it);")
+ self.assertPageContains(
+ "else if(it&&(!it.medium||it.medium==='video'))wireHover(el,it);")
+ # 和 Mix 共用同一套时序、门槛和面渲染,不另写一份动效。
+ self.assertPageContains("wireStackFlip(el,async()=>{")
+ self.assertPageContains(".filter(x=>mixHasPicture(x,layout)).slice(0,MIX_FLIP_FACES)")
+ # 第一张是卡片自己的静止封面,翻进来的才不会跳取景。
+ self.assertPageContains("return [it,...items.filter(x=>x.id!==it.id)]")
+ self.assertPageContains("const tools=parts?laterTool:")
+ self.assertPageContains("const partGroupCache=new Map();")
+ self.assertPageContains("try{group=await partGroup(seedId)}catch(_e)")
+ self.assertPageLacks("const group=await api('/api/parts?id='+seedId);")
+
def test_stacked_cards_pile_upward_and_keep_the_row_bottom_aligned(self):
"""Mix、分卷、版次和关注合集的叠层往上溢出,卡片本体不为它留白。
@@ -4421,22 +4445,27 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("section.querySelector('h3').textContent=`视频 ·")
self.assertPageLacks("的馆藏作品 ·")
- def test_hover_seek_controls_are_bare_icons_over_the_frame(self):
- """悬停放大时居中的快退/快进/全屏是裸图标,不是压在画面上的磨砂圆饼。
+ def test_hover_seek_controls_wear_the_watch_later_button_skin(self):
+ """居中的快退/快进/全屏和右下角「稍后看」是同一种控件,只是尺寸不同。
- 三个 58px 的实心圆落在封面正中,遮住的画面比按钮本身还多,而这一层出现的时机
- 恰恰是用户在看画面。命中区域仍留 58px(触摸目标不缩),只是不再画出底和边;
- 秒数交给 `title`/`aria-label`,图标上不再压一个数字。
+ 磨砂圆底、边框和悬停填充全部由 `.hovertools button` 一条规则给出,
+ 58px 圆配 34px 图标,与 36px 圆配 21px 图标同一个比例。
+ 秒数交给 `title`/`aria-label`,图标上不压数字。
证据与「beeg 那一侧未取得」的结论见
`docs/reference-snapshots/hover-seek-controls-user-screenshot.md`。
"""
self.assertPageContains(
- ".hovertools.seektools button{border:0;background:none;backdrop-filter:none;")
- self.assertPageContains(".hovertools.seektools button svg{width:34px;height:34px;stroke-width:1.5}")
- self.assertPageContains(".hovertools.seektools button:hover{background:none}")
- # 命中区域仍由共用规则给出 58px 圆,裸图标只是不画它。
- self.assertPageContains(".hovertools button{pointer-events:none;width:58px;height:58px;border-radius:50%")
- # 数字角标随之退役:DOM 里不再有它,样式也不该留着。
+ ".hovertools button{pointer-events:none;width:58px;height:58px;border-radius:50%;"
+ "border:1px solid rgba(255,255,255,.12);")
+ self.assertPageContains("background:rgba(0,0,0,.24);color:#fff;backdrop-filter:saturate(180%) blur(12px);")
+ self.assertPageContains(".hovertools button:hover{transform:scale(1.12);background:rgba(0,0,0,.34)}")
+ self.assertPageContains(".hovertools.seektools button svg{width:34px;height:34px}")
+ self.assertPageContains(".hovertools .laterbtn{width:36px;height:36px;padding:0;font-family:inherit}")
+ self.assertPageContains(".hovertools .laterbtn svg{width:21px;height:21px}")
+ # 这一层里没有第二套外观:不画底和边、靠投影描边的写法一处都不留。
+ self.assertPageLacks(".hovertools.seektools button{border:0;background:none")
+ self.assertPageLacks("filter:drop-shadow(0 1px 4px rgba(0,0,0,.6))")
+ # 数字角标不在 DOM 里,样式也不留。
self.assertPageLacks("<b>${appSettings.seekSeconds}</b>")
self.assertPageLacks(".hovertools button b{")
self.assertPageContains('title="后退 ${appSettings.seekSeconds} 秒"')
@@ -5063,7 +5092,7 @@ class WebUiSourceTests(unittest.TestCase):
"""
self.assertPageContains(
'<div class="detailtitle">${srcBadge(it.location,it.cost,\'srcbig\')}\n'
- ' <div class="stitle">${javTitleHtml(it)}'
+ ' <div class="stitle">${javTitleHtml(it)}${partLabelBadge(it,queueContext)}'
'${it.location===\'online\'?\'\':`<span class="srctools detailtitletools">'
'${sourceToolButtons(it.id)}</span>`}</div></div>')
self.assertPageContains(".detailtitle{display:flow-root;margin-bottom:10px}")
@@ -5673,6 +5702,21 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(
':(x.is_jav&&x.code?`<img src="/cover?code=${encodeURIComponent(x.code)}"')
+ def test_the_detail_title_names_which_volume_is_playing(self):
+ """分卷队列里换一卷,右侧标题栏必须跟着变。
+
+ 同一部片的几卷共用文件名,标题、女优、厂牌逐字相同(实测 PPT-018 三卷)。
+ 标题栏不写卷号的话,点了队列里另一条,整栏看上去纹丝不动。卷号是「第几份
+ 文件」而不是版次,所以用中性灰,和无码/中字/破解三种版次色分开。
+ """
+ self.assertPageContains("const partLabelBadge=(it,queue)=>queue?.kind==='parts'&&it.part_label")
+ self.assertPageContains(
+ """? `<small class="javedition partlabel">第 ${esc(it.part_label)} 卷</small>`:'';""")
+ self.assertPageContains("${javTitleHtml(it)}${partLabelBadge(it,queueContext)}")
+ self.assertPageContains(".javedition.partlabel{color:var(--muted);margin-left:6px}")
+ # 队列条目那一侧本来就写着卷号,两处用的是同一个字段。
+ self.assertPageContains("queue.kind==='parts'?`第 ${esc(x.part_label)} 卷`")
+
def test_the_edition_queue_head_only_states_the_count(self):
"""标题栏已经写着「版本」,番号又印在正上方的详情标题里,说明只留数量。
diff --git a/web/app.js b/web/app.js
index 4ba4ddba0..c3d2c8a3e 100644
--- a/web/app.js
+++ b/web/app.js
@@ -1867,10 +1867,13 @@ function cardHtml(it,cls){
: (it.leave_ratio!=null?`<div class="scrub"><i style="width:${Math.round(it.leave_ratio*100)}%"></i></div>`:'');
const sizeText=Number(shownSize)>0?fmtSize(Number(shownSize)):'大小未知';
const tgs=(it.tags||[]).slice(0,3).map(x=>`<span class="tg general" data-tag="${esc(x)}">${esc(tagLabel(x))}</span>`).join('');
- const tools=`<button class="previewcounter" data-open title="打开预览" aria-label="打开预览">
+ const laterTool=`<div class="hovertools later-tools"><button class="laterbtn" data-later aria-pressed="${!!it.watch_later}" title="稍后看" aria-label="稍后看">
+ ${it.watch_later?icon('check'):icon('bookmark-plus')}</button></div>`;
+ /* 分卷卡悬浮翻的是各卷首帧,没有可控的视频:倒计时环和快退/快进那三颗留着的话,
+ 按下去找不到 `video.hv`,等于三颗空按钮压在正在翻的画面上。 */
+ const tools=parts?laterTool:`<button class="previewcounter" data-open title="打开预览" aria-label="打开预览">
<svg viewBox="-18 -18 36 36"><circle r="17"></circle><circle r="17"></circle></svg>${icon('play','ringplay')}</button>
- <div class="hovertools later-tools"><button class="laterbtn" data-later aria-pressed="${!!it.watch_later}" title="稍后看" aria-label="稍后看">
- ${it.watch_later?icon('check'):icon('bookmark-plus')}</button></div>
+ ${laterTool}
<div class="hovertools seektools">
<button data-seek="-${appSettings.seekSeconds}" title="后退 ${appSettings.seekSeconds} 秒" aria-label="后退 ${appSettings.seekSeconds} 秒">${icon('rotate-ccw')}</button>
<button data-seek="${appSettings.seekSeconds}" title="前进 ${appSettings.seekSeconds} 秒" aria-label="前进 ${appSettings.seekSeconds} 秒">${icon('rotate-cw')}</button>
@@ -1880,7 +1883,7 @@ function cardHtml(it,cls){
同样被折叠过的版次卡长得和普通卡一模一样,只有角标能看出来。 */
const stacked=parts||editions;
return `<article class="card ${stacked?'partcard ':''}${cls||''} ${it.disposal==='trash'?'pending-delete':''}" data-id="${it.id}"${parts?` data-part-seed="${parts.seed_id}"`:''}>
- ${stacked?'<div class="partstack">':''}<div class="pic" style="--card-ratio:${ar}">${thumb}<button class="cardopenhit" data-open aria-label="打开 ${esc(shownName)}${parts?'分卷':editions?'版本':'详情'}"></button>
+ ${stacked?'<div class="partstack">':''}<div class="pic" style="--card-ratio:${ar}">${thumb}${parts?'<div class="mixfaces" data-mix-faces hidden></div>':''}<button class="cardopenhit" data-open aria-label="打开 ${esc(shownName)}${parts?'分卷':editions?'版本':'详情'}"></button>
<div class="badge mono">${srcBadge(it.location,it.cost)}</div>
<span class="selectionMark">${icon('check')}</span><span class="deleteMark">${icon('trash')}<b>回收站</b></span>
${parts?`<span class="partbadge">${parts.count} 卷</span>`:''}${editions?`<span class="partbadge editionbadge" title="${esc(editions.editions.join(' · '))}">${editions.count} 个版本</span>`:''}<span class="dur mono">${fmtDur(shownDuration)}</span>${tr}${tools}</div>${stacked?'</div>':''}
@@ -2175,6 +2178,26 @@ function wireMixFlip(el,seedId){
.map(x=>mixFacePoster(x,layout,true));
});
}
+/* 分卷组每个 seed 只取一次:悬浮翻动和点开后的分卷队列用的是同一份。 */
+const partGroupCache=new Map();
+function partGroup(seedId){
+ if(!partGroupCache.has(seedId))
+ partGroupCache.set(seedId,api('/api/parts?id='+seedId)
+ .then(group=>{if(group.error)throw new Error(group.error);cache(group.items);return group})
+ .catch(error=>{partGroupCache.delete(seedId);throw error}));
+ return partGroupCache.get(seedId);
+}
+/* 分卷卡悬浮翻的是同一部片各卷的画面,和 Mix 用同一套时序与门槛。版次组不翻:
+ 有码、中字、无码是同一段画面的几个来源,翻过去前后两张几乎一样,看着像图卡住了,
+ 那种卡继续用分段视频预览。第一张是卡片自己的静止封面,翻进来的才不会跳取景。 */
+function wirePartFlip(el,it){
+ wireStackFlip(el,async()=>{
+ const items=await partGroup(it.part_group.seed_id).then(group=>group.items),layout=javLayout();
+ return [it,...items.filter(x=>x.id!==it.id)]
+ .filter(x=>mixHasPicture(x,layout)).slice(0,MIX_FLIP_FACES)
+ .map(x=>mixFacePoster(x,layout,true));
+ });
+}
/* 关注页的合集翻的是卡片渲染时就写进 DOM 的那几张缩略图:同一组媒体已经在
手上,悬浮不该再为动画发一次请求。第一张必须是静止封面本身,否则一翻就
露出取景差别。 */
@@ -2245,7 +2268,8 @@ function wireCards(root,onClick){
opener.dataset.openWired='1';
opener.onclick=e=>{e.stopPropagation();if(selectMode||e.shiftKey||e.ctrlKey||e.metaKey){e.preventDefault();toggleSelection(it.id,e.shiftKey);return}openCard(+el.dataset.id,el)};
});
- if(it&&(!it.medium||it.medium==='video'))wireHover(el,it);
+ if(it?.part_group)wirePartFlip(el,it);
+ else if(it&&(!it.medium||it.medium==='video'))wireHover(el,it);
});
}
@@ -6659,6 +6683,10 @@ async function loadShorts(requestSeq=loadRequestSeq,surface=surfaceToken(surface
/* 版次徽章的配色跟卡片标题上的那套走。多一个 `有码`:卡片上正片不加角标是对的
(没角标就是正片),但队列里两条并排时「什么都不写」等于让人自己猜哪条是哪条。 */
const EDITION_TONE={'中字':'subtitle','无码':'uncensored','无码破解':'cracked','有码':'censored'};
+/* 同一部片的几卷共用文件名,标题、女优、厂牌逐字相同:详情标题不写卷号的话,在队列里
+ 换一卷,右侧整栏看上去纹丝不动。卷号说的是「第几份文件」而不是版次,用中性灰。 */
+const partLabelBadge=(it,queue)=>queue?.kind==='parts'&&it.part_label
+ ? `<small class="javedition partlabel">第 ${esc(it.part_label)} 卷</small>`:'';
function queueHtml(queue,itemId){
const action=queue.kind==='mix'
? `<button data-save-mix title="保存为播放列表" aria-label="保存为播放列表">${icon('bookmark-plus')}</button>`
@@ -6715,9 +6743,9 @@ async function openParts(seedId,itemId=seedId,push=true,anchor=null){
if(push&&!previous)detailReturnPath=location.pathname+location.search;
let queue=previous;
if(!queue){
- const group=await api('/api/parts?id='+seedId);
- if(group.error){await openItem(itemId,true);return}
- queue={kind:'parts',seedId,title:`分卷 · ${group.title}`,items:group.items};cache(queue.items);
+ let group;
+ try{group=await partGroup(seedId)}catch(_e){await openItem(itemId,true);return}
+ queue={kind:'parts',seedId,title:`分卷 · ${group.title}`,items:group.items};
}
const chosen=queue.items.some(item=>item.id===itemId)?itemId:queue.items[0].id;
await openItem(chosen,false,queue,anchor);
@@ -6865,7 +6893,7 @@ async function openItem(id,push=true,queueContext=null,anchor=null){
</div>${queueContext?queueHtml(queueContext,it.id):''}
<div class="side"><div class="sidecontent">
<div class="detailtitle">${srcBadge(it.location,it.cost,'srcbig')}
- <div class="stitle">${javTitleHtml(it)}${it.location==='online'?'':`<span class="srctools detailtitletools">${sourceToolButtons(it.id)}</span>`}</div></div>
+ <div class="stitle">${javTitleHtml(it)}${partLabelBadge(it,queueContext)}${it.location==='online'?'':`<span class="srctools detailtitletools">${sourceToolButtons(it.id)}</span>`}</div></div>
${it.location==='online'?'':`<span class="srcstate detailtitlestate" aria-live="polite"></span>`}
<div class="smeta mono">
<span class="detailmetaitem">${icon('monitor')}<span>${it.width||'?'}×${it.height||'?'}</span></span>
diff --git a/web/css/12-cards.css b/web/css/12-cards.css
index 630d8bc19..b2ccccb03 100644
--- a/web/css/12-cards.css
+++ b/web/css/12-cards.css
@@ -164,15 +164,11 @@ img.hvframes{position:absolute;inset:0;width:100%;height:100%;object-fit:contain
.hovertools button svg{width:25px;height:25px;stroke:currentColor;fill:none;stroke-width:1.8;
stroke-linecap:round;stroke-linejoin:round}
.hovertools button:hover{transform:scale(1.12);background:rgba(0,0,0,.34)}
-/* 居中那三颗是盖在画面上的媒体控件,不是页面控件:三个 58px 的磨砂实心圆压在封面
- 正中,遮住的画面比按钮本身还多,而这一层出现的时候用户正在看的就是画面。改成裸
- 图标——命中区域仍是 58px 的圆,只是不再画出来;描边靠一层投影在浅色画面上保持
- 可读。秒数交给 title/aria-label,图标上不再压一个数字。
- 参考证据见 docs/reference-snapshots/hover-seek-controls-user-screenshot.md。 */
-.hovertools.seektools button{border:0;background:none;backdrop-filter:none;
- -webkit-backdrop-filter:none;filter:drop-shadow(0 1px 4px rgba(0,0,0,.6))}
-.hovertools.seektools button svg{width:34px;height:34px;stroke-width:1.5}
-.hovertools.seektools button:hover{background:none}
+/* 居中那三颗和右下角的「稍后看」是同一种控件,只是尺寸不同:共用磨砂圆底、同一条
+ 边框和同一档悬停填充,图标按 58/36 的比例放到 34px。裸图标在浅色封面上要靠投影
+ 才读得出,而投影本身又是这一层里唯一一处没有面的写法。秒数交给 title/aria-label,
+ 图标上不压数字。参考证据见 docs/reference-snapshots/hover-seek-controls-user-screenshot.md。 */
+.hovertools.seektools button svg{width:34px;height:34px}
.hovertools.later-tools{right:12px;bottom:12px}
.card.longhover .seektools button,.card:hover .later-tools button{pointer-events:auto}
.hovertools .laterbtn{width:36px;height:36px;padding:0;font-family:inherit}
@@ -308,6 +304,8 @@ body[data-density="dense"] .junkcard .junkactions button{justify-content:center}
.javedition.uncensored{color:var(--meter)}
.javedition.cracked{color:var(--drop)}
.javedition.censored{color:var(--muted)}
+/* 卷号说的是「这是第几份文件」,不是版次,用中性灰和三种版次色区分开。 */
+.javedition.partlabel{color:var(--muted);margin-left:6px}
.meta .s{display:flex;gap:8px;color:var(--muted);align-items:center;flex-wrap:wrap}
.meta .who{color:var(--ink-2);min-width:0;max-width:100%;display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
/* 没有实体链接的归属只是一段文字:番号、「未归属」这类值没有资料页可去。