Skip to content

armgit / peach

Public Imported from GitHub
0

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

播放器加入影院与氛围设置

longmeidao5f216e27d555
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 663b6261c..1c2ed9fb9 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -78,7 +78,7 @@ Claude 的 `.claude/settings.json` 已配置 Stop、StopFailure、SessionEnd hoo
**Vercel Tooltip/Collapse/Context Card/Projects/Analytics/Speed Insights 与 Geist Note/Progress/Switch/Fieldset/Scroller/Empty State(2026-08-30)**:登录态项目页确认搜索占剩余宽度、筛选为方形图标钮、主操作在右,菜单无展开动画且内部滚动;Analytics 与 Speed Insights 都使用「全局筛选或来源 Switch → 横向摘要指标带 → 主详情 → 同层 tablist 数据面板」层级,不把每个维度堆成独立 Bento。Peach 的统计页用真实库存、观看、覆盖和系统盘指标复用该层级;口味页以浏览器记录/Peach 内部作为真实证据来源,不伪造体验分或时间图。Tooltip 固定在视口内,来源菜单不得套用 Collapse motion,作者别名才使用 Collapse;短元数据浮层最多一个主动作,Escape 关闭并交还焦点,瞬时成功回执用 Toast,错误恢复留在原位置;Note 只放字段/卡片/分区旁的持久上下文,页面问题用 Banner;Progress 必须有真实 value/max 和 ARIA,Switch 只用于 2–3 个互斥视图,布尔值用 Toggle;Fieldset 同组卡片固定同高,变化正文放单一 Scroller,Footer 保持固定动作区;Empty State 必须把图标、标题、说明和可选动作收在同一组件,且与上方工具条保持统一间距。完整 URL、资源 SHA、浏览器失败与恢复路径和 Peach 差异见 `vercel-geist-semantics-measured.md`、`vercel-geist-note-progress-switch-analytics.md` 与 `vercel-geist-fieldset-scroller-empty-state.md`;实现门槛见 `peach-web-ui`。
**Vercel Command Menu/Search Input/Spinner/Loading Dots(2026-08-30)**:设置覆盖层使用锁定 Dialog CSS 的 350ms、`cubic-bezier(.4,0,.2,1)` 与 -40px 淡入轨迹,普通菜单仍无动画;Search Input 的搜索图标在查询期间原位换成 Spinner。用户直接触发的检查、加载、保存与应用使用 Spinner,后台抓取和扫描进度使用 Loading Dots;“没有更多历史内容”是中性、可关闭的 Note,不得登记为红色故障。证据哈希、未取得面与 Peach 差异见 `vercel-geist-command-search-loading.md`。
**Beeg 资料页(2026-08-30)**:Reislin 与 SweetieFox 页面证据锁定的顺序是头像与名称、简介、外部链接、关联艺人轨道、标签轨道、内容;轨道不另加可见标题。Peach 的女优/厂牌资料页和关注页复用这个阅读顺序;资料页有照片时只显示一个 32×32px `PicsIcon`,放在标签左侧,选中代表照片视图,再点一次回到视频,不保留独立的「视频/照片」文字标签栏。合集详情继续使用普通详情的左媒体、右信息,下方另设 Mix/分卷/播放列表/多视频的横向切换带。锁定样式摘要、哈希、未取得面和主动差异见 `beeg-profile-layout.md`。
-YouTube Shorts 沉浸页使用用户截图记录 `docs/reference-snapshots/youtube-shorts-immersive-user-screenshot.md`:竖屏复用中央 9:16 舞台和外置动作列,横屏使用在整个视口视觉居中的 16:9 舞台并把动作列收进视频右侧;Peach 保留自己的反馈语义,不复制订阅或社交动作。沉浸视频每次加载都要带独立 `session`,切片、关闭、失败和页面离开时取消旧会话;只清浏览器的 `src` 不足以停止 CloudDrive 预读或 FFmpeg。普通播放器控制栏另使用用户截图记录 `docs/reference-snapshots/youtube-player-controls-user-screenshot.md`:进度独占上排,播放/音量/时间在左下,画中画/清晰度/全屏合并为右下分段胶囊;已播段、圆点和卡片观看进度统一使用 Peach 蓝。键盘仍按设置前后跳转,控制栏不重复画 10 秒按钮;本地时刻预览复用九宫格接触表,在线视频只显示时刻。Peach 不复制没有实际能力的字幕、剧院模式或自动播放按钮。
+YouTube Shorts 沉浸页使用用户截图记录 `docs/reference-snapshots/youtube-shorts-immersive-user-screenshot.md`:竖屏复用中央 9:16 舞台和外置动作列,横屏使用在整个视口视觉居中的 16:9 舞台并把动作列收进视频右侧;Peach 保留自己的反馈语义,不复制订阅或社交动作。沉浸视频每次加载都要带独立 `session`,切片、关闭、失败和页面离开时取消旧会话;只清浏览器的 `src` 不足以停止 CloudDrive 预读或 FFmpeg。普通播放器控制栏另使用用户截图与 YouTube 官方帮助记录 `docs/reference-snapshots/youtube-player-controls-user-screenshot.md`:进度独占上排,播放/音量/时间在左下,画中画/设置/影院/全屏在右下使用同高圆形按钮;已播段、圆点和卡片观看进度统一使用 Peach 蓝。键盘仍按设置前后跳转,控制栏不重复画 10 秒按钮;本地时刻预览复用九宫格接触表,在线视频只显示时刻。设置浮层只列真实能力:氛围模式全局开关、播放速度和实际清晰度;影院模式用按钮或 `T` 切换为大播放器,详情移到下方。Peach 不复制没有实际能力的字幕、睡眠定时或自动播放按钮。
F95 masked 链接与 Gofile 文件列表的凭据边界见 `f95-masked-gofile-media`;Mix 只按已解析且
可播放的视频计数,不按回复数或网盘页数计数。
FANBOX 多图、Gofile Bearer API、Paheal 标签页与跨站出处键见
diff --git a/docs/REUSE.md b/docs/REUSE.md
index 2af2d0f54..ba39d391a 100644
--- a/docs/REUSE.md
+++ b/docs/REUSE.md
@@ -42,6 +42,7 @@
| FC2 跨号证据 | 已缓存的 fc2cmadb 评论收获 + Peach ledger 媒体事实 | 稳定 pair、合集/分片保护、hash/时长/尺寸佐证、库外 evidence、健康统计和人工复核;不依赖 FC2-Leak-Detector/JavSP |
| 媒体探测/转码 | Peach 管理的 FFmpeg/ffprobe | 任务策略和 Media Engine 编排 |
| HTML5/HLS/DASH 播放 | Video.js 8.24.0 + 内置 VHS(Apache-2.0,本地固定版本) | 流方案、授权、稳定时长、回退顺序和统计面板 |
+| 播放器设置与影院布局 | Video.js 8.24.0 的 `playbackRate`、既有 QualityLevel 与原生控制栏插槽 | Peach 组合氛围模式、播放速度、真实清晰度和影院模式;不迁移到 Video.js 10 Menu,也不引入重复现有质量选择的插件 |
| 播放器时刻预览 | Video.js 原生进度控件 + Peach 既有 `/poster?id=&c=0…8` 九宫格切片 | 本地媒体用已有接触表提供近似时刻缩略图;在线视频只显示时刻。`videojs-vtt-thumbnails` 与 `videojs-sprite-thumbnails` 都要求另建 sprite/VTT 契约,本项目不为已有能力新增依赖或重复抽帧 |
| 分卷文件命名 | [Plex 官方命名](https://support.plex.tv/articles/naming-and-organizing-your-movie-media-files/)的 `cd/disc/disk/dvd/part/pt + 数字` 与 [Kodi 官方 File Stacking](https://kodi.wiki/view/File_stacking)只作行为证据;运行时复用当前树的 `part_marker`,不新增扫描器依赖 | 兼容馆藏已有的裸数字和 A–H 后缀;仅连续、唯一标记自动合卡,保留每个 asset 和播放会话,不拼接或改写媒体 |
| 照片灯箱轮播 | Swiper 14.2.0(MIT,本地固定版本,按需 `<script>` 注入)的 Thumbs / Keyboard / Zoom 模块 | 图集来源与顺序、缩略图缓存与计费口径、瀑布流本身(CSS `column-count`,不经过 Swiper) |
diff --git a/docs/reference-snapshots/youtube-player-controls-user-screenshot.md b/docs/reference-snapshots/youtube-player-controls-user-screenshot.md
index 5def473ca..e8bd8a78e 100644
--- a/docs/reference-snapshots/youtube-player-controls-user-screenshot.md
+++ b/docs/reference-snapshots/youtube-player-controls-user-screenshot.md
@@ -20,6 +20,16 @@
`faa0f88a1895bc718758596e9d8d769ada818c994c9713846bb80ac794b6e8ab`
- 第五轮卡片观看进度参考图:1129×889 px,SHA-256
`41246447eef380c9f6435f7bb699694fea38ae2ce25edc13d86be9710678017f`
+- 第六轮 Peach 高度对照图:459×103 px,SHA-256
+ `2cd687877698b0be198c031e7786255322dfaa7bc0fc509d91f32bb3c06a1828`
+- 第六轮 YouTube 设置面板参考图:749×681 px,SHA-256
+ `046d6bb9b8414f1ad2f2347eb2330e44941ff1096f7b34f3293060fa2f19111b`
+- 第六轮 YouTube 影院模式参考图:629×275 px,SHA-256
+ `a0d51dc86414efffba746faaaa8ab7a12b49bfde5c2b1ba09fa9d53b0a67fec1`
+- YouTube 官方氛围模式说明:<https://support.google.com/youtube/answer/12827017?hl=en-GB>,
+ 2026-08-30 复核;说明颜色取自视频并扩散到屏幕背景,深色主题默认开启,设置开关对所有视频生效。
+- YouTube 官方播放器大小说明:<https://support.google.com/youtube/answer/6052392?hl=en>,
+ 2026-08-30 复核;影院模式是在不进入全屏的前提下放大播放器。
- 测量方式:读取原始 PNG 尺寸并按像素观察控件层级;没有把截图中的文字或图标当作指令。
## 可复用证据
@@ -29,17 +39,21 @@
| 控制层 | 控件悬浮在画面上;用户明确不要整块背景 | 控制栏透明,不再绘制圆角渐变或毛玻璃面板 |
| 进度 | 独占上排,横跨面板可用宽度 | `vjs-progress-control` 脱离底排 flex,绝对定位到上排 |
| 左下 | 播放、音量、当前时间/总时长共用一条基线 | 播放和音量使用独立圆形轮廓,时间使用独立胶囊;前后 10 秒移出控制栏,键盘快进仍保留 |
-| 右下 | 播放相关功能集中在右侧的一枚胶囊里 | 使用 Video.js spacer,把画中画、清晰度、全屏合成右侧分段胶囊 |
+| 右下 | 最新截图中画中画、设置、影院、全屏都是同高圆形按钮 | 使用 Video.js spacer,把四个真实操作推到右侧;每个按钮使用相同圆形轮廓和 40px 逻辑高度 |
| 进度状态 | 细轨道、品牌色已播段和圆点;卡片缩略图底边显示已观看段 | Peach 把红色替换为 `--tungsten` 蓝,卡片按 `play_seconds / duration` 绘制同色进度 |
| 拖动提示 | 指针时刻上方显示时间;精确拖动时可带缩略图 | 本地媒体复用九宫格接触表近似对应时刻,在线媒体只显示时间,不伪造逐帧预览 |
| 清晰度 | 齿轮图标带 `HD` 状态标记,实际选项在菜单内 | 齿轮显示 `HD`/`4K`,菜单继续只列媒体真实分辨率 |
| 中央播放 | 半透明黑色圆形底、居中的白色三角 | 覆盖 Video.js 默认矩形按钮,使用圆形底与 CSS 白色三角 |
| 中央反馈 | 用户补充中央不只播放,还要暂停;左右跳转也统一为圆形 | 三枚圆形按钮覆盖后退/播放或暂停/前进,播放中唤出控制层显示暂停图标 |
| 左上工具 | 用户要求与播放器按钮统一 | 播放统计键使用相同的 40 px 圆形轮廓、底色和悬停反馈 |
+| 左上状态 | Peach 对照图中统计圆钮约 80px 高,加载速度约 75px 高 | CSS 固定两者为相同 40px 逻辑高度、相同 `top:11px` 和 `box-sizing:border-box` |
+| 设置面板 | 圆角半透明浮层,主层展示氛围模式、播放速度、清晰度;子层选择实际值 | Peach 复用现有清晰度等级和 Video.js `playbackRate`,加入同层氛围开关与返回式子菜单;不画没有实现的睡眠定时 |
+| 影院模式 | 独立图标按钮,悬停提示包含 `T` 快捷键 | 宽屏切为单列大播放器,详情和队列移到播放器下方;按钮、`T` 键和持久设置共用同一状态 |
+| 氛围模式 | 官方说明为视频颜色扩散到背景,深色主题默认开,可在设置中为所有视频关闭 | Peach 原有 32×18 当前帧取色、模糊画布方向一致;补全全局持久开关,并让本地和在线视频共用 |
| 窄屏 | 截图未提供 | Peach 保留两排结构,隐藏 10 秒按钮以避免横向溢出 |
## Peach 主动保留的差异
-- 不复制 YouTube 品牌、字幕、剧院模式和自动播放开关;没有真实能力就不画假按钮。
-- 保留 Video.js、键盘前后跳转、画中画、全屏和真实清晰度菜单;控制栏不再重复画前后 10 秒按钮。
+- 不复制 YouTube 品牌、字幕、睡眠定时和自动播放开关;没有真实能力就不画假按钮。
+- 保留 Video.js、键盘前后跳转、画中画、影院模式、全屏和真实清晰度菜单;控制栏不再重复画前后 10 秒按钮。
- 单一路源只显示实测分辨率或原画;`HD`/`4K` 只是当前媒体等级标记,不伪造可切换线路。
diff --git a/docs/reference-sources.json b/docs/reference-sources.json
index 381b87fc7..d785e54da 100644
--- a/docs/reference-sources.json
+++ b/docs/reference-sources.json
@@ -167,6 +167,22 @@
"tests/test_follow_web.py",
"tests/test_web_ui.py"
]
+ },
+ {
+ "id": "youtube-player-controls-user-screenshot",
+ "name": "YouTube 播放器控件、设置、影院与氛围模式证据",
+ "url": "https://support.google.com/youtube/answer/12827017?hl=en-GB",
+ "snapshot": "docs/reference-snapshots/youtube-player-controls-user-screenshot.md",
+ "checked_on": "2026-08-30",
+ "sha256": "5882f99e6465cd2539b187fa967ab5cdd2f0409247accc437dfe16f1c71ee004",
+ "role": "用户截图锁定播放器控件几何与设置面板;YouTube 官方帮助锁定氛围模式和影院模式语义。",
+ "consumers": [
+ "web/app.css",
+ "web/app.js",
+ "web/index.html",
+ "tests/test_follow_web.py",
+ "tests/test_web_ui.py"
+ ]
}
]
}
diff --git a/scripts/vendor_web_dependencies.mjs b/scripts/vendor_web_dependencies.mjs
index 5304c0811..2b9a15ed5 100644
--- a/scripts/vendor_web_dependencies.mjs
+++ b/scripts/vendor_web_dependencies.mjs
@@ -62,7 +62,8 @@ const lucideIcons = new Map([
["layout-grid", "layout-grid"], ["square-check-big", "square-check-big"],
["refresh-cw", "refresh-cw"], ["user-round", "user-round"], ["tags", "tags"],
["star", "star"], ["list-filter", "list-filter"], ["chart", "chart-no-axes-column"],
- ["settings", "settings"], ["history", "history"], ["sparkles", "sparkles"],
+ ["settings", "settings"], ["monitor-cog", "monitor-cog"], ["gauge", "gauge"],
+ ["history", "history"], ["sparkles", "sparkles"],
["x", "x"], ["folder-open", "folder-open"], ["info", "info"],
["hard-drive", "hard-drive"], ["globe", "globe"], ["rss", "rss"],
["thumbs-up", "thumbs-up"], ["thumbs-down", "thumbs-down"], ["eye", "eye"],
diff --git a/tests/test_follow_web.py b/tests/test_follow_web.py
index f2da53a67..31cdaa2e5 100644
--- a/tests/test_follow_web.py
+++ b/tests/test_follow_web.py
@@ -1453,13 +1453,16 @@ class FollowWebSourceTests(unittest.TestCase):
def test_follow_video_uses_the_shared_videojs_player_and_quality_control(self):
self.assertPageContains('class="video-js vjs-big-play-centered" controls playsinline preload="metadata"')
- self.assertPageContains("if(followVideo)mountDetailPlayer(item,followVideo,false,{")
+ self.assertPageContains("if(followVideo){const followPlayer=mountDetailPlayer(item,followVideo,false,{")
self.assertPageContains("source:{src,type:selectedMedia?.media_type||item.media_type||'video/mp4'}")
self.assertPageContains("function mountPlayerQualityControl(player,video,fallbackHeight=0)")
- self.assertPageContains('aria-label="切换清晰度"')
+ self.assertPageContains('aria-label="播放器设置"')
self.assertPageContains("data-player-quality-badge")
self.assertPageContains("currentTimeDisplay:true,timeDivider:true")
self.assertPageContains("levels[index].enabled=selected==='auto'||selected===String(index)")
+ self.assertPageContains("const stopFollowAmbient=mountPlayerAmbient(followVideo)")
+ self.assertPageContains("followPlayer?.one?.('dispose',stopFollowAmbient)")
+ self.assertPageContains("mountPlayerTheaterControl(player,root)")
def test_follow_detail_save_keeps_the_button_after_the_async_request(self):
self.assertPageContains("const button=event.currentTarget;")
diff --git a/tests/test_reference_updates.py b/tests/test_reference_updates.py
index 0bf2a03f5..8e5e31146 100644
--- a/tests/test_reference_updates.py
+++ b/tests/test_reference_updates.py
@@ -33,7 +33,8 @@ class ReferenceUpdateTests(unittest.TestCase):
"f95-masked-gofile-media", "follow-fanbox-gofile-paheal",
"fanbox-browser-transport", "beeg-profile-layout",
"vercel-geist-fieldset-scroller-empty-state",
- "vercel-geist-command-search-loading"},
+ "vercel-geist-command-search-loading",
+ "youtube-player-controls-user-screenshot"},
)
self.assertNotEqual(
sources["vercel-report-design"]["url"],
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index bfb029131..2ea3485d0 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -567,7 +567,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".vwrap>video[hidden]{display:none}")
self.assertPageContains(".gate{aspect-ratio:16/9;width:100%")
self.assertPageContains(
- "else if(g)g.onclick=()=>{vv.hidden=false;g.remove();mountDetailPlayer(it,vv,true)"
+ "else if(g)g.onclick=()=>{vv.hidden=false;g.remove();const mounted=mountDetailPlayer(it,vv,true)"
)
def test_detail_uses_pinned_videojs_and_authoritative_duration(self):
@@ -582,8 +582,9 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".vwrap .video-js .vjs-control-bar>.vjs-play-control,")
self.assertPageContains("border:1px solid rgba(255,255,255,.2);border-radius:50%;background:rgba(0,0,0,.56)")
self.assertPageContains(".vwrap .video-js .vjs-control-bar>.vjs-picture-in-picture-control,")
- self.assertPageContains("border-radius:2em 0 0 2em")
- self.assertPageContains("border-radius:0 2em 2em 0")
+ self.assertPageContains(".vwrap .video-js .vjs-control-bar>.vjs-peach-settings,")
+ self.assertPageContains(".vwrap .video-js .vjs-control-bar>.vjs-peach-theater,")
+ self.assertPageContains("border:1px solid rgba(255,255,255,.2);border-radius:50%;margin-inline:.18em")
self.assertPageContains(".vwrap .video-js .vjs-progress-control{position:absolute;left:1.2em;right:1.2em;top:.45em")
self.assertPageContains(".vwrap .video-js .vjs-play-progress{background:var(--tungsten)}")
self.assertPageContains(".vwrap .video-js .vjs-play-progress:before{content:\"\"")
@@ -595,7 +596,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".vwrap .video-js.vjs-layout-small .vjs-current-time")
self.assertPageContains("currentTimeDisplay:true,timeDivider:true")
self.assertPageContains("durationDisplay:true,remainingTimeDisplay:false")
- self.assertPageContains(".vjs-peach-quality [data-player-quality-badge]")
+ self.assertPageContains(".vjs-peach-settings [data-player-quality-badge]")
self.assertPageContains("${icon('settings')}")
self.assertPageContains("typeof player.qualityLevels==='function'?player.qualityLevels():null")
self.assertPageContains("activePixels>=2160?'4K':activePixels>=720?'HD':''")
@@ -635,6 +636,27 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(".playerstatsbtn{position:absolute;left:11px;top:11px;z-index:8;width:40px;height:40px")
self.assertPageContains("border:1px solid rgba(255,255,255,.2);border-radius:50%")
self.assertPageContains(".playerstatsbtn:hover{background:rgba(0,0,0,.76)")
+ self.assertPageContains(".playernet{box-sizing:border-box;position:absolute;left:58px;top:11px;z-index:8;height:40px;min-height:40px")
+
+ def test_player_settings_match_real_ambient_speed_and_quality_capabilities(self):
+ self.assertPageContains("class=\"vjs-peach-settings-menu\" role=\"menu\" aria-label=\"播放器设置\"")
+ self.assertPageContains('role="menuitemcheckbox" data-player-ambient')
+ self.assertPageContains("<span>氛围模式</span>")
+ self.assertPageContains("<span>播放速度</span>")
+ self.assertPageContains("<span>清晰度</span>")
+ self.assertPageContains("player.playbackRate(Number(button.dataset.playerSpeedOption))")
+ self.assertPageContains("applyAmbientMode(!appSettings.ambientMode)")
+ self.assertPageContains(".vjs-peach-settings-menu{position:absolute;right:-4.5em")
+ self.assertPageLacks("睡眠定时")
+
+ def test_theater_mode_has_button_tooltip_keyboard_and_responsive_layout(self):
+ self.assertPageContains("function mountPlayerTheaterControl(player,settingsRoot)")
+ self.assertPageContains('data-player-theater aria-label="影院模式"')
+ self.assertPageContains("影院模式 <kbd>T</kbd>")
+ self.assertPageContains("if(e.key==='t'||e.key==='T')")
+ self.assertPageContains(".stage.theater-mode .sgrid{grid-template-columns:minmax(0,1fr)}")
+ self.assertPageContains('grid-template-areas:"media" "side" "queue"')
+ self.assertPageContains('id="i-theater-mode"')
def test_player_stats_cover_direct_range_and_future_segmented_streams(self):
self.assertPageContains('id="playerStatsBtn"')
@@ -1618,6 +1640,8 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("appSettings.seekSeconds")
self.assertPageContains("appSettings.searchHistoryLimit")
self.assertPageContains("appSettings.relatedLimit")
+ self.assertPageContains("appSettings.ambientMode=appSettings.ambientMode!==false")
+ self.assertPageContains("appSettings.theaterMode=appSettings.theaterMode===true")
self.assertPageContains('id="followScheduleSetting"')
self.assertPageContains("api('/api/follow/schedule'")
self.assertPageContains('id="sidebarOrderSetting"')
@@ -1640,7 +1664,7 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains("if(DIRECT_MANAGE_NAV[k]){openManage(DIRECT_MANAGE_NAV[k]);return}")
self.assertPageContains(".settingscard{display:flex;flex-direction:column;width:min(520px,100%);max-height:min(720px,90vh);max-height:min(720px,90dvh);overflow:hidden")
self.assertPageContains(".settingsscroll{flex:1;min-height:0;overflow-y:auto")
- self.assertPageLacks('id="ambientSetting"')
+ self.assertPageContains("document.dispatchEvent(new CustomEvent('peachambientchange'")
self.assertPageContains("color:#f5f7fa;color-scheme:dark")
def test_search_menu_has_local_history_and_recommendations(self):
@@ -1657,6 +1681,8 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains('class="ambientcanvas"')
self.assertPageContains("requestVideoFrameCallback")
self.assertPageContains("--video-glow")
+ self.assertPageContains("function mountPlayerAmbient(video)")
+ self.assertPageContains(".stage:not(.ambient-on) .ambientcanvas{display:none}")
self.assertPageContains("视频 ID / 会话")
self.assertPageContains("/api/quality-goal")
self.assertPageContains('id="betterVersion"')
diff --git a/web/app.css b/web/app.css
index 9d7c69d93..5032d6937 100644
--- a/web/app.css
+++ b/web/app.css
@@ -865,6 +865,7 @@ body[data-density="dense"] .card .meta .watchcount{display:none}
background:radial-gradient(circle at 28% 24%,color-mix(in srgb,var(--video-glow,#15202a) 40%,transparent),transparent 58%),
color-mix(in srgb,var(--surface) 88%,transparent);scroll-margin-top:calc(var(--topH) + 8px);
border:1px solid var(--line);overflow:hidden}
+.stage:not(.ambient-on){background:color-mix(in srgb,var(--surface) 88%,transparent)}
.stage[hidden]{display:none}
body.detail-open .tagbar{position:relative;top:auto;z-index:1}
body.entity-open #tiers,body.entity-open #tagbar,
@@ -922,6 +923,11 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
@media (min-width:1081px){
.sgrid.mixgrid>.vwrap{align-self:stretch}
.sgrid.mixgrid>.vwrap>.gate{height:100%;aspect-ratio:auto}
+ .stage.theater-mode .sgrid{grid-template-columns:minmax(0,1fr)}
+ .stage.theater-mode .sgrid:not(.mixgrid)>.side{grid-column:1;border-left:0;border-top:1px solid var(--line-soft)}
+ .stage.theater-mode .sgrid.mixgrid{grid-template-areas:"media" "side" "queue"}
+ .stage.theater-mode .sidecontent:is(*){height:auto;max-height:none}
+ .stage.theater-mode .vwrap>.video-js,.stage.theater-mode .vwrap>video{max-height:calc(100vh - var(--topH) - 56px)}
}
/* 横向队列把标题和摘要视为一个信息块,保存入口紧跟整个信息块并垂直居中。 */
.sgrid.mixgrid>.mixqueue .mixqueuehead{grid-template-columns:max-content max-content minmax(0,1fr);gap:5px 8px}
@@ -931,6 +937,7 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
.ambientcanvas{position:absolute;z-index:0;inset:-34px;width:calc(100% + 68px);height:calc(100% + 68px);
filter:blur(46px) saturate(1.45);opacity:.42;transform:scale(1.06);pointer-events:none;
mask-image:radial-gradient(ellipse at center,#000 28%,rgba(0,0,0,.72) 55%,transparent 86%);-webkit-mask-image:radial-gradient(ellipse at center,#000 28%,rgba(0,0,0,.72) 55%,transparent 86%)}
+.stage:not(.ambient-on) .ambientcanvas{display:none}
.vwrap>video,.vwrap>.video-js{position:relative;z-index:1}
.vwrap video{width:100%;max-height:76vh;display:block}
/* 计费来源点击前只显示拉流入口。显式 display:block 会覆盖浏览器的 hidden 默认样式,
@@ -960,8 +967,7 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
.vjs-peach-center-pause{display:none;gap:.62em}.vjs-peach-center-pause i{display:block;width:.62em;height:2.2em;border-radius:.12em;background:#fff}
.vjs-peach-center-controls[data-state="pause"] .vjs-peach-center-play{display:none}
.vjs-peach-center-controls[data-state="pause"] .vjs-peach-center-pause{display:flex}
-/* YouTube 式两排控制层:进度独占上排,底排不铺整块面板;播放、音量与时间在左,
- 画中画、清晰度、全屏合成右侧一枚分段胶囊。 */
+/* YouTube 式两排控制层:进度独占上排,底排不铺整块面板;所有图标按钮保持同一圆形和高度。 */
.vwrap .video-js .vjs-control-bar{box-sizing:border-box;left:.8em;right:.8em;bottom:.7em;width:auto;height:7em;
padding:2.8em .7em .3em;display:flex;align-items:flex-end;border-radius:0;background:transparent;backdrop-filter:none}
.vwrap .video-js .vjs-control-bar>.vjs-play-control,
@@ -972,16 +978,14 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
.vwrap .video-js .vjs-control-bar>.vjs-play-control:hover,
.vwrap .video-js .vjs-volume-panel>.vjs-mute-control:hover{background:rgba(0,0,0,.76);border-color:rgba(255,255,255,.38)}
.vwrap .video-js .vjs-control-bar>.vjs-picture-in-picture-control,
-.vwrap .video-js .vjs-control-bar>.vjs-peach-quality,
+.vwrap .video-js .vjs-control-bar>.vjs-peach-settings,
+.vwrap .video-js .vjs-control-bar>.vjs-peach-theater,
.vwrap .video-js .vjs-control-bar>.vjs-fullscreen-control{align-self:flex-end;width:4em;height:4em;margin:0;
- border:1px solid rgba(255,255,255,.2);border-left:0;border-right:0;border-radius:0;
+ border:1px solid rgba(255,255,255,.2);border-radius:50%;margin-inline:.18em;
background:rgba(0,0,0,.56);box-shadow:0 1px 5px #0006}
-.vwrap .video-js .vjs-control-bar>.vjs-picture-in-picture-control{border-left:1px solid rgba(255,255,255,.2);border-radius:2em 0 0 2em}
-.vwrap .video-js .vjs-control-bar:not(:has(>.vjs-picture-in-picture-control:not(.vjs-hidden)))>.vjs-peach-quality{
- border-left:1px solid rgba(255,255,255,.2);border-radius:2em 0 0 2em}
-.vwrap .video-js .vjs-control-bar>.vjs-fullscreen-control{border-right:1px solid rgba(255,255,255,.2);border-radius:0 2em 2em 0}
.vwrap .video-js .vjs-control-bar>.vjs-picture-in-picture-control:hover,
-.vwrap .video-js .vjs-control-bar>.vjs-peach-quality:hover,
+.vwrap .video-js .vjs-control-bar>.vjs-peach-settings:hover,
+.vwrap .video-js .vjs-control-bar>.vjs-peach-theater:hover,
.vwrap .video-js .vjs-control-bar>.vjs-fullscreen-control:hover{background:rgba(0,0,0,.76)}
.vwrap .video-js .vjs-progress-control{position:absolute;left:1.2em;right:1.2em;top:.45em;width:auto;height:2.2em;
min-width:0;display:flex;align-items:center}
@@ -1006,15 +1010,30 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
.vwrap .video-js .vjs-current-time{display:flex;margin-left:.35em;padding-left:1em;border:1px solid rgba(255,255,255,.2);border-right:0;border-radius:2em 0 0 2em}
.vwrap .video-js .vjs-time-divider{display:flex;min-width:auto;padding:0 .25em;border-top:1px solid rgba(255,255,255,.2);border-bottom:1px solid rgba(255,255,255,.2)}
.vwrap .video-js .vjs-duration{display:flex;padding-right:1em;border:1px solid rgba(255,255,255,.2);border-left:0;border-radius:0 2em 2em 0}
-.vjs-peach-quality{position:relative;flex:0 0 auto;width:4em!important;min-width:4em}
-.vjs-peach-quality>button{position:relative;width:100%;height:100%;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;display:grid;place-items:center}
-.vjs-peach-quality>button svg{width:2.1em;height:2.1em;stroke:currentColor;fill:none;stroke-width:2}
-.vjs-peach-quality [data-player-quality-badge]{position:absolute;right:.15em;top:.05em;min-width:1.7em;height:1.2em;padding:0 .2em;
+.vjs-peach-settings,.vjs-peach-theater{position:relative;flex:0 0 auto;width:4em!important;min-width:4em}
+.vjs-peach-settings>button,.vjs-peach-theater>button{position:relative;width:100%;height:100%;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;display:grid;place-items:center}
+.vjs-peach-settings>button>svg,.vjs-peach-theater>button>svg{width:2.1em;height:2.1em;stroke:currentColor;fill:none;stroke-width:2}
+.vjs-peach-settings [data-player-quality-badge]{position:absolute;right:.15em;top:.05em;min-width:1.7em;height:1.2em;padding:0 .2em;
display:grid;place-items:center;border-radius:.2em;background:#f03;color:#fff;font-size:.72em;font-weight:800;line-height:1}
-.vjs-peach-quality [data-player-quality-badge][hidden]{display:none}
-.vjs-peach-quality-menu{position:absolute;right:0;bottom:calc(100% + 8px);min-width:92px;padding:5px;border:1px solid rgba(255,255,255,.2);border-radius:8px;background:rgba(8,10,14,.94);box-shadow:0 10px 30px #0008}
-.vjs-peach-quality-menu[hidden]{display:none}.vjs-peach-quality-menu button{display:block;width:100%;padding:7px 9px;border:0;border-radius:5px;background:transparent;color:#fff;text-align:left;font:inherit;cursor:pointer;white-space:nowrap}
-.vjs-peach-quality-menu button:hover,.vjs-peach-quality-menu button[aria-checked="true"]{background:rgba(255,255,255,.14)}
+.vjs-peach-settings [data-player-quality-badge][hidden]{display:none}
+.vjs-peach-settings-menu{position:absolute;right:-4.5em;bottom:calc(100% + 12px);width:min(34em,calc(100vw - 28px));max-height:min(42em,calc(100vh - 130px));overflow:auto;
+ padding:.8em;border:1px solid rgba(255,255,255,.2);border-radius:2.2em;background:rgba(25,25,25,.82);box-shadow:0 12px 36px #0009;backdrop-filter:blur(18px) saturate(1.2)}
+.vjs-peach-settings-menu[hidden]{display:none}
+.vjs-peach-settings-menu button{box-sizing:border-box;width:100%;min-height:5.8em;padding:0 1.4em;border:0;border-radius:1.3em;background:transparent;color:#fff;font:inherit;cursor:pointer}
+.vjs-peach-settings-menu button:hover,.vjs-peach-settings-menu button:focus-visible{background:rgba(255,255,255,.14)}
+.vjs-peach-menu-row{display:grid;grid-template-columns:3.2em minmax(0,1fr) auto 1.5em;gap:.8em;align-items:center;text-align:left}
+.vjs-peach-menu-row>svg{width:2.6em;height:2.6em;stroke:currentColor;fill:none}.vjs-peach-menu-row>span{font-size:1.55em}.vjs-peach-menu-row>b{font-size:1.35em;font-weight:400;color:#ddd;white-space:nowrap}
+.vjs-peach-menu-row[data-player-ambient]{grid-template-columns:3.2em minmax(0,1fr) auto}.vjs-peach-switch{position:relative;width:4.4em;height:2.6em;border-radius:1.5em;background:rgba(255,255,255,.32)}
+.vjs-peach-switch:after{content:"";position:absolute;top:.3em;left:.3em;width:2em;height:2em;border-radius:50%;background:#fff;transition:transform .14s ease}
+.vjs-peach-menu-row[aria-checked="true"] .vjs-peach-switch{background:var(--tungsten)}.vjs-peach-menu-row[aria-checked="true"] .vjs-peach-switch:after{transform:translateX(1.8em)}
+.vjs-peach-menu-back{display:flex;align-items:center;gap:1em;text-align:left;border-bottom:1px solid rgba(255,255,255,.14)!important;border-radius:1.3em 1.3em 0 0!important}
+.vjs-peach-menu-back svg{width:2.2em;height:2.2em}.vjs-peach-menu-back span{font-size:1.55em;font-weight:600}
+.vjs-peach-menu-option{display:flex;align-items:center;justify-content:space-between;text-align:left;font-size:1.35em!important}
+.vjs-peach-menu-option span,.vjs-peach-menu-option svg{width:1.5em;height:1.5em}
+.vjs-peach-tooltip{position:absolute;right:50%;bottom:calc(100% + 1em);transform:translateX(50%);display:none;align-items:center;gap:.45em;padding:.65em .85em;border-radius:.75em;background:rgba(40,40,40,.88);box-shadow:0 4px 14px #0007;white-space:nowrap;font-size:1.25em;font-weight:600;pointer-events:none}
+.vjs-peach-tooltip kbd{display:inline-grid;place-items:center;min-width:1.55em;height:1.55em;border:1px solid rgba(255,255,255,.42);border-radius:.35em;font:inherit}
+.vjs-peach-theater>button:hover .vjs-peach-tooltip,.vjs-peach-theater>button:focus-visible .vjs-peach-tooltip{display:flex}
+.vjs-peach-theater>button[aria-pressed="true"]{background:color-mix(in srgb,var(--tungsten) 72%,#000)}
@media (max-width:640px){
.vwrap .video-js .vjs-control-bar{left:.4em;right:.4em;bottom:.4em;height:6.6em;padding:2.5em .15em .15em}
.vwrap .video-js .vjs-progress-control,.vwrap .video-js.vjs-layout-tiny .vjs-progress-control,
@@ -1025,6 +1044,7 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
.vjs-peach-seek-preview img{width:160px}
.vjs-peach-center-controls{gap:.8em}.vjs-peach-center-controls button{width:4em;height:4em}
.vjs-peach-center-controls .vjs-peach-center-toggle{width:4.8em;height:4.8em}
+ .vjs-peach-settings-menu{right:-8.7em;width:min(31em,calc(100vw - 16px));border-radius:1.7em}
}
.vwrap .video-js.vjs-error .vjs-error-display .vjs-modal-dialog-content{
display:flex;align-items:center;justify-content:center;padding:56px 24px;text-align:center;overflow-wrap:anywhere}
@@ -1044,7 +1064,7 @@ body.index-open #tiers,body.index-open #tagbar{display:none}
backdrop-filter:saturate(1.25) blur(14px);font:var(--fs-xs)/1.5 "Cascadia Mono",monospace}
.playerstats dl{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:1px 12px;margin:0}.playerstats dt{text-align:right;font-weight:700}.playerstats dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.playerstats[hidden]{display:none}
-.playernet{position:absolute;left:58px;top:11px;z-index:8;min-height:38px;padding:0 11px;
+.playernet{box-sizing:border-box;position:absolute;left:58px;top:11px;z-index:8;height:40px;min-height:40px;padding:0 11px;
display:flex;align-items:center;border:1px solid rgba(255,255,255,.18);border-radius:8px;
background:rgba(0,0,0,.46);color:#fff;backdrop-filter:blur(10px);font:var(--fs-xs)/1 "Cascadia Mono",monospace}
.playernet[hidden]{display:none}
diff --git a/web/app.js b/web/app.js
index 80aa0423f..298d4ac79 100644
--- a/web/app.js
+++ b/web/app.js
@@ -89,7 +89,7 @@ const ALL_SIDEBAR_KEYS=[...DEFAULT_SIDEBAR_ORDER,...OPTIONAL_SIDEBAR_KEYS];
const SORTS=[['rating','评分'],['o','高潮计数'],['plays','观看次数'],['long','时长'],
['big','体积'],['new','最近入库'],['played','最近看的']];
const SORT_KEYS=SORTS.map(([key])=>key);
-const DEFAULT_SETTINGS={batchSize:60,defaultSort:'new',hoverDelaySeconds:5,seekSeconds:10,searchHistoryLimit:10,relatedLimit:20,javLayout:'big',sidebarOrder:DEFAULT_SIDEBAR_ORDER};
+const DEFAULT_SETTINGS={batchSize:60,defaultSort:'new',hoverDelaySeconds:5,seekSeconds:10,searchHistoryLimit:10,relatedLimit:20,javLayout:'big',ambientMode:true,theaterMode:false,sidebarOrder:DEFAULT_SIDEBAR_ORDER};
let appSettings={...DEFAULT_SETTINGS};
try{appSettings={...DEFAULT_SETTINGS,...JSON.parse(localStorage.getItem(SETTINGS_KEY)||'{}')}}catch(_e){}
const allowedSetting=(value,allowed,fallback)=>allowed.includes(value)?value:fallback;
@@ -98,6 +98,8 @@ appSettings.batchSize=allowedSetting(+appSettings.batchSize,[30,60,90],60);
appSettings.defaultSort=allowedSetting(appSettings.defaultSort,SORT_KEYS,'new');
appSettings.hoverDelaySeconds=allowedSetting(+appSettings.hoverDelaySeconds,[3,5,8],5);
appSettings.seekSeconds=allowedSetting(+appSettings.seekSeconds,[5,10,30],10);
+appSettings.ambientMode=appSettings.ambientMode!==false;
+appSettings.theaterMode=appSettings.theaterMode===true;
appSettings.searchHistoryLimit=allowedSetting(+appSettings.searchHistoryLimit,[5,10,20],10);
appSettings.relatedLimit=allowedSetting(+appSettings.relatedLimit,[12,20,30],20);
appSettings.sidebarOrder=[...new Set(Array.isArray(appSettings.sidebarOrder)?appSettings.sidebarOrder:DEFAULT_SIDEBAR_ORDER)].filter(key=>ALL_SIDEBAR_KEYS.includes(key));
@@ -353,18 +355,48 @@ function fmtSpeed(bits){
const bytes=bits/8;
return bytes>=1048576?`${(bytes/1048576).toFixed(1)} MB/s`:`${Math.max(1,Math.round(bytes/1024))} KB/s`;
}
+function applyAmbientMode(enabled,save=true){
+ appSettings.ambientMode=!!enabled;if(save)saveSettings();
+ $('#stage')?.classList.toggle('ambient-on',appSettings.ambientMode);
+ document.dispatchEvent(new CustomEvent('peachambientchange',{detail:{enabled:appSettings.ambientMode}}));
+}
+function applyTheaterMode(enabled,save=true){
+ appSettings.theaterMode=!!enabled;if(save)saveSettings();
+ const stage=$('#stage');stage?.classList.toggle('theater-mode',appSettings.theaterMode);
+ const button=stage?.querySelector('[data-player-theater]');
+ if(button){button.setAttribute('aria-pressed',String(appSettings.theaterMode));button.setAttribute('aria-label',appSettings.theaterMode?'退出影院模式':'影院模式')}
+ if(detailPlayer&&!detailPlayer.isDisposed())requestAnimationFrame(()=>detailPlayer.trigger('resize'));
+}
+function mountPlayerAmbient(video){
+ const stage=$('#stage'),canvas=stage?.querySelector('.ambientcanvas');if(!canvas)return()=>{};
+ const ctx=canvas.getContext('2d',{alpha:false});let stopped=false,last=0,scheduled=false;
+ const clear=()=>{ctx.clearRect(0,0,canvas.width,canvas.height);stage.style.removeProperty('--video-glow')};
+ const schedule=()=>{if(stopped||scheduled||video.paused||!appSettings.ambientMode)return;scheduled=true;
+ if(video.requestVideoFrameCallback)video.requestVideoFrameCallback(t=>paint(t));else requestAnimationFrame(paint)};
+ const paint=now=>{scheduled=false;if(stopped||!appSettings.ambientMode){if(!stopped)clear();return}
+ if(!document.hidden&&!video.paused&&now-last>480){last=now;
+ try{ctx.drawImage(video,0,0,canvas.width,canvas.height);
+ const px=ctx.getImageData(0,0,canvas.width,canvas.height).data;let r=0,g=0,b=0,n=0;
+ for(let i=0;i<px.length;i+=16){r+=px[i];g+=px[i+1];b+=px[i+2];n++}
+ if(n)stage.style.setProperty('--video-glow',`rgb(${Math.round(r/n)} ${Math.round(g/n)} ${Math.round(b/n)})`)
+ }catch(_e){}}
+ schedule()};
+ const onChange=event=>{stage.classList.toggle('ambient-on',event.detail.enabled);if(event.detail.enabled)schedule();else clear()};
+ document.addEventListener('peachambientchange',onChange);video.addEventListener('play',schedule);schedule();
+ return()=>{stopped=true;document.removeEventListener('peachambientchange',onChange);video.removeEventListener('play',schedule);clear()};
+}
function mountPlayerQualityControl(player,video,fallbackHeight=0){
const controlBar=player.getChild('controlBar')?.el();
if(!controlBar||controlBar.querySelector('[data-player-quality]'))return;
const root=document.createElement('div');
- root.className='vjs-peach-quality vjs-control';root.dataset.playerQuality='';
- root.innerHTML=`<button type="button" aria-label="切换清晰度" title="清晰度" aria-expanded="false">
+ root.className='vjs-peach-settings vjs-control';root.dataset.playerQuality='';
+ root.innerHTML=`<button type="button" class="vjs-peach-settings-toggle" aria-label="播放器设置" aria-expanded="false">
${icon('settings')}<span data-player-quality-badge hidden></span></button>
- <div class="vjs-peach-quality-menu" role="menu" aria-label="清晰度" hidden></div>`;
+ <div class="vjs-peach-settings-menu" role="menu" aria-label="播放器设置" hidden></div>`;
const fullscreen=controlBar.querySelector('.vjs-fullscreen-control');
controlBar.insertBefore(root,fullscreen||null);
const toggle=root.querySelector('button'),badge=root.querySelector('[data-player-quality-badge]');
- const menu=root.querySelector('.vjs-peach-quality-menu');
+ const menu=root.querySelector('.vjs-peach-settings-menu');
const levels=typeof player.qualityLevels==='function'?player.qualityLevels():null;
let selected='auto';
const resolution=(width,height)=>{const values=[Number(width),Number(height)].filter(value=>value>0);return values.length?Math.min(...values):0};
@@ -381,25 +413,57 @@ function mountPlayerQualityControl(player,video,fallbackHeight=0){
const pixels=resolution(video.videoWidth,video.videoHeight)||Number(fallbackHeight)||0;
return [{key:'original',label:pixels?`${pixels}p`:'原画',pixels}];
};
- const render=()=>{
+ const qualityRows=()=>{
const options=rows();
if(!levels?.length)selected='original';
- menu.innerHTML=options.map(option=>`<button type="button" role="menuitemradio" data-player-quality-option="${esc(option.key)}" aria-checked="${option.key===selected}">${esc(option.label)}</button>`).join('');
const active=options.find(option=>option.key===selected)||options[0];
const activePixels=active.pixels||Math.max(0,...options.map(option=>option.pixels||0));
badge.textContent=activePixels>=2160?'4K':activePixels>=720?'HD':'';badge.hidden=!badge.textContent;
- toggle.setAttribute('aria-label',`切换清晰度 · ${active.label}`);toggle.title=`清晰度 · ${active.label}`;
+ return {options,active};
+ };
+ const close=()=>{menu.hidden=true;toggle.setAttribute('aria-expanded','false')};
+ const showMain=()=>{
+ const {active}=qualityRows(),speed=Number(player.playbackRate())||1;
+ menu.innerHTML=`<button type="button" class="vjs-peach-menu-row" role="menuitemcheckbox" data-player-ambient aria-checked="${appSettings.ambientMode}">
+ ${icon('monitor-cog')}<span>氛围模式</span><i class="vjs-peach-switch" aria-hidden="true"></i></button>
+ <button type="button" class="vjs-peach-menu-row" role="menuitem" data-player-speed>${icon('gauge')}<span>播放速度</span><b>${speed===1?'正常':speed+'×'}</b>${icon('chevron-right')}</button>
+ <button type="button" class="vjs-peach-menu-row" role="menuitem" data-player-quality-view>${icon('sliders-horizontal')}<span>清晰度</span><b>${esc(active.label)}</b>${icon('chevron-right')}</button>`;
+ menu.querySelector('[data-player-ambient]').onclick=()=>{applyAmbientMode(!appSettings.ambientMode);showMain()};
+ menu.querySelector('[data-player-speed]').onclick=showSpeed;
+ menu.querySelector('[data-player-quality-view]').onclick=showQuality;
+ };
+ const showSpeed=()=>{
+ const selectedSpeed=Number(player.playbackRate())||1,speeds=[.25,.5,.75,1,1.25,1.5,1.75,2];
+ menu.innerHTML=`<button type="button" class="vjs-peach-menu-back" data-player-menu-back>${icon('chevron-left')}<span>播放速度</span></button>${speeds.map(speed=>
+ `<button type="button" class="vjs-peach-menu-option" role="menuitemradio" data-player-speed-option="${speed}" aria-checked="${speed===selectedSpeed}">${speed===1?'正常':speed+'×'}<span>${speed===selectedSpeed?icon('check'):''}</span></button>`).join('')}`;
+ menu.querySelector('[data-player-menu-back]').onclick=showMain;
+ menu.querySelectorAll('[data-player-speed-option]').forEach(button=>button.onclick=()=>{player.playbackRate(Number(button.dataset.playerSpeedOption));showMain()});
+ };
+ const showQuality=()=>{
+ const {options}=qualityRows();
+ menu.innerHTML=`<button type="button" class="vjs-peach-menu-back" data-player-menu-back>${icon('chevron-left')}<span>清晰度</span></button>${options.map(option=>
+ `<button type="button" class="vjs-peach-menu-option" role="menuitemradio" data-player-quality-option="${esc(option.key)}" aria-checked="${option.key===selected}">${esc(option.label)}<span>${option.key===selected?icon('check'):''}</span></button>`).join('')}`;
+ menu.querySelector('[data-player-menu-back]').onclick=showMain;
menu.querySelectorAll('[data-player-quality-option]').forEach(button=>button.onclick=()=>{
selected=button.dataset.playerQualityOption;
if(levels?.length)for(let index=0;index<levels.length;index++)levels[index].enabled=selected==='auto'||selected===String(index);
- render();menu.hidden=true;toggle.setAttribute('aria-expanded','false');
+ showMain();
});
};
- toggle.onclick=()=>{const open=menu.hidden;menu.hidden=!open;toggle.setAttribute('aria-expanded',String(open))};
- root.addEventListener('keydown',event=>{if(event.key==='Escape'){menu.hidden=true;toggle.setAttribute('aria-expanded','false');toggle.focus()}});
- video.addEventListener('loadedmetadata',render);
- levels?.on?.(['addqualitylevel','removequalitylevel'],render);
- render();
+ toggle.onclick=event=>{event.stopPropagation();const open=menu.hidden;if(open)showMain();menu.hidden=!open;toggle.setAttribute('aria-expanded',String(open))};
+ const outside=event=>{if(!root.contains(event.target))close()};document.addEventListener('pointerdown',outside);
+ root.addEventListener('keydown',event=>{if(event.key==='Escape'){close();toggle.focus()}});
+ video.addEventListener('loadedmetadata',()=>{if(!menu.hidden)showMain();else qualityRows()});
+ levels?.on?.(['addqualitylevel','removequalitylevel'],()=>{if(!menu.hidden)showMain();else qualityRows()});
+ player.on('dispose',()=>document.removeEventListener('pointerdown',outside));qualityRows();
+ mountPlayerTheaterControl(player,root);
+}
+function mountPlayerTheaterControl(player,settingsRoot){
+ const controlBar=player.getChild('controlBar')?.el();if(!controlBar||controlBar.querySelector('[data-player-theater]'))return;
+ const root=document.createElement('div');root.className='vjs-peach-theater vjs-control';
+ root.innerHTML=`<button type="button" data-player-theater aria-label="影院模式" aria-pressed="${appSettings.theaterMode}">${icon('theater-mode')}<span class="vjs-peach-tooltip" role="tooltip">影院模式 <kbd>T</kbd></span></button>`;
+ controlBar.insertBefore(root,settingsRoot.nextSibling);
+ root.querySelector('button').onclick=event=>{event.stopPropagation();applyTheaterMode(!appSettings.theaterMode)};
}
function mountPlayerSeekPreview(player,it,options={}){
const progress=player.getChild('controlBar')?.el()?.querySelector('.vjs-progress-control');
@@ -2112,7 +2176,7 @@ async function openFollowDetail(id,push=true,mediaIndex=null,preserveReturn=fals
if(followList)followList.before($('#stage'));
$('#stage').hidden=false;document.body.classList.add('detail-open');
$('#stage').innerHTML=`<div class="sgrid followdetailgrid${collection||embeddedQueue?' mixgrid':''}">
- <div class="vwrap followdetailmedia${selectedKind==='image'?' image':''}"><button class="closestage" id="closeStage" title="关闭" aria-label="关闭">${icon('x')}</button>${media}${imageControls}</div>
+ <div class="vwrap followdetailmedia${selectedKind==='image'?' image':''}">${selectedKind==='video'?'<canvas class="ambientcanvas" width="32" height="18"></canvas>':''}<button class="closestage" id="closeStage" title="关闭" aria-label="关闭">${icon('x')}</button>${media}${imageControls}</div>
${embeddedQueue?followEmbeddedQueueHtml(item,selectedMedia.index):(collection?followQueueHtml(collection,item.id):'')}
<div class="side followdetailside"><div class="sidecontent">
<div class="followdetailtitle"><div class="stitle">${esc(item.title)}</div>${item.url?`<a class="followorigin" href="${esc(item.url)}" target="_blank" rel="noreferrer noopener" title="打开来源页面" aria-label="打开来源页面">${icon('external-link')}</a>`:''}</div>
@@ -2130,6 +2194,8 @@ async function openFollowDetail(id,push=true,mediaIndex=null,preserveReturn=fals
${item.status==='seen'||item.status==='ignored'?`<button data-follow-detail-status="new" aria-label="恢复未看" title="恢复未看">${icon('rotate-ccw')}</button>`:''}</div>
<span class="fstate" aria-live="polite"></span>
</div></div></div>`;
+ $('#stage').classList.toggle('ambient-on',selectedKind==='video'&&appSettings.ambientMode);
+ $('#stage').classList.toggle('theater-mode',selectedKind==='video'&&appSettings.theaterMode);
const closeDetail=async()=>{disposeStage(false);route(followDetailReturnPath||'/follow');await openFollow(false)};
$('#closeStage').onclick=closeDetail;
$('#stage').querySelectorAll('[data-follow-queue-close]').forEach(button=>button.onclick=closeDetail);
@@ -2145,10 +2211,10 @@ async function openFollowDetail(id,push=true,mediaIndex=null,preserveReturn=fals
switchImage(imageMedia[next].index);
});
const followVideo=$('#stage').querySelector('.followdetailmedia>video');
- if(followVideo)mountDetailPlayer(item,followVideo,false,{
+ if(followVideo){const followPlayer=mountDetailPlayer(item,followVideo,false,{
source:{src,type:selectedMedia?.media_type||item.media_type||'video/mp4'},
checkSourceStatus:false
- });
+ });const stopFollowAmbient=mountPlayerAmbient(followVideo);followPlayer?.one?.('dispose',stopFollowAmbient);followVideo.addEventListener('emptied',stopFollowAmbient,{once:true})}
wireDrag($('#stage').querySelector('.mixlist'));
$('#stage').querySelectorAll('.followdetailtags [data-follow-tag]').forEach(button=>button.onclick=async()=>{
const tag=button.dataset.followTag;
@@ -4552,6 +4618,8 @@ async function openItem(id,push=true,queueContext=null){
<button class="obtn" data-kind="o">${icon('sperm')}<span>记一次高潮</span><b class="mono" id="oCount">${it.o_count||0}</b></button>
</div></div></div>
${queueContext?'':`<div class="next"><h3>接着看</h3><div class="nrow" id="nrow">载入中…</div></div>`}`;
+ $('#stage').classList.toggle('ambient-on',appSettings.ambientMode);
+ $('#stage').classList.toggle('theater-mode',appSettings.theaterMode);
const closeDetail=()=>{const restore=cloneBarsContext(detailReturnBarsContext);
disposeStage(true);detailReturnBarsContext=null;
@@ -4684,16 +4752,6 @@ async function openItem(id,push=true,queueContext=null){
$('#realBar').style.width=rp.toFixed(1)+'%';
}
wireTelemetry(it,vv,{watched:'#watched',mark:'#mark',ratio:'#ratioTxt'});
- const startAmbient=()=>{const canvas=$('#ambientCanvas');if(!canvas)return()=>{};
- const ctx=canvas.getContext('2d',{alpha:false});let stopped=false,last=0;
- const paint=now=>{if(stopped)return;if(!document.hidden&&!vv.paused&&now-last>480){last=now;
- try{ctx.drawImage(vv,0,0,canvas.width,canvas.height);
- const px=ctx.getImageData(0,0,canvas.width,canvas.height).data;let r=0,g=0,b=0,n=0;
- for(let i=0;i<px.length;i+=16){r+=px[i];g+=px[i+1];b+=px[i+2];n++}
- if(n)$('#stage').style.setProperty('--video-glow',`rgb(${Math.round(r/n)} ${Math.round(g/n)} ${Math.round(b/n)})`)
- }catch(_e){}}
- if(vv.requestVideoFrameCallback)vv.requestVideoFrameCallback((t)=>paint(t));else requestAnimationFrame(paint)};
- vv.addEventListener('play',()=>paint(performance.now()),{once:true});return()=>{stopped=true}};
let stopAmbient=()=>{};
const offlineGate=$('#offlineGate');
if(offlineGate){
@@ -4709,8 +4767,8 @@ async function openItem(id,push=true,queueContext=null){
else if(onlineGate){
$('#openSavedFollow').onclick=()=>{followFilter='saved';openFollow()};
}
- else if(g)g.onclick=()=>{vv.hidden=false;g.remove();mountDetailPlayer(it,vv,true);stopAmbient=startAmbient()};
- else{mountDetailPlayer(it,vv,true);stopAmbient=startAmbient()}
+ else if(g)g.onclick=()=>{vv.hidden=false;g.remove();const mounted=mountDetailPlayer(it,vv,true);stopAmbient=mountPlayerAmbient(vv);mounted?.one?.('dispose',stopAmbient)};
+ else{const mounted=mountDetailPlayer(it,vv,true);stopAmbient=mountPlayerAmbient(vv);mounted?.one?.('dispose',stopAmbient)}
vv.addEventListener('emptied',()=>stopAmbient(),{once:true});
$('#stage').scrollIntoView({behavior:'auto',block:'start'});
buildBars();
@@ -5106,6 +5164,9 @@ document.addEventListener('keydown',e=>{
}
const video=activeVideo();
if(video){
+ if(e.key==='t'||e.key==='T'){
+ e.preventDefault();applyTheaterMode(!appSettings.theaterMode);return;
+ }
if(e.key==='ArrowLeft'||e.key==='ArrowRight'){
e.preventDefault();
seekVideoBy(video,appSettings.seekSeconds*(e.key==='ArrowRight'?1:-1));
diff --git a/web/index.html b/web/index.html
index 9b2d637d1..920b846f4 100644
--- a/web/index.html
+++ b/web/index.html
@@ -29,6 +29,9 @@
<symbol id="i-list-filter" viewBox="0 0 24 24"><path d="M2 5h20" /><path d="M6 12h12" /><path d="M9 19h6" /></symbol>
<symbol id="i-chart" viewBox="0 0 24 24"><path d="M5 21v-6" /><path d="M12 21V3" /><path d="M19 21V9" /></symbol>
<symbol id="i-settings" viewBox="0 0 24 24"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" /><circle cx="12" cy="12" r="3" /></symbol>
+ <symbol id="i-monitor-cog" viewBox="0 0 24 24"><path d="M12 17v4" /><path d="m14.305 7.53.923-.382" /><path d="m15.228 4.852-.923-.383" /><path d="m16.852 3.228-.383-.924" /><path d="m16.852 8.772-.383.923" /><path d="m19.148 3.228.383-.924" /><path d="m19.53 9.696-.382-.924" /><path d="m20.772 4.852.924-.383" /><path d="m20.772 7.148.924.383" /><path d="M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7" /><path d="M8 21h8" /><circle cx="18" cy="6" r="3" /></symbol>
+ <symbol id="i-gauge" viewBox="0 0 24 24"><path d="m12 14 4-4" /><path d="M3.34 19a10 10 0 1 1 17.32 0" /></symbol>
+ <symbol id="i-theater-mode" viewBox="0 0 24 24"><rect x="2.5" y="4" width="19" height="16" rx="1.5"/><path d="M7.5 8.5 4.5 12l3 3.5M16.5 8.5l3 3.5-3 3.5M5 12h14"/></symbol>
<symbol id="i-history" viewBox="0 0 24 24"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" /><path d="M3 3v5h5" /><path d="M12 7v5l4 2" /></symbol>
<symbol id="i-sparkles" viewBox="0 0 24 24"><path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z" /><path d="M20 2v4" /><path d="M22 4h-4" /><circle cx="4" cy="20" r="2" /></symbol>
<symbol id="i-x" viewBox="0 0 24 24"><path d="M18 6 6 18" /><path d="m6 6 12 12" /></symbol>
diff --git a/web/vendor/lucide-ORIGIN.md b/web/vendor/lucide-ORIGIN.md
index 844f981da..cb601d0c3 100644
--- a/web/vendor/lucide-ORIGIN.md
+++ b/web/vendor/lucide-ORIGIN.md
@@ -3,6 +3,6 @@
- npm 包:`[email protected]`
- npm lock integrity:`sha512-uAp0oHMWE8T6XycokgjswDF3epVTFhUJQG4EdMsZOC/Jbmi5dFvdto0c6gcVQqswQDIGWguSvbJ0got6Vy3RXQ==`
- 许可证:ISC;原文见 `lucide-LICENSE.txt`
-- 消费者:`web/index.html` 内联的 43 个 symbol
+- 消费者:`web/index.html` 内联的 45 个 symbol
`i-jav`、`i-alert` 是 Peach 自绘图标;RSS 与拖动点保留填充修正,避免小圆点在全局描边样式下消失。