Skip to content

Commit e472f12

Browse files
committed
🐛 Fixed comment form header on inline comments;
1 parent 4521778 commit e472f12

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Github_Comment_Enhancer/Github_Comment_Enhancer.user.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,14 +605,17 @@
605605

606606
var tabnavExtras = commentForm.parentNode.parentNode.querySelector(".comment-form-head .tabnav-right, .comment-form-head .right");
607607
if (tabnavExtras) {
608+
var elem = commentForm;
609+
while ( (elem = elem.parentNode) && elem.nodeType !== 9 && !elem.classList.contains("timeline-inline-comments")) { }
610+
var sponsoredText = elem !== document ? " Github Comment Enhancer" : " Enhanced by Github Comment Enhancer";
608611
var sponsored = document.createElement("a");
609612
sponsored.setAttribute("target", "_blank");
610613
sponsored.setAttribute("href", "https://github.com/jerone/UserScripts/tree/master/Github_Comment_Enhancer");
611614
sponsored.classList.add("tabnav-widget", "text", "tabnav-extras", "tabnav-extra");
612615
var sponsoredIcon = document.createElement("span");
613616
sponsoredIcon.classList.add("octicon", "octicon-question");
614617
sponsored.appendChild(sponsoredIcon);
615-
sponsored.appendChild(document.createTextNode("Enhanced by Github Comment Enhancer"));
618+
sponsored.appendChild(document.createTextNode(sponsoredText));
616619
tabnavExtras.insertBefore(sponsored, tabnavExtras.firstElementChild);
617620
}
618621
}

Github_Comment_Enhancer/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Every comment field also got a toolbar, consisting of the following buttons:
6262
* **2.5.0**
6363
* Fixed not running everywhere (fixes https://github.com/jerone/UserScripts/issues/66);
6464
* Better clear button icon;
65+
* Fixed comment form header on inline comments;
6566
* **2.4.1**
6667
* Fixed a small bug with cached suggestions for emoji when returning to an issue/PR;
6768
* **2.4.0**

0 commit comments

Comments
 (0)