Giter Club home page Giter Club logo

embed.js's Introduction

Build Status npm Twitter Producthunt paypal

A JavaScript plugin that analyses the string and automatically embeds the supported emojis, media, maps, tweets, code and services.

screen

Important links

Installation

To install the stable version:

npm install --save embed-js

CDN

Simple Usage

Let's assume that the HTML structure is as written below

<div id="element">
   <!--===== your string here =======-->
</div>

Creating an instance of embed.js

var x = new EmbedJS({
  input: document.getElementById('element'),
  googleAuthKey : 'xxxx'
})

Next step is replacing the original text with the processed text.

//Render the result
x.render();

There may be cases where you just want the processed string to use it according to your need. You can get it by the following method.

//Get the resulting string
x.text(function(data){
  console.log(data); //The resultant string
})

If you wan't to destroy the instance. It will also replace the processed string with the original string.

//Destroy the instance
x.destroy()

Adding custom emojis

  1. Add the image to assets/images/emojis. Make sure the name of the file is same as emoji name.
  2. Pass the emoji name as the value to customEmoji. See the example here
  3. Run grunt build-emoji && grunt build

Development

  1. Fork the repo
  2. clone the repo then cd embed.js
  3. create a new branch
  4. Make sure ruby and sass are installed on your system.
  5. Then npm install && npm i -g rollup && npm i -g grunt-cli
  6. grunt : this will start the grunt server and open a demo page.
  7. Create a PR

Note: This projects adheres to a Code of Conduct.

grunt tasks

  1. grunt : starts development server and watches files for changes. Run this for development purpose.
  2. grunt dist : create dist directory with all the different build files
  3. grunt build-emoji : create spritesheet from all the emojis. Only run if you have made some changes related to emojis

License

MIT © Ritesh Kumar

embed.js's People

Contributors

ritz078 avatar greenkeeperio-bot avatar kanikasaini avatar jesusprubio avatar ishakalra avatar ibc avatar insfi11 avatar snehamidha avatar jagannath93 avatar peterdavehello avatar robman87 avatar avinash-msp avatar sohamidha avatar maruilian11 avatar

Watchers

James Cloos avatar  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.