Skip to content

Commit

Permalink
Merge pull request #125 from donthorp/issue-119
Browse files Browse the repository at this point in the history
Fixes issue #119. Emoji with numbers, underscores, dash, and plus no longer ignored.
  • Loading branch information
fusion94 committed Feb 26, 2013
2 parents bf59ed7 + d6a3291 commit e03e9d9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/assets/javascripts/backbone/plugins/emoticons.js.coffee
@@ -1,7 +1,7 @@
class Kandan.Plugins.Emoticons

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

if emoticon
needle = match.replace('(', '\\(').replace(')', '\\)')
search = new RegExp(needle, 'g')
replacement = @options.template(emoticon)
message.content = message.content.replace(search, replacement)
message.content = message.content.replace(match, @options.template(emoticon))

return Kandan.Helpers.Activities.buildFromMessageTemplate(message)

0 comments on commit e03e9d9

Please sign in to comment.