Fix #72: Refactor thumbnail label update methods #73
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.
本次 Pull Request 包括对缩略图管理和标签功能的更新,重点是优化 labelThumbnail 函数并改进缩略图更新的处理,以解决 #72 相关问题。
缩略图管理增强:
src/thumbnail-utils/thumbnailManagement.ts
:将labelThumbnails
更新为labelThumbnail
以支持单个缩略图的更新,并在 MutationObserver 选项中添加了attributeOldValue
以获取先前的视频链接。缩略图标签改进:
src/thumbnail-utils/thumbnails.ts
:增强了labelThumbnail
,使其接受一个可选的thumbnailOldHref
参数,以帮助判断缩略图的视频 ID 是否发生变化。src/thumbnail-utils/thumbnails.ts
:新增逻辑,当视频 ID 在更新后保持不变时,重用现有的缩略图标签。通过此逻辑可以避免更新 DOM 导致的无限循环问题。src/thumbnail-utils/thumbnails.ts
:修复了选择器逻辑,应以ID而非类名的方式获取先前的labelThumbnail
。