switch from twitter's emoji lib to emojione

This commit is contained in:
Tor Hveem 2015-03-21 16:43:46 +01:00
parent fe3360df15
commit f042f729e1
3 changed files with 18 additions and 11 deletions

View file

@ -539,12 +539,19 @@ li.buffer.indent.private a {
user-select: none;
}
/* Scales emoji to font size */
img.emoji {
height: 1em;
width: 1em;
margin: 0 .05em 0 .1em;
vertical-align: -0.1em;
.emojione {
font-size: inherit;
height: 3ex;
width: 3.1ex;
min-height: 20px;
min-width: 20px;
display: inline-block;
margin: -.2ex .15em .2ex;
line-height: normal;
vertical-align: middle;
}
img.emojione {
width: auto;
}
@media (min-width: 1400px) {

View file

@ -141,11 +141,11 @@ weechat.filter('getBufferQuickKeys', function () {
};
});
// Emojifis the string using https://github.com/twitter/twemoji
// Emojifis the string using https://github.com/Ranks/emojione
weechat.filter('emojify', function() {
return function(text, enable_JS_Emoji) {
if (enable_JS_Emoji === true) {
return twemoji.parse(text);
return emojione.unicodeToImage(text);
} else {
return(text);
}

View file

@ -385,17 +385,17 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
});
// To reduce loading times for users who don't want twemoji,
// To reduce loading times for users who don't want emojione,
// load it only if the setting is enabled.
// This also fires when the page is loaded.
settings.addCallback('enableJSEmoji', function(enabled) {
if (enabled && !$rootScope.twemoji_init) {
// Load twemoji only once
// Load script only once
$rootScope.twemoji_init = true;
(function() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "//twemoji.maxcdn.com/twemoji.min.js";
script.src = "//cdn.jsdelivr.net/emojione/1.3.0/lib/js/emojione.min.js";
document.getElementsByTagName("head")[0].appendChild(script);
})();
}