mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix(GitHub): 优化仓库页面识别逻辑
- 增加通过 meta 标签判断是否为仓库页面的逻辑 - 使用 octolytics-dimension-repository_nwo 和 repository_id 作为判断条件 - 保持原有的 DOM 查询方式作为辅助判断 - 提升仓库页面识别的准确性和鲁棒性
This commit is contained in:
parent
550b3f0d41
commit
3cf4deaa9f
1 changed files with 6 additions and 0 deletions
|
|
@ -120,6 +120,12 @@ export function resolveMeta(): Partial<MetaData> {
|
|||
export function isInRepoPage() {
|
||||
const repoHeadSelector = '.repohead'
|
||||
const authorNameSelector = '.author[itemprop="author"]'
|
||||
const repoMetaSelector = [
|
||||
'meta[name="octolytics-dimension-repository_nwo"]',
|
||||
'meta[name="octolytics-dimension-repository_id"]',
|
||||
].join()
|
||||
if (document.querySelector(repoMetaSelector)) return true
|
||||
|
||||
return Boolean(
|
||||
document.querySelector(
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in a new issue