Sha256: 5915eda85a5ad578bad2d5d288d3be9b2174cdf3736acb4762ab530934a0e170
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.oembed = factory()); })(this, (function () { 'use strict'; 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); }); }); } return oEmbed; })); //# sourceMappingURL=oembed.js.map
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
blacklight-oembed-1.4.2 | app/assets/javascripts/blacklight_oembed/oembed.js |
blacklight-oembed-1.4.1 | app/assets/javascripts/blacklight_oembed/oembed.js |