Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Github_Comment_Enhancer/Github_Comment_Enhancer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// @updateURL https://github.com/jerone/UserScripts/raw/master/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js
// @supportURL https://github.com/jerone/UserScripts/issues
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VCYMHWQ7ZMBKW
// @version 2.2.0
// @version 2.3.0
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

123 abc

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerone test @-user

// @grant none
// @run-at document-end
// @include https://github.com/*/*/issues
Expand Down Expand Up @@ -777,6 +777,21 @@
return cleanUp(string);
};

function getCommentTextarea(replyBtn) {
var newComment = replyBtn;
while (newComment && !newComment.classList.contains('js-quote-selection-container')) {
newComment = newComment.parentNode;
}
if (newComment) {
var lastElementChild = newComment.lastElementChild;
lastElementChild.classList.add('open');
newComment = lastElementChild.querySelector(".comment-form-textarea");
} else {
newComment = document.querySelector(".timeline-new-comment .comment-form-textarea");
}
return newComment;
}

function addReplyButtons() {
Array.prototype.forEach.call(document.querySelectorAll(".comment"), function(comment) {
var oldReply = comment.querySelector(".GithubCommentEnhancerReply");
Expand All @@ -785,8 +800,7 @@
}

var header = comment.querySelector(".timeline-comment-header"),
actions = comment.querySelector(".timeline-comment-actions"),
newComment = document.querySelector(".timeline-new-comment .comment-form-textarea");
actions = comment.querySelector(".timeline-comment-actions");

if (!header) {
return;
Expand All @@ -804,6 +818,8 @@
reply.addEventListener("click", function(e) {
e.preventDefault();

var newComment = getCommentTextarea(this);

var timestamp = comment.querySelector(".timestamp");

var commentText = comment.querySelector(".comment-form-textarea");
Expand Down
3 changes: 2 additions & 1 deletion Github_Comment_Enhancer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ Add features to enhance comments & wiki on [Github](https://github.com) and comm

## Version History

* **vNext**
* **2.3.0**
* Added emoji's (fixes https://github.com/jerone/UserScripts/issues/37);
* Added underline button;
* Added option to choose the character that precedes the list;
* Added option to choose the characters that makes up a horizontal line;
* Fixed running on GitHub Gists and inline comments on commits (fixes https://github.com/jerone/UserScripts/issues/43);
* Fixed linking @users on GitHub Gists (fixes https://github.com/jerone/UserScripts/issues/13);
* Reply in correct inline commit comment textarea (fixes https://github.com/jerone/UserScripts/issues/14);
* Searching snippets improved;
* Improve table code;
* Added missing tooltips;
Expand Down