Removed unnecessary ampersand replacement
This commit is contained in:
parent
b9502d35ee
commit
a2bd181911
1 changed files with 7 additions and 11 deletions
|
@ -16,8 +16,7 @@ var re = /(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[
|
||||||
|
|
||||||
// avoid using a string literal like '\u200D' here because minifiers expand it inline
|
// avoid using a string literal like '\u200D' here because minifiers expand it inline
|
||||||
U200D = String.fromCharCode(0x200D),
|
U200D = String.fromCharCode(0x200D),
|
||||||
basePath = Qt.resolvedUrl("./emoji/"),
|
basePath = Qt.resolvedUrl("./emoji/");
|
||||||
ampersandRe = /\&(?!amp;)/g;
|
|
||||||
|
|
||||||
function toCodePoint(unicodeSurrogates) {
|
function toCodePoint(unicodeSurrogates) {
|
||||||
var
|
var
|
||||||
|
@ -41,15 +40,13 @@ function toCodePoint(unicodeSurrogates) {
|
||||||
|
|
||||||
function emojify(str, emojiSize) {
|
function emojify(str, emojiSize) {
|
||||||
return String(str).replace(re, function (rawText) {
|
return String(str).replace(re, function (rawText) {
|
||||||
var ret = rawText,
|
var iconId = toCodePoint(rawText.indexOf(U200D) < 0 ?
|
||||||
iconId = toCodePoint(rawText.indexOf(U200D) < 0 ?
|
|
||||||
rawText.replace(UFE0Fg, '') :
|
rawText.replace(UFE0Fg, '') :
|
||||||
rawText
|
rawText);
|
||||||
);
|
return iconId ?
|
||||||
if (iconId) {
|
|
||||||
// recycle the match string replacing the emoji
|
// recycle the match string replacing the emoji
|
||||||
// with its image counter part
|
// with its image counter part
|
||||||
ret = '<img '.concat(
|
'<img '.concat(
|
||||||
'src="',
|
'src="',
|
||||||
basePath,
|
basePath,
|
||||||
iconId,
|
iconId,
|
||||||
|
@ -59,8 +56,7 @@ function emojify(str, emojiSize) {
|
||||||
'" height="',
|
'" height="',
|
||||||
Math.round(emojiSize * 6 / 5 ),
|
Math.round(emojiSize * 6 / 5 ),
|
||||||
'"/>'
|
'"/>'
|
||||||
);
|
) : rawText;
|
||||||
}
|
}
|
||||||
return ret.replace(ampersandRe, "&");
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue