Skip to content

Commit 42608eb

Browse files
committed
πŸ› Fix broken comment form. Fixes #168
1 parent 71295c0 commit 42608eb

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

β€ŽGithub_Reply_Comments/Github_Reply_Comments.user.jsβ€Ž

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Reply_Comments/Github_Reply_Comments.user.js
1313
// @supportURL https://github.com/jerone/UserScripts/issues
1414
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
15-
// @version 1.0.5
15+
// @version 1.0.6
1616
// @icon https://github.githubassets.com/pinned-octocat.svg
1717
// @grant none
1818
// @include https://github.com/*
@@ -59,7 +59,7 @@
5959
}
6060

6161
var textareas = newComment.querySelectorAll(
62-
":scope > :not(.last-review-thread) .comment-form-textarea:not(.github-writer-ckeditor)",
62+
":scope > :not(.last-review-thread) .js-comment-field:not(.github-writer-ckeditor)",
6363
);
6464
return textareas[textareas.length - 1];
6565
}
@@ -68,7 +68,7 @@
6868
var commentText = "";
6969

7070
// Use raw comment when available.
71-
var commentForm = comment.querySelector(".comment-form-textarea");
71+
var commentForm = comment.querySelector(".js-comment-field");
7272
if (commentForm) {
7373
commentText = commentForm.value;
7474
}
@@ -88,6 +88,14 @@
8888
},
8989
);
9090

91+
// Refined GitHub adds a small avatar to username mention. See https://github.com/refined-github/refined-github/blob/main/source/features/small-user-avatars.tsx
92+
Array.prototype.forEach.call(
93+
commentBody.querySelectorAll(".rgh-small-user-avatars"),
94+
function (rgh) {
95+
rgh.remove();
96+
},
97+
);
98+
9199
// GitHub add an extra new line, which is converted by Turndown.
92100
Array.prototype.forEach.call(
93101
commentBody.querySelectorAll("pre code"),

β€ŽGithub_Reply_Comments/README.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ reply button on an comment.
2020

2121
## Version History
2222

23+
- version **1.0.6**
24+
25+
- πŸ› Fix broken comment form. Fixes ([#168](https://github.com/jerone/UserScripts/issues/168)).
26+
2327
- version **1.0.5**
2428

2529
- πŸ› Enable the Comment button. Fixes ([#152](https://github.com/jerone/UserScripts/issues/152)).

0 commit comments

Comments
Β (0)