Skip to content

Commit 25cb0f7

Browse files
committedFeb 26, 2013
Fixes #119. emoji with number underscore dash or plus ignored.
1 parent bcf746c commit 25cb0f7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed
 

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Kandan.Plugins.Emoticons
22

33
@options:
4-
regex: /\([a-zA-Z]+\)|(:[a-z]+:)|(^|\s)+([:|=][\)|\(|P|p])($|\s)/g
4+
regex: /\([a-zA-Z]+\)|(:[\w\-+]+:)|(^|\s)+([:|=][\)|\(|P|p])($|\s)/g
55
template: _.template '''
66
<img class="emoticon-embed <%= css %>" src="/assets/emoticons/<%= src %>" title="<%= title %>" />
77
'''
@@ -910,12 +910,9 @@ class Kandan.Plugins.Emoticons
910910
matches = message.content.match(@options.regex)
911911
for match in _.unique(matches)
912912
match = match.trim();
913-
emoticon = @emoticons[match]
913+
emoticon = @emoticons[match]
914914

915915
if emoticon
916-
needle = match.replace('(', '\\(').replace(')', '\\)')
917-
search = new RegExp(needle, 'g')
918-
replacement = @options.template(emoticon)
919-
message.content = message.content.replace(search, replacement)
916+
message.content = message.content.replace(match, @options.template(emoticon))
920917

921918
return Kandan.Helpers.Activities.buildFromMessageTemplate(message)

0 commit comments

Comments
 (0)
Please sign in to comment.