Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i use it my blog ? #5

Closed
nabeelsaleem opened this issue Nov 7, 2014 · 2 comments
Closed

How can i use it my blog ? #5

nabeelsaleem opened this issue Nov 7, 2014 · 2 comments

Comments

@nabeelsaleem
Copy link

i want to use in blogspot blog can you tell me how can i do this ?
http://t.co/Qmx3f3ObFR

@WebReflection
Copy link
Collaborator

This is just one way of doing it.

You can add the proper image style on top of your template:

<style>
img.emoji {
   height: 1em;
   width: 1em;
   margin: 0 .05em 0 .1em;
   vertical-align: -0.1em;
}
</style>

Plus the twemoji library

<script src="//twemoji.maxcdn.com/twemoji.min.js"></script>

And at the bottom of the template, where there are usually other scripts, you can:

<script>
(function (div) {
  for (var i = 0, re = /\bblog-posts\b/; i < div.length; i++) {
    if (re.test(div[i].className)) {
      twemoji.parse(div[i]);
    }
  }
}(document.getElementsByTagName('div')));
// it could be faster and simpler via
// document.querySelectorAll('.blog-posts')
// but I wanted to avoid errors with older browsers
</script>

This should replace all emoji chars in your posts with images, by default 36x36 png.

However, you need to be able to write emoji in your posts, using as example a compatible mobile device, since this project is about reading with emoji, and not writing them.

It would be awesome to have a plugin based on twemoji able to let anyone include them in any textarea. Maybe coming soon from third parts?

Hope this helped.

@sonyarianto
Copy link

great example :) like it

birarda referenced this issue in discord/twemoji Mar 28, 2023
* v14.1.1

* Optimize 3 SVG(s)

---------

Co-authored-by: Justine De Caires <justine@minerva.kgi.edu>
Co-authored-by: jdecked <jdecked@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants