From 944d7d1eabb1d224fef3cd695365c77f8a22f0ae Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 04:50:41 +0000 Subject: [PATCH] fix: update repository navigation selector for issue #36 GitHub changed the class names for the repository navigation menu. This commit updates the selector to be more robust by using: 1. nav[aria-label="Repository"] ul 2. ul.UnderlineNav-body 3. parent ul of #code-tab Additionally, data-view-component="true" attribute is added to injected elements to match GitHub's current DOM structure. Co-authored-by: officel <110354+officel@users.noreply.github.com> --- cosmetic.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cosmetic.js b/cosmetic.js index b19043b..8b57221 100644 --- a/cosmetic.js +++ b/cosmetic.js @@ -7,8 +7,11 @@ if (pathParts.length < 2) return; const [owner, repo] = pathParts; - const headerSelector = "ul.UnderlineNav-body.list-style-none"; - const ul = document.querySelector(headerSelector); + const ul = + document.querySelector('nav[aria-label="Repository"] ul') || + document.querySelector("ul.UnderlineNav-body") || + document.getElementById("code-tab")?.closest("ul"); + if (!ul) return; // すでに追加済みなら何もしない @@ -16,8 +19,10 @@ const li = document.createElement("li"); li.className = "d-inline-flex deepwiki-nav-item"; + li.setAttribute("data-view-component", "true"); const a = document.createElement("a"); + a.setAttribute("data-view-component", "true"); a.href = `https://deepwiki.com/${owner}/${repo}`; a.target = "_blank"; a.className = @@ -46,8 +51,10 @@ // gitingest を追加 const li2 = document.createElement("li"); li2.className = "d-inline-flex gitingest-nav-item"; + li2.setAttribute("data-view-component", "true"); const a2 = document.createElement("a"); + a2.setAttribute("data-view-component", "true"); a2.href = `https://gitingest.com/${owner}/${repo}`; a2.target = "_blank"; a2.className =