A Javascript module to convert emoji keywords to images.
The emoji keywords are as described by emoji-cheat-sheet.com.
Go to this project's GitHub pages to see this module in action.
I wanted my blog to display smileys nicely, decided to use Emojis because they look nice.
Add the required lines to the <head>
part of your HTML code:
<link rel="stylesheet" type="text/css" href="emojify.css">
<script src="emojify.js"></script>
Now type in an emoji keyword in your HTML, for example :smile:
Now run emojify using emojify.run()
.
To exclude tags from being emojified, add no-emojify
to their class
attributes.
To set configuration options, use emojify.setConfig()
and a JSON object as a parameter with the following attributes:
emojify_tag_type
: Set to<div>
by default. Sets the element the emojify.js uses to replace emoji keywordsemoticons_enabled
: Set totrue
by default. Enables detection of emoticon keywords.people_enabled
: Set tofalse
by default. Enables detection of emoji people keywords.nature_enabled
: Set tofalse
by default. Enables detection of emoji nature keywords.objects_enabled
: Set tofalse
by default. Enables detection of emoji objects keywords.places_enabled
: Set tofalse
by default. Enables detection of emoji places keywords.symbols_enabled
: Set tofalse
by default. Enables detection of emoji symbols keywords.only_crawl_id
: Set tonull
by default. Restricts searching for emojis to a specified element & it's children. If null,document.body
is used.
emojify.setConfig({
emojify_tag_type: 'img',
emoticons_enabled: true,
people_enabled: true,
nature_enabled: true,
objects_enabled: true,
places_enabled: true,
symbols_enabled: true,
only_crawl_id: 'messages_container' #only do this when you want to restrict where emojify looks.
});
emojify.run();
This module depends on LESS, or at least requires you to compile the LESS source to CSS.
Copyright 2012 Hassan Khan
Licensed under the MIT License