From 6290306760f6e343a0c7944315f0a35c34356674 Mon Sep 17 00:00:00 2001 From: Akash Manohar J Date: Fri, 13 Apr 2012 23:23:49 +0530 Subject: [PATCH] Adds title to emoticons Signed-off-by: Akash Manohar J --- app/assets/javascripts/backbone/plugins/emoticons.js.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/backbone/plugins/emoticons.js.coffee b/app/assets/javascripts/backbone/plugins/emoticons.js.coffee index 2c432c81..7a8d56e1 100644 --- a/app/assets/javascripts/backbone/plugins/emoticons.js.coffee +++ b/app/assets/javascripts/backbone/plugins/emoticons.js.coffee @@ -3,7 +3,7 @@ class Kandan.Plugins.Emoticons @options: regex: /\([a-zA-Z]+\)/g template: _.template ''' - + ''' @@ -37,10 +37,11 @@ class Kandan.Plugins.Emoticons matches = message.content.match(@options.regex) for match in _.unique(matches) emoticon = @emoticons[match] + title = match.replace(/\(|\)/g, "") needle = match.replace('(', '\\(').replace(')', '\\)') search = new RegExp(needle, 'g') console.log(search) - replacement = @options.template({ emoticon: emoticon }) + replacement = @options.template({ emoticon: emoticon, title: title}) message.content = message.content.replace(search, replacement) if emoticon console.log(message.content) return Kandan.Helpers.Activities.buildFromBaseTemplate(message)