Last active
February 19, 2017 19:20
-
-
Save brijeshb42/a8ee12f59844eeee930cb98761e89107 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// declare functions for all the different types of embeds as shown previously | |
const Types = { | |
youtube, | |
vimeo, | |
vine, | |
twitter, | |
facebook, | |
instagram, | |
iframe | |
}; | |
export const load = (node = document) => { | |
const $nodes = $(node).find('[data-embed-loaded=false]'); | |
$nodes.each(function () { | |
const $this = $(this); | |
const type = $this.data('embed-type'); | |
if (Types.hasOwnProperty(type)) { | |
Types[type]($this); | |
} | |
$this.attr(loadedAttr, 'true'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment