派发播放器模式切换事件 修正播放器置顶组件样式 | Dispatch player mode switching event, modify the style of the player-on-top-new #4191
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 Desc
之前的这个PR是为了处理body上类名的的响应问题,以便添加静态CSS,根据不同播放器模式给UP主卡片/弹幕列表应用不同的样式
但是实际写起来我发现,弹幕列表的
marginTop
属性并不是固定的(依据是屏幕宽度),不能像下述代码一样在静态CSS中写死:在B站混淆后的内联JS中找到了计算动态样式的代码,稍作修改应用到了此处,可以按照B站的规则,在不同的屏幕宽度下获得类似的
marginTop
结果这里我使用CustomEvent这个接口,在播放器播放模式切换时派发全局自定义事件,根据不同的播放器模式,给UP主卡片和弹幕列表设置不同的样式
Screenshots
修改前:
在应用“播放器置顶组件后”,UP主信息被移动到了弹幕列表之下
修改后:
恢复了二者的顺序,在宽屏模式下也能正常展示
Commit Details
feat: 当播放器模式发生变化时 派发事件
feat: 播放器置顶功能根据播放器模式动态修改样式
fix: 修正marginTop计算规则 增加resize的监听
#danmukuBox
原始marginTop
来设置UP主信息的marginTop
的marginTop
值