Skip to content

Commit

Permalink
fix(github): Fix Toggl button isn't visible on an issue popup (#2273)
Browse files Browse the repository at this point in the history
Closes #2269
  • Loading branch information
pkvach authored Mar 5, 2024
1 parent 165bd8d commit f84b6c5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/content/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,28 @@ togglbutton.render(
'div[role="dialog"]:not(.toggl)',
{ observe: true },
async function (elem) {
const projectElem = document.querySelector("#memexTitleInput");
const projectElem = document.querySelector("div[role='navigation'] h1");

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

const div = document.createElement("div");
div.classList = parent.children[0].classList.value;
div.style.paddingLeft = "16px";
if (targetChildSection === null) {
return;
}

let projectName = "";
if (projectElem) projectName = projectElem.value;
const div = document.createElement("div");
div.className = targetChildSection.className;
div.style.paddingLeft = "8px";

const link = togglbutton.createTimerLink({
className: "github",
description: description,
projectName: projectName,
projectName: projectElem ? projectElem.textContent.trim() : "",
});

div.appendChild(link);
parent.prepend(div);
targetParent.prepend(div);
}
);

Expand Down

0 comments on commit f84b6c5

Please sign in to comment.