Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #72: Refactor thumbnail label update methods #73

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

xiaoxuan010
Copy link
Contributor

  • 我同意我的所有贡献将以GPL-3.0协议开源。

本次 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

@hanydd hanydd merged commit 6c09a50 into hanydd:master Nov 13, 2024
2 checks passed
@xiaoxuan010 xiaoxuan010 deleted the fix-72 branch November 13, 2024 15:26
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.

2 participants