Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ryan778
GitHub Repository: Ryan778/Ryan778.github.io
Path: blob/master/emojionearea/src/function/shortnameTo.js
575 views
1
define([
2
'jquery',
3
'var/emojione',
4
'var/emojioneSupportMode',
5
'function/getTemplate'
6
],
7
function($, emojione, emojioneSupportMode, getTemplate) {
8
return function(str, template, clear) {
9
return str.replace(/:?\+?[\w_\-]+:?/g, function(shortname) {
10
shortname = ":" + shortname.replace(/:$/,'').replace(/^:/,'') + ":";
11
var unicode = emojione.emojioneList[shortname];
12
if (unicode) {
13
if (emojioneSupportMode > 3) unicode = unicode.unicode;
14
return getTemplate(template, unicode[unicode.length-1], shortname);
15
}
16
return clear ? '' : shortname;
17
});
18
};
19
});
20