GitHub-userscripts
GitHub-userscripts copied to clipboard
GitHub Issue Add Details - no longer works
The 'GitHub Issue Add Details ' script no longer works (in existing or new comments of issue/pull requests). Instead it shows in Console this error:
TypeError: Cannot read properties of null (reading 'parentNode')
referring to line 44:
https://github.com/Mottie/GitHub-userscripts/blob/4983620a1661d204b675d82b2192c7ebbb16bbbc/github-issue-add-details.user.js#L44
Tested in a fresh Chrome profile witn only TM/VM installed.
Thanks @darkred!
I keep meaning to update the code, but have been overly busy :(
Try this change:
// Add insert details button
function addDetailsButton() {
const button = document.createElement("button");
button.type = "button";
button.className = "ghad-details toolbar-item tooltipped tooltipped-n";
button.setAttribute("aria-label", "Add a details/summary block");
button.setAttribute("tabindex", "-1");
button.innerHTML = icon;
[...document.querySelectorAll(".toolbar-commenting")].forEach(el => {
if (el && !$(".ghad-details", el)) {
const btn = $("[aria-label*='Add a task list']", el);
btn.before(button.cloneNode(true));
}
});
}
Thank you for your quick response!
I tested it and it works ok in New Issue/PR forms and in existing Issues/PRs | New Comment form
If you would be so kind, when you have the chance, could you make it also work when editing existing comments in issues/PRs, please?
I finally got around to updating the userscript, but I didn't add the enhancement you requested... once I find some more free time! 😞