Repository navigation
专注模式:从带 mdg_reader 的地址打开时,等 B站 页面接管完再放进字幕栏 - #431
Merged
Merged
Conversation
页面还是服务器渲染的那份(#app 上有 data-server-rendered)时就插入字幕栏,B站 这次访问里点分 P 列表、下一个、自动连播都切不了分 P,退出专注模式也不恢复。挂载播放器前等这个标记消失,最多等到导航后 10 秒。顺带修了 content.selftest.js 里一个没还原 currentSite 的测试。
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.
改了什么
从带
mdg_reader=1的地址打开专注模式(摘读记录、分拣台、扩展更新后重载)时,B站 这次访问里切不了分 P:点分 P 列表、播放器的「下一个」、自动连播都没反应,退出专注模式也不恢复。弹窗按钮在页面加载完后才进,不受影响。原因是内容脚本在 document_idle 就把字幕栏插进
.left-container,这时 B站 还没接管服务器渲染的页面(#app还带data-server-rendered),实测早了约 0.5 秒。ensureReaderPlayerMounted每次尝试前先看pageHydrating():站点配置了reader.hydrating(B站 是[data-server-rendered])且页面上还有,就等一轮。最多等到导航后 10 秒,免得哪类页面一直留着这个标记时进不去。YouTube 没配,不变。content.selftest.js加 V8。顺带还原了前面一个测试换掉后没还原的currentSite,后面调到真挂载的测试原来靠它的残留读站点配置。验证
node scripts/selftest.mjs:39 个通过。去掉pageHydrating()那一段,V8 失败。?mdg_reader=1打开后,player.next()、点列表、自动连播都不换 P;?mdg_reader=0(不进专注模式)正常;把进入推迟 6 秒正常;不插字幕栏正常。data-server-rendered去掉后约 60 ms 插入;player.next()切到 P2,专注模式跟着重读 P2 的字幕;扩展无报错。/list/播放页、YouTube。