How to use the twemoji.parse function in twemoji

To help you get started, we’ve selected a few twemoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GamesDoneQuick / sgdq16-layouts / extension / twitter.js View on Github external
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);
	}
github GamesDoneQuick / sgdq16-layouts / extension / twitter.js View on Github external
function addTweet(tweet) {
		// Reject tweets with media.
		if (tweet.extended_entities &amp;&amp; tweet.extended_entities.media.length &gt; 0) {
			return;
		}

		// Don't add the tweet if we already have it
		const isDupe = tweets.value.find(t =&gt; 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);
	}
github GamesDoneQuick / sgdq18-layouts / dist / extension / twitter.js View on Github external
function addTweet(tweet) {
    // Don't add the tweet if we already have it
    const isDupe = tweets.value.find((t) =&gt; t.id_str === tweet.id_str) ||
        fanartTweets.value.find((t) =&gt; 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 &amp;&amp;
        tweet.extended_tweet.extended_entities &amp;&amp;
        tweet.extended_tweet.extended_entities.media &amp;&amp;
        tweet.extended_tweet.extended_entities.media.length &gt; 0) {
        tweet.gdqMedia = tweet.extended_tweet.extended_entities.media;
        delete tweet.extended_tweet.extended_entities.media;
    }
    else if (tweet.extended_entities &amp;&amp;
        tweet.extended_entities.media &amp;&amp;
        tweet.extended_entities.media.length &gt; 0) {
        tweet.gdqMedia = tweet.extended_entities.media;
        delete tweet.extended_entities.media;
github bevacqua / hubby / hubby.js View on Github external
function reveal (data) {
    console.info('You can play with your data now, it\'s accessible in window.data');
    console.info(data);
    console.table(data.most.starred, 'name homepage stargazers_count forks_count open_issues'.split(' '));
    root.data = data;
    $('.oh-header').html(compile('oh_header', data));
    $('.ot-sidebar').html(compile('ot_sidebar', data));
    $('.ot-description').html(compile('ot_description', data));
    $('.ot-repos').html(compile('ot_repos', data));
    twemoji.parse(document.body);
    document.body.classList.add('hy-reveal');
  }
github night / BetterTTV / src / modules / emotes / emojis.js View on Github external
function countEmojis(emoji) {
    let count = 0;
    twemoji.parse(emoji.char, d => {
        count += d.split('-').length;
    });
    return count;
}
github phpdish / phpdish / assets / modules / md-editor / base-editor.js View on Github external
getHtml(){
        return twemoji.parse(
            emojione.shortnameToUnicode(
                marked(this.getContent())
            )
        );
    }
github bevacqua / hubby / hubby.js View on Github external
return function (res, status, xhr) {
      if (status &lt; 200 || status &gt;= 300) {
        xhrcontainer.classList.add('ve-show');
        xhrmessage.txt($.format('(%s) %s', status, res &amp;&amp; res.message ? res.message : 'Unknown Error'));

        if (res &amp;&amp; res.documentation_url) {
          xhrdocumentation.attr('href', res.documentation_url);
          xhrdocumentation.txt(res.documentation_url);
          xhrdocumentation.html(xhrdocumentation.html() + twemoji.parse(' 😡'));
          xhrdocumentation.classList.add('ve-show');
        } else {
          xhrdocumentation.attr('href', null);
          xhrdocumentation.classList.remove('ve-show');
        }
      } else {
        then(res, status, xhr);
      }
    };
  }
github nebulade / meemo / frontend / js / filter.js View on Github external
md.renderer.rules.emoji = function(token, idx) {
  return twemoji.parse(token[idx].content);
};
github yunity / karrot-frontend / src / utils / components / markdownRenderer.js View on Github external
md.renderer.rules.emoji = (token, idx) => twemoji.parse(token[idx].content)

twemoji

A Unicode standard based way to implement emoji across all platforms.

MIT
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis