Setup Usage Docs

embedo

A simple, lightweight and standalone content embed plugin for web

embedo.js

Bower version npm version
        
 /**
  * @implements Embedo setup
  *
  * @package {npm} npm install embedo --save
  * @package {bower} bower install embedo
  *
  * @import {jsdelivr} https://cdn.jsdelivr.net/npm/embedo
  * @import {cdnjs} https://cdnjs.com/libraries/embedo
  * @import {unpkg} https://unpkg.com/embedo
  */

  import Embedo from './my/vendor/folder';

  const embedo = new Embedo({
    facebook: {
      appId: 'my_app_id', // Enable facebook SDK
      version: 'v8.0',
      access_token: 'your_client_access_token'
    },
    twitter: true,  // Enable twitter SDK
    instagram: {
      access_token: 'your_client_access_token'
    },  // Enable instagram SDK
    pinterest: true  // Enable pinterest SDK,
    googlemaps: {
      key: 'my_api_key' // Enables google maps API
    }
  });

  // Calling .load() event (HTMLElement, url[String|Array], options[Object])
  embedo.load(
    document.getElementById('my-awesome-container'),
    'https://twitter.com/Twitter/status/849866660882206721'
  )
  .done((data) => {})
  .fail((err) => {})

  // OR calling .load() event (HTMLElement, url[String|Array], options[Object])
  embedo.load(
    document.getElementById('my-awesome-container'), [
    'https://www.instagram.com/p/BX3fMnRjHpZ',
    'https://www.instagram.com/p/BX3ejdJHmkD',
    'https://www.instagram.com/p/BX3VEDqFvmg'
  ], {
    hidecaption: false
  });

  // Load with native and external options
  embedo.load(
    document.getElementById('my-awesome-container'),
    'https://www.instagram.com/p/BSoJJjQA3Td/',
    {
      width: 640,
      height: 480,
      hidecaption: true
    }
  );

  // Also, the jQuery way
  embedo.load($('my-awesome-container').get(0), 'my://url');

  // Refresh event (if no element passed, refreshes all embedo instances)
  embedo.refresh(document.getElementById('my-awesome-container'));

  // Destroy event (if no element passed, destroys all embedo instances)
  embedo.destroy(document.getElementById('my-awesome-container'));

  // Single instance event handler
  embedo.load(el, url, options).done((data) => {}).fail((err) => {})

  // Global instances event handlers
  embedo.on('watch', (event, result) => {});
  embedo.on('refresh', (result, data) => {});
  embedo.on('destroy', () => {});
        
      

What's currently supported?

Facebook URLs containing page, post, photos, videos or comments
Twitter URLs containing user timeline and tweets
YouTube videos URLs, playlists will play in loop
Instagram URLs containing posts and videos
Pinterest URLs containing boards, profile and pins
Vimeo URLs containing videos
SoundCloud URLs containing videos
Reddit posts or comments as plugin
Google Maps URLs containing cordinates to a location
Fallback to iframe for allowed CORS urls or formats like .pdf, .webm, etc.