Skip to content

fix: Fixed Badge Count Display for making all scripts inactive#986

Merged
CodFrm merged 4 commits intoscriptscat:mainfrom
cyfung1031:pr-badge-display-fix-003
Nov 20, 2025
Merged

fix: Fixed Badge Count Display for making all scripts inactive#986
CodFrm merged 4 commits intoscriptscat:mainfrom
cyfung1031:pr-badge-display-fix-003

Conversation

@cyfung1031
Copy link
Copy Markdown
Collaborator

概述 Descriptions

close #978

变更内容 Changes

截图 Screenshots

@cyfung1031 cyfung1031 added the hotfix 需要尽快更新到扩展商店 label Nov 19, 2025
Comment on lines +323 to +324
if (tabId > 0) {
if (tabId !== lastActiveTabId) return; // 其他页面的指令,不理
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑有点重复?

Copy link
Copy Markdown
Collaborator Author

@cyfung1031 cyfung1031 Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>0 是有目前tab的id (不是 -1 , 0 之类的)
!== lastActiveTabId 是改变了tab

@CodFrm CodFrm merged commit e67138e into scriptscat:main Nov 20, 2025
3 checks passed
this.genScriptMenu();
}
// 更新Badge显示。
this.updateBadgeIcon();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

badge浏览器支持按照tabId设置,不需要每次更新菜单时也更新badge

if (!text && !badgeShownSet.has(tabId)) {
// 没有脚本不用显示 & 没有设置
return;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我将badgeShownSet这个逻辑修改了,修改为配置变更时,清理所有的tab,看起来 doBadgeAndMenuUpdate 也是为了做这件事

Copy link
Copy Markdown
Collaborator Author

@cyfung1031 cyfung1031 Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

反正功能做到就行了
跟React无关的UI问题基本上都没有意见。因为问题出现和修正都较直观。React的改动会出现一堆效能问题
(其实可以的话,ScriptCat应该改成Vue核心。这样所有UI的设计就不会再头痛)

只是 popup badge 跟 menu 的显示问题,我认为跟 SPA 和上一页下一页那些,一拼考虑,重新设计一下比较好
也可以用 webNavigation API 而不要完全依赖 由脚本发出的 pageLoad. 特别是「清除」问题

@cyfung1031 cyfung1031 deleted the pr-badge-display-fix-003 branch December 21, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotfix 需要尽快更新到扩展商店

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Disabled scripts are still being counted. (被禁用的脚本仍然会被计算在内)

2 participants