From e8fc07ed02a7f33c2427bd03f3b61e0186139a70 Mon Sep 17 00:00:00 2001 From: Jeroen van Warmerdam Date: Sun, 5 Apr 2015 17:33:32 +0200 Subject: [PATCH 1/2] :bug: Reply in correct inline commit comment textarea (fixes #14); --- .../Github_Comment_Enhancer.user.js | 20 +++++++++++++++++-- Github_Comment_Enhancer/README.md | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js index ea3b061..e4b3d7c 100644 --- a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js +++ b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js @@ -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..e8885ad 100644 --- a/Github_Comment_Enhancer/README.md +++ b/Github_Comment_Enhancer/README.md @@ -35,6 +35,7 @@ Add features to enhance comments & wiki on [Github](https://github.com) and comm * 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; From 73b527185a2a87f2e028f5dc76d0d4c08e188c0a Mon Sep 17 00:00:00 2001 From: Jeroen van Warmerdam Date: Sun, 5 Apr 2015 19:21:18 +0200 Subject: [PATCH 2/2] :clapper: New release of Github Comment Enhancer; --- Github_Comment_Enhancer/Github_Comment_Enhancer.user.js | 2 +- Github_Comment_Enhancer/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js b/Github_Comment_Enhancer/Github_Comment_Enhancer.user.js index e4b3d7c..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 diff --git a/Github_Comment_Enhancer/README.md b/Github_Comment_Enhancer/README.md index e8885ad..0faa7a5 100644 --- a/Github_Comment_Enhancer/README.md +++ b/Github_Comment_Enhancer/README.md @@ -28,7 +28,7 @@ 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;