Sha256: 9f7ed2ba5540ca6ee2b363e1a4eb26e81f08fadd01f1b8449b2d0b4a416deb65
Contents?: true
Size: 924 Bytes
Versions: 3
Compression:
Stored size: 924 Bytes
Contents
function oEmbed(elements) { if (!elements) return; // Ensure elements is an array-like collection elements = elements instanceof NodeList ? Array.from(elements) : [elements]; elements.forEach(function(embedViewer) { const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute if (!embedURL) return; // Fetch JSON data from the embed URL fetch(embedURL) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { if (data === null) { return; } // Set the inner HTML of the element embedViewer.innerHTML = data.html; }) .catch(error => { console.error('Error fetching embed data:', error); }); }); } export { oEmbed as default }; //# sourceMappingURL=oembed.esm.js.map
Version data entries
3 entries across 3 versions & 1 rubygems