Giter VIP home page Giter VIP logo

embedo's Introduction

embedo npm

Embedo adds a layer on top of third party embed APIs while ensuring best practices and native guidelines for each component. It takes cares of resizing the container, emitting necessary events and with support for native and external options to be pass along.

What's currently supported?

  • Facebook URLs containing page, post, photos, videos or comments
  • Twitter URLs containing user timeline and tweets
  • YouTube and Vimeo videos URLs
  • Instagram URLs containing posts and videos
  • Pinterest URLs containing board, profile and pins
  • Google Maps URLs containing cordinates to a location
  • Embeds other urls like Github Gists, Soundcloud, Spotify or PDF, MP4, Webm, ... as iframe
  • Embeds any URL that fulfils HTTP access control (CORS) policy
  • Extended plugin support for additonal oembed services
  • Supports IE10+ and all modern browsers

Installation

NPM / Yarn

$ npm install embedo --save
$ yarn add embedo

Bower

$ bower install embedo

CDN

Alternatively, import using CDN while updating version as per requirements from any script below:

<script type="text/javascript" src="https://unpkg.com/embedo/embedo.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/embedo[@VERSION]/embedo.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/embedo[@VERSION]/plugins/[@PLUGIN_NAME]/[@PLUGIN_NAME].embedo.min.js"></script>

Setup

CommonJS / AMD

import Embedo from '/path/to/vendor';

// Initialize once (prefer globally)
const embedo = new Embedo({
 facebook: {
    appId: 'my_app_id', // Enable facebook SDK
    version: 'v2.10'
  },
  twitter: true,  // Enable twitter SDK
  instagram: true,  // Enable instagram SDK
  pinterest: true  // Enable pinterest SDK,
  googlemaps: {
    key: 'my_api_key' // Enables google maps API
  }
});

// Then call .load() method from anywhere
embedo.load(<HTMLElement[object]>, <URL[string]>, <options[object]*optional>);

// OR Chaining methods and callback
embedo
  .load(HTMLElement, URL, options)
  .done(Function)
  .fail(Function)

// OR storing in a variable
let my_embedo = embedo.load(HTMLElement, URL)
my_embedo.done(Function);
my_embedo.fail(Function);

Also, an example can be found here.

HTML

...

<body>
  <div data-embedo-url="[@URL_TO_EMBED]"></div>
  <div data-embedo-url="[@URL_TO_EMBED]" data-embedo-[@OPTION_KEY]]="[@OPTION_VALUE]"></div>
</body>

...

<script>
  new Embedo({
    facebook: {
      appId: 'my_app_id', // Enable facebook SDK
      version: 'v2.10'
    },
    twitter: true,  // Enable twitter SDK
    instagram: true,  // Enable instagram SDK
    pinterest: true  // Enable pinterest SDK,
    googlemaps: {
      key: 'my_api_key' // Enables google maps API
    }
  });
</script>

Also, an example can be found here.

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.