Skip to content

Commit f84b6c5

Browse files
authored
fix(github): Fix Toggl button isn't visible on an issue popup (#2273)
Closes #2269
1 parent 165bd8d commit f84b6c5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/content/github.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,28 @@ togglbutton.render(
6565
'div[role="dialog"]:not(.toggl)',
6666
{ observe: true },
6767
async function (elem) {
68-
const projectElem = document.querySelector("#memexTitleInput");
68+
const projectElem = document.querySelector("div[role='navigation'] h1");
6969

70-
const parent = document.querySelector("dl");
7170
const description = await getPaneDescription(elem);
71+
const targetParent = document.querySelector("div[data-testid='issue-viewer-metadata-container']");
72+
const targetChildSection = targetParent && targetParent.querySelector("div[data-testid='sidebar-section']");
7273

73-
const div = document.createElement("div");
74-
div.classList = parent.children[0].classList.value;
75-
div.style.paddingLeft = "16px";
74+
if (targetChildSection === null) {
75+
return;
76+
}
7677

77-
let projectName = "";
78-
if (projectElem) projectName = projectElem.value;
78+
const div = document.createElement("div");
79+
div.className = targetChildSection.className;
80+
div.style.paddingLeft = "8px";
7981

8082
const link = togglbutton.createTimerLink({
8183
className: "github",
8284
description: description,
83-
projectName: projectName,
85+
projectName: projectElem ? projectElem.textContent.trim() : "",
8486
});
8587

8688
div.appendChild(link);
87-
parent.prepend(div);
89+
targetParent.prepend(div);
8890
}
8991
);
9092

0 commit comments

Comments
 (0)