feat: 新增可选的知乎正文图片查看器#611
Open
andrew05060414 wants to merge 1 commit into
Open
Conversation
中文:为知乎正文图片添加可配置的查看器。
andrew05060414
marked this pull request as ready for review
July 19, 2026 06:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
一句话结论
为脚本新增一个默认关闭的“正文图片查看器”开关;开启后,点击知乎回答或文章中的正文静态图片,会在页面内打开可查看、缩放和切换的图片浮层。
背景
脚本原有的“调整图片最大高度”会让超长图片更易浏览,但也会使用户难以直接查看完整细节。本 PR 提供一个明确开启的查看器,不改变图片的正常排版,也不接管页面上的所有图片。
具体改动与边界
.GifPlayer完全交由知乎原生播放器处理。测试的 GIF 页面初始 DOM 只提供 JPG 封面;若把它作为静态图接管,会造成“GIF 打不开/看成封面”的错误体验。明确未包含的内容
验证证据
自动验证已完成:
node --check Zhihu-Beautification.user.jsgit diff --check origin/master需要人工验收
请在包含多张静态图片的回答和文章中启用该开关并刷新页面,然后检查:打开图片、Esc 关闭、方向键切图、滚轮缩放、拖拽和旋转是否符合预期;同时确认 GIF 仍由知乎原生方式播放。
风险与回退
唯一新增的持久化数据是默认关闭的菜单值。关闭“正文图片查看器”并刷新,即可恢复原有点击行为。