Merge pull request #723 from kurros/emojiopt
optimize what gets passed to emojione.unicodeToImage
This commit is contained in:
commit
48afda9c56
1 changed files with 8 additions and 1 deletions
|
@ -161,10 +161,17 @@ weechat.filter('getBufferQuickKeys', function () {
|
||||||
weechat.filter('emojify', function() {
|
weechat.filter('emojify', function() {
|
||||||
return function(text, enable_JS_Emoji) {
|
return function(text, enable_JS_Emoji) {
|
||||||
if (enable_JS_Emoji === true && window.emojione !== undefined) {
|
if (enable_JS_Emoji === true && window.emojione !== undefined) {
|
||||||
|
// Emoji live in the D800-DFFF surrogate plane; only bother passing
|
||||||
|
// this range to CPU-expensive unicodeToImage();
|
||||||
|
var emojiRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
||||||
|
if (emojiRegex.test(text)) {
|
||||||
return emojione.unicodeToImage(text);
|
return emojione.unicodeToImage(text);
|
||||||
} else {
|
} else {
|
||||||
return(text);
|
return(text);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return(text);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue