Skip to content

Commit d63616d

Browse files
authored
Create Client Script.cs
1 parent fab356e commit d63616d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
api.controller=function($scope,$sce) {
2+
/* widget controller */
3+
var c = this;
4+
5+
c.emojiMap ={
6+
':smile:' :'😊',
7+
':sad:':'😓',
8+
":heart:":'❤️',
9+
":thumbsup:":'👍',
10+
":laugh:":"😀",
11+
":wink:":"😉",
12+
":clap:":"👏",
13+
":party:" :"🥳"
14+
};
15+
16+
c.replaceEmojis = function(){
17+
var text = $scope.data.inputText || '';
18+
19+
for(var key in c.emojiMap){
20+
var regex = new RegExp(key.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1"),'g');
21+
text = text.replace(regex,c.emojiMap[key]);
22+
}
23+
c.outputText= $sce.trustAsHtml(text);
24+
}
25+
};

0 commit comments

Comments
 (0)