Skip to content

Commit e88c0e4

Browse files
committed
Merge pull request #11 from Bushido/emoticon_polish
Emoticon polish
2 parents 55f8ecd + 49ac70c commit e88c0e4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/assets/javascripts/backbone/plugins/emoticons.js.coffee

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Kandan.Plugins.Emoticons
33
@options:
44
regex: /\([a-zA-Z]+\)/g
55
template: _.template '''
6-
<img class="emoticon-embed" src="/assets/emoticons/<%= emoticon %>" height="40" width="40" />
6+
<img class="emoticon-embed" src="/assets/emoticons/<%= emoticon %>" title="<%= title %>" height="40" width="40" />
77
'''
88

99

@@ -37,10 +37,11 @@ class Kandan.Plugins.Emoticons
3737
matches = message.content.match(@options.regex)
3838
for match in _.unique(matches)
3939
emoticon = @emoticons[match]
40+
title = match.replace(/\(|\)/g, "")
4041
needle = match.replace('(', '\\(').replace(')', '\\)')
4142
search = new RegExp(needle, 'g')
42-
replacement = @options.template({ emoticon: emoticon })
43+
replacement = @options.template({ emoticon: emoticon, title: title})
4344
message.content = message.content.replace(search, replacement) if emoticon
44-
return Kandan.Helpers.Activities.buildFromBaseTemplate(message)
45+
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)
4546

4647
# Kandan.Plugins.register "Kandan.Plugins.Emoticons"

0 commit comments

Comments
 (0)