Skip to content

Commit 9796673

Browse files
authored
Fix link to authors with spaces in their name in Github Reply Co… (#151)
Fix link to authors with spaces in their name in Github Reply Comments. Fixes #150
1 parent bc8be6d commit 9796673

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Github_Reply_Comments/Github_Reply_Comments.user.js

Lines changed: 7 additions & 4 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.3
15+
// @version 1.0.4
1616
// @icon https://github.githubassets.com/pinned-octocat.svg
1717
// @grant none
1818
// @include https://github.com/*
@@ -120,10 +120,13 @@
120120

121121
var newComment = getCommentTextarea(this);
122122

123+
var author = comment.querySelector(".author");
124+
var authorLink = location.origin + (author.getAttribute("href") || "/" + author.textContent);
125+
123126
var text = newComment.value.length > 0 ? "\n" : "";
124-
text += String.format('[**@{0}**]({1}/{0}) commented on [{2}]({3} "{4} - Replied by Github Reply Comments"):\n{5}\n\n',
125-
comment.querySelector(".author").textContent,
126-
location.origin,
127+
text += String.format('[**@{0}**]({1}) commented on [{2}]({3} "{4} - Replied by Github Reply Comments"):\n{5}\n\n',
128+
author.textContent,
129+
authorLink,
127130
timestamp.firstElementChild.getAttribute("title"),
128131
timestamp.href,
129132
timestamp.firstElementChild.getAttribute("datetime"),

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.4**
24+
25+
* 🐛 Fix link to authors with spaces in their name. Fixes ([#150](https://github.com/jerone/UserScripts/issues/150)).
26+
2327
* version **1.0.3**
2428

2529
* 🐛 Fix broken timestamp detection ([#149](https://github.com/jerone/UserScripts/issues/149)).

0 commit comments

Comments
 (0)