feat: 重构 DOM 工具链与基础服务,新增快捷键系统并优化部分功能模块#138
Open
PaTTeeL wants to merge 57 commits into
Open
Conversation
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.
feat: 重构 DOM 工具链与基础服务,新增快捷键系统并优化部分功能模块
🏗️ 基础服务层
全局 DOM 观察服务
gDomObservergDomObserver,统一管理页面内的 DOM 变更监听waitForElement:新增自动去重、超时、rAF 防抖;相同选择器下的多个等待任务改用任务组管理,各任务支持独立超时raceForElement:支持多选择器竞争式等待,返回首个命中元素DomHook增强observeAttributes参数(默认false),按需开启属性变更监听新增
_rawQuery方法getElementById/getElementsByClassName/getElementsByTagName等原生 API,未命中的复杂选择器降级到querySelector,提升高频 DOM 查询性能全局快捷键服务
gHotkeygHotkey,统一管理全页面的键盘事件绑定remove/enable/disable/list方法,完整生命周期管理📋 业务模块
FollowList(关注列表)
FollowList实现,优化菜单最大高度ResizeObserver替代轮询,修复竞态时序问题waitForElement替代原有轮询逻辑HistoryList(历史列表)
HistoryList模块,调整列表请求数上限Refresh 模块
Refresh_BarrageFrame到Refresh_Barrage,消除冗余Refresh_Barrage.css,精简合并冗余代码waitForElement优化 DOM 操作时机Refresh_Video(适配新 UI)Refresh_BarrageExpandTool / FullScreen
waitForElement替代轮询;使用raceForElement进一步优化自动网页全屏机制DomHook监听替代自动网页全屏中的轮询ExpandTool统一本地存储读写方法,重构ExpandTool_FullScreen存储逻辑BarragePanel / 弹幕面板
BarragePanel_Tip中「+1」的位置,方便点击BarragePanel_Tip边界检测防溢出机制BarragePanel_Tip背景错位问题弹幕屏蔽
shieldTool查询waitForElement优化shieldTool查询时机快捷键绑定
x和gst,用于全屏模式下切换弹幕侧边栏收起/展开Camera
anchorName的获取时机,改用textContent提升稳定性#ex-camera底部偏移量,防止误触侧栏按钮Router / 页面支持
waitForElement替代 Router 中元素的轮询弹幕侧边栏
initPkg_CopyRealLive中 DOM 查询方法🔧 代码质量