Embeds third party content to DOM with perks 🧙♀️ (7kb gzip / standalone)
access_token
property globally or in single instance. This will automatically injected to all embed URLs called with the embedo's instance. No breaking changes.// facebook initialize options
new Embedo({
facebook: {
appId: {your-app-id},
access_token: {your-app-id|your-client-token}
}
});
// instagram initialize options
new Embedo({
instagram: {
access_token: {your-app-id|your-client-token}
}
});
6.9kb
/ demo: codepen
// Custom SDK Format
new Embedo({
[source: string (facebook/twitter/...)]: {
sdk: string
}
})
// Example for override facebook SDK
new Embedo({
facebook: {
sdk: "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.2"
}
})
Ref: PR #19 and #20. Also, see options for more details.
update
Added Embedo.plugins([ ... plugins ])
to initialize multiple plugins during init for es6 or AMD modules.import Embedo from 'embedo'
import withEmbedoReddit from 'embedo/plugins/reddit'
import withEmbedoGmaps from 'embedo/plugins/gmaps'
import withEmbedoFlickr from 'embedo/plugins/flickr'
// Then, load plugins
Embedo.plugins([ withEmbedoGmaps, withEmbedoReddit, withEmbedoFlickr ])
// OR works as HOC
withEmbedoReddit(Embedo)
// Then init Embedo instance
Embedo.init({ ..., reddit: true, googlemaps: { ... } })
Try it on codesandbox demo here.
patch
Fixed instagram embed by adding embedding as iframe
as fallback. Due to recent changes with instagram API, they broke their own embed system, but if you add suffix /embed
after post/photo URL, it can embed as iframe, see example here.
Added Flickr plugin
boolean
, but use undefined
or null
instead. Apart, resizing iframe itself is not feasible to detect autoheight. I suggest to use iframe-resizer if you need to have auto-detected heights of embed element. Once issue with instagram is resolved, pass jsonp: true|false
with load options based on your case.update
Removed googlemaps
from core and move to plugins as an add-on on top of embedo class instance in next release.fix
Fixed error handling during jsonp
fetchfeature
Added Domify: .domify()
New method that embeds the content to dom with options set using html elements, see usecase here.feature
Added Plugins: Integrated extensions that re-uses embedo base class to build plugins based on external sources, see an example here with react.new
Added plugins for Google Maps and Reddit, see here.update
Disintegration google maps source from core to plugins. You only need to import the plugin in order to make it backward compatible by either loading gmaps script in dom or importing through module and passing Embedo
instance to it, as shown here.update
Code refactoring and cleanup.XMLHttpRequest
method instead of jsonp
call.jsonp
can be set along with instagram options to fallback to old behaviour, in case if instagram changes policy in future again.fix
Fixed Pinterest error handler with setInterval
adding unnecessary microtasks which threw error even during success.other
Refactoring of codebase. Bumped default FB sdk version to v3.1.fix
Deprecated window.postMessage handler to resolve circular JSON issue caused by async calls in chain.