Upgrade emoji support and switch to apple emoji
Use emojijs for replacing unicode with image tags for display. We were already using it to replace colons with unicode. Additionally it has a companion data repo that is kept up to date with images from all the common image sets. // FREEBIE
This commit is contained in:
parent
262f9d135f
commit
f042378a37
4251 changed files with 4471 additions and 3283 deletions
3725
js/components.js
3725
js/components.js
File diff suppressed because one or more lines are too long
|
@ -4,9 +4,26 @@
|
|||
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
window.emoji_util = window.emoji_util || {};
|
||||
|
||||
// The default version of this function has issues initing from the
|
||||
// background page. Since we only support one environment, we can
|
||||
// preconfigure it here.
|
||||
EmojiConvertor.prototype.init_env = function() {
|
||||
if (this.inits.env) {
|
||||
return;
|
||||
}
|
||||
this.inits.env = 1;
|
||||
this.include_title = true;
|
||||
this.img_sets.apple.path = 'images/emoji/apple/';
|
||||
|
||||
this.img_path = 'images/emoji/unicode/';
|
||||
this.replace_mode = 'img';
|
||||
this.supports_css = true;
|
||||
};
|
||||
window.emoji = new EmojiConvertor();
|
||||
emoji.init_colons();
|
||||
|
||||
// Map from single unicode emoji strings to "colon" strings
|
||||
var unicode_emoji_map;
|
||||
var initialized = false;
|
||||
|
@ -29,4 +46,8 @@
|
|||
return unicode_emoji_map[emoji_string];
|
||||
};
|
||||
|
||||
window.emoji_util.parse = function($el) {
|
||||
$el.html(emoji.replace_unified($el.text()));
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
@ -47,7 +47,8 @@
|
|||
this.timeStampView.setElement(this.$('.last-timestamp'));
|
||||
this.timeStampView.update();
|
||||
|
||||
twemoji.parse(this.el, { base: '/images/twemoji/', size: 16 });
|
||||
emoji_util.parse(this.$('.name'));
|
||||
emoji_util.parse(this.$('.last-message'));
|
||||
|
||||
var unread = this.model.get('unreadCount');
|
||||
if (unread > 0) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
window.Whisper = window.Whisper || {};
|
||||
emoji.init_colons();
|
||||
|
||||
Whisper.ExpiredToast = Whisper.ToastView.extend({
|
||||
templateName: 'expired_toast',
|
||||
|
@ -45,7 +44,7 @@
|
|||
|
||||
this.render();
|
||||
|
||||
twemoji.parse(this.el, { base: '/images/twemoji/', size: 16 });
|
||||
emoji_util.parse(this.$('.conversation-name'));
|
||||
|
||||
this.appWindow = options.appWindow;
|
||||
this.fileInput = new Whisper.FileInputView({
|
||||
|
|
|
@ -125,20 +125,10 @@
|
|||
|
||||
this.renderControl();
|
||||
|
||||
twemoji.parse(this.el, {
|
||||
attributes: function(icon, variant) {
|
||||
var colon = emoji_util.get_colon_from_unicode(icon);
|
||||
if (colon) {
|
||||
return {title: ":" + colon + ":"};
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
base: '/images/twemoji/',
|
||||
size: 16
|
||||
});
|
||||
|
||||
var body = this.$('.body');
|
||||
|
||||
emoji_util.parse(body);
|
||||
|
||||
if (body.length > 0) {
|
||||
var escaped = body.html();
|
||||
body.html(escaped.replace(/\n/g, '<br>').replace(URL_REGEX, "$1<a href='$2' target='_blank'>$2</a>"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue