parent
7b1c06538d
commit
662020ce68
3 changed files with 46 additions and 1 deletions
|
@ -363,6 +363,7 @@
|
|||
<script type='text/javascript' src='js/chromium.js'></script>
|
||||
<script type='text/javascript' src='js/conversation_controller.js'></script>
|
||||
<script type='text/javascript' src='js/panel_controller.js'></script>
|
||||
<script type='text/javascript' src='js/emoji_util.js'></script>
|
||||
|
||||
<script type='text/javascript' src='js/views/whisper_view.js'></script>
|
||||
<script type='text/javascript' src='js/views/debug_log_view.js'></script>
|
||||
|
|
32
js/emoji_util.js
Normal file
32
js/emoji_util.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* vim: ts=4:sw=4:expandtab
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
window.emoji_util = window.emoji_util || {};
|
||||
|
||||
// Map from single unicode emoji strings to "colon" strings
|
||||
var unicode_emoji_map;
|
||||
var initialized = false;
|
||||
|
||||
function initialize() {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
initialized = true;
|
||||
unicode_emoji_map = {};
|
||||
$.each(emoji.data, function(_, data) {
|
||||
if (data[0] && data[0][0] && data[3] && data[3].length > 0) {
|
||||
unicode_emoji_map[data[0][0]] = data[3][0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.emoji_util.get_colon_from_unicode = function(emoji_string) {
|
||||
initialize();
|
||||
return unicode_emoji_map[emoji_string];
|
||||
};
|
||||
|
||||
})();
|
|
@ -87,7 +87,19 @@
|
|||
|
||||
this.renderControl();
|
||||
|
||||
twemoji.parse(this.el, { base: '/images/twemoji/', size: 16 });
|
||||
twemoji.parse(this.el, {
|
||||
attributes: function(icon, variant) {
|
||||
var colon = emoji_util.get_colon_from_unicode(icon);
|
||||
console.log("colon: ", colon);
|
||||
if (colon) {
|
||||
return {title: ":" + colon + ":"};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
base: '/images/twemoji/',
|
||||
size: 16
|
||||
});
|
||||
|
||||
var content = this.$('.content');
|
||||
var escaped = content.html();
|
||||
|
|
Loading…
Reference in a new issue