Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function addTweet(tweet) {
// Reject tweets with media.
if (tweet.extended_entities && tweet.extended_entities.media.length > 0) {
return;
}
// Parse emoji.
tweet.text = twemoji.parse(tweet.text);
// Highlight the #SGDQ2016 hashtag.
tweet.text.replace(/(#sgdq2016)/ig, '<span class="hashtag">#SGDQ2016</span>');
// Add the tweet to the list
tweets.value.push(tweet);
}
function addTweet(tweet) {
// Reject tweets with media.
if (tweet.extended_entities && tweet.extended_entities.media.length > 0) {
return;
}
// Don't add the tweet if we already have it
const isDupe = tweets.value.find(t => t.id_str === tweet.id_str);
if (isDupe) {
return;
}
// Parse emoji.
tweet.text = twemoji.parse(tweet.text);
// Highlight the #SGDQ2016 hashtag.
tweet.text = tweet.text.replace(/#sgdq2016/ig, '<span class="hashtag">#SGDQ2016</span>');
// Add the tweet to the list
tweets.value.push(tweet);
}
function addTweet(tweet) {
// Don't add the tweet if we already have it
const isDupe = tweets.value.find((t) => t.id_str === tweet.id_str) ||
fanartTweets.value.find((t) => t.id_str === tweet.id_str);
if (isDupe) {
return;
}
// Parse emoji.
tweet.text = twemoji.parse(tweet.extended_tweet ? tweet.extended_tweet.full_text : tweet.text);
// Replace newlines with spaces
tweet.text = tweet.text.replace(/\n/ig, ' ');
// Highlight the #SGDQ2018 hashtag.
tweet.text = tweet.text.replace(/#sgdq2018/ig, '<span class="hashtag">#SGDQ2018</span>');
if (tweet.extended_tweet &&
tweet.extended_tweet.extended_entities &&
tweet.extended_tweet.extended_entities.media &&
tweet.extended_tweet.extended_entities.media.length > 0) {
tweet.gdqMedia = tweet.extended_tweet.extended_entities.media;
delete tweet.extended_tweet.extended_entities.media;
}
else if (tweet.extended_entities &&
tweet.extended_entities.media &&
tweet.extended_entities.media.length > 0) {
tweet.gdqMedia = tweet.extended_entities.media;
delete tweet.extended_entities.media;
export function lookupEmojiCharacter(icon) {
const codePoint = twemoji.convert.toCodePoint(icon)
if (!names[codePoint]) {
return null
}
// Don't display ™ as an emoji.
if (codePoint === '2122') {
return null
}
return codePoint
}
function grabTheRightIcon(rawText: string) {
// if variant is present as \uFE0F
return twemoji.convert.toCodePoint(
rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, '') : rawText
)
}
function grabTheRightIcon(rawText: string) {
// if variant is present as \uFE0F
return twemoji.convert.toCodePoint(
rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, '') : rawText
)
}
function getEmojiURL (surrogate) {
if (['™', '©', '®'].indexOf(surrogate) > -1) {
return ''
}
try {
// we could link to discord's cdn, but there's a lot of these
// and i'd like to minimize the amount of data we need directly from them
return `https://twemoji.maxcdn.com/2/svg/${Twemoji.convert.toCodePoint(surrogate)}.svg`
} catch (error) {
return ''
}
}
function getEmojiURL(surrogate) {
if (['™', '©', '®'].indexOf(surrogate) > -1) {
return '';
}
try {
// we could link to discord's cdn, but there's a lot of these
// and i'd like to minimize the amount of data we need directly from them
return `https://twemoji.maxcdn.com/2/svg/${Twemoji.convert.toCodePoint(surrogate)}.svg`;
} catch (error) {
return '';
}
}
function grabTheRightIcon(rawText: string): string {
// if variant is present as \uFE0F
return twemoji.convert.toCodePoint(
rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, '') : rawText
)
}
async initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
const { _converse } = this;
const { ___ } = _converse;
_converse.api.settings.update({
'emoji_image_path': twemoji.default.base,
'emoji_categories': {
"smileys": ":grinning:",
"people": ":thumbsup:",
"activity": ":soccer:",
"travel": ":motorcycle:",
"objects": ":bomb:",
"nature": ":rainbow:",
"food": ":hotdog:",
"symbols": ":musical_note:",
"flags": ":flag_ac:",
"custom": null
},
// We use the triple-underscore method which doesn't actually
// translate but does signify to gettext that these strings should
// go into the POT file. The translation then happens in the
// template. We do this so that users can pass in their own