diff --git a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js index ea3b061..96dfb18 100644 --- a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js +++ b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js @@ -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 // @grant none // @run-at document-end // @include https://github.com/*/*/issues @@ -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"); @@ -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; @@ -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"); diff --git a/Github_Comment_Enhancer/README.md b/Github_Comment_Enhancer/README.md index e131a74..0faa7a5 100644 --- a/Github_Comment_Enhancer/README.md +++ b/Github_Comment_Enhancer/README.md @@ -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;