Skip to content

fix: 修复翻页和隐藏 ID 帖子的楼主高亮 - #90

Closed
Cyctes-X wants to merge 1 commit into
chr233:mainfrom
Cyctes-X:fix/highlight-pagination-anonymous
Closed

Cyctes-X wants to merge 1 commit into
chr233:mainfrom
Cyctes-X:fix/highlight-pagination-anonymous

Conversation

@Cyctes-X

@Cyctes-X Cyctes-X commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

问题

PureNGA 3.5.2 在翻页时偶尔漏掉楼主高亮。相邻页面会预加载,但注入逻辑共用同一个 WebView 引用,页面切换时可能漏掉当前页。

隐藏 ID 帖还有一个匹配问题。NGA 页面显示的是楼主化名,插件拿到的是匿名标识,直接比较会匹配失败。

改动

  • finishLoad 和 onPageFinished 分别使用自己对应的 WebView,确保每页收到自己的高亮数据。
  • 普通帖按 UID 识别楼主。隐藏 ID 帖使用匿名标识或同帖公开化名,识别后统一按楼层 pid 定位并给昵称上色。
  • 页面初始化时应用一次高亮,后续由 MutationObserver 响应楼层变化,移除定时轮询。重复注入时复用监听器,自定义脚本每个文档只执行一次。

验证

在 NGA 9.9.69 + LSPosed API 102 上用独立测试包验证:

  • 普通帖从第 1 页翻到第 3 页,原先漏高亮的 42 楼正常变绿。
  • 隐藏 ID 帖的首楼、8 楼和第 2 页的 22 楼正常变绿,其他昵称保持原色。
  • assembleRelease 编译通过。

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high · 1 medium · 6 minor

Alerts:
⚠ 8 issues (≤ 0 issues of at least minor severity)

Results:
8 new issues

Category Results
ErrorProne 1 high
CodeStyle 4 minor
Complexity 1 medium
2 minor

View in Codacy

🟢 Metrics 39 complexity · 0 duplication

Metric Results
Complexity 39
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@chr233 chr233 closed this Dec 3, 2026
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