Giter VIP home page Giter VIP logo

emojify.js's Introduction

emojify.js v0.8.0

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 the module in action.

Rationale

I wanted my blog to display smileys nicely, decided to use Emojis because they look nice.

Usage

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.

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

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
  • emoticons_enabled: Set to true by default. Enables detection of emoticon keywords.
  • people_enabled: Set to false by default. Enables detection of emoji people keywords.
  • nature_enabled: Set to false by default. Enables detection of emoji nature keywords.
  • objects_enabled: Set to false by default. Enables detection of emoji objects keywords.
  • places_enabled: Set to false by default. Enables detection of emoji places keywords.
  • symbols_enabled: Set to false by default. Enables detection of emoji symbols 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.

Code Example

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.js applies.
});
emojify.run();

Dependencies

This module depends on LESS, or at least requires you to compile the LESS source to CSS.

License

Copyright 2012 Hassan Khan

Licensed under the MIT License

emojify.js's People

Contributors

hassankhan avatar dylanjha avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.