Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emojify.js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emojify.js

A Javascript module to convert emoji keywords to images.

  • 0.9.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6K
decreased by-57.17%
Maintainers
1
Weekly downloads
 
Created
Source

emojify.js v0.9.2 Build Status Bitdeli Badge Gitter chat

Browser Results

A Javascript module to convert emoji keywords to images. Used by Gitter

The emoji keywords are as described by emoji-cheat-sheet.com.

Go to this project's GitHub pages to see the module in action.

Rationale

I wanted my blog to display smileys nicely, decided to use Emojis because they look nice. GitterHQ wanted to use it in Gitter, so they very kindly rewrote it and here we are.

Usage

Add the following line to your HTML:

<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.

You can optionally pass an object to emojify.run() to restrict the emojification to that object only: emojify.run(document.getElementById('my-element'))

You can also use emojify.replace() method to emojify a string directly:

Configuration

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 keywords
  • only_crawl_id: Set to null by default. Restricts searching for emojis to a specified element & it's children. If null, and no object is passed to run(), document.body is used.
  • img_dir defines the path to the emoji images.
  • ignored_tags should be a list of elements that you don't want emojified.

Code Example

emojify.setConfig({

    emojify_tag_type : 'div',           // Only run emojify.js on this element
    only_crawl_id    : null,            // Use to restrict where emojify.js applies
    img_dir          : 'images/emoji',  // Directory for emoji images
    ignored_tags     : {                // Ignore the following tags
        'SCRIPT'  : 1,
        'TEXTAREA': 1,
        'A'       : 1,
        'PRE'     : 1,
        'CODE'    : 1
    }
});
emojify.run();

Updating the emoji

From time to time, the emoji at emoji-cheat-sheet.com will be updated. Running the update.sh script will update the project with the latest emoji. Don't forget to run grunt after running the update script.

License

http://hassankhan.mit-license.org/

Keywords

FAQs

Package last updated on 15 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc