Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cosmetic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@
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;

// すでに追加済みなら何もしない
if (ul.querySelector(".deepwiki-nav-item")) return;

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 =
Expand Down Expand Up @@ -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 =
Expand Down