Skip to content

修复 [知乎美化] 暗黑模式失效#615

Open
cherryfeng1026 wants to merge 1 commit into
XIU2:masterfrom
cherryfeng1026:fix/zhihu-dark-mode-cookie
Open

修复 [知乎美化] 暗黑模式失效#615
cherryfeng1026 wants to merge 1 commit into
XIU2:masterfrom
cherryfeng1026:fix/zhihu-dark-mode-cookie

Conversation

@cherryfeng1026

Copy link
Copy Markdown

变更内容

  • 适配知乎当前的 themeApp / themeModeApp 主题 Cookie
  • 脚本切换主题时同步写入 manual 模式,并清理冲突的 host-only Cookie
  • 将主题 Cookie 写入 .zhihu.com,兼容 wwwzhuanlan 子域名
  • document-start 阶段使用 document.documentElement 安全挂载样式

问题原因

知乎已不再使用旧的 theme Cookie。原脚本仍读写旧字段,导致菜单状态虽然变化,页面主题却不会随之切换。

验证

  • Chrome + Tampermonkey 5.5.0 真实知乎页面验证方案 1/2 切换正常
  • 验证强制暗色、强制亮色及跟随浏览器亮色场景
  • node --check Zhihu-Beautification.user.js
  • git diff --check

方案 3/4 的原有滤镜实现保持不变。

@cherryfeng1026 cherryfeng1026 changed the title 修复知乎暗黑模式失效 修复 [知乎美化] 暗黑模式失效 Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant