Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit c54522c

Browse files
committed
support for more sites
1 parent c02598f commit c54522c

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

dist/script.js

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/script.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/style.css

Lines changed: 1 addition & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/style.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/script.coffee

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class GitHubMentionHighlighter
44
mentions = []
55
for mention in $(".user-mention, .member-mention")
66
$mention = $(mention)
7-
mentions.push $mention if $mention.text() == "@#{@username}"
7+
mentions.push $mention if $mention.text() == "@#{@username()}"
88
mentions
99

1010
teamMentions: ->
@@ -22,15 +22,16 @@ class GitHubMentionHighlighter
2222
cache: true
2323
success: (data) =>
2424
members = data["members"]
25-
mentions.push $mention if $.inArray(@username, members) != -1
25+
mentions.push $mention if $.inArray(@username(), members) != -1
2626
mentions
2727

2828
mentions: ->
2929
$.merge @userMentions(), @teamMentions()
3030

31-
constructor: ->
32-
@username = $(".supportocat a, #user-links .name").text().trim()
31+
username: ->
32+
@_username ||= $(".supportocat a, #user-links .name, .header-right .logged-in a").text().trim().replace("@", "")
3333

34+
constructor: ->
3435
for $mention in @mentions()
3536
$mention.addClass("highlight")
3637
$mention.parents(".timeline-comment, .timeline-entry").addClass("highlight")

src/style.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
.timeline-comment:not(.current-user) .user-mention.highlight,
22
.timeline-comment:not(.current-user) .team-mention.highlight,
33
.timeline-entry .member-mention.highlight,
4-
.timeline-entry .team-mention.highlight {
4+
.timeline-entry .team-mention.highlight,
5+
.markdown-body .user-mention.highlight,
6+
.markdown-body .user-mention.highlight {
57
background: yellow !important;
68
}
79

0 commit comments

Comments
 (0)