blacklight-oembed 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eca599615d77fa57e306fdcf6348de145160f3d1f1539e52dd032f7cf491c06
4
- data.tar.gz: de8590f7211be9ae2509e19247f94074cedb0c42ec28906b991ed1f122f0fd43
3
+ metadata.gz: ca622e6493231613d2e1e8709cd59bdd5b092102e8add584aa8729cc62dafd92
4
+ data.tar.gz: 71350e1b92d7bda34dbd15a9da041c6320d1fe722920e29d72517f3e58774fc5
5
5
  SHA512:
6
- metadata.gz: b7804204d05c70d791e8eb1002fa3c6403d10e1ae09c6ca636e3f637e9e40aa258ae55f31acff8034bf0153b12cafebddf9e95389f3de54849916c5907d537a0
7
- data.tar.gz: 55127a170107f36f033db58458a45810a6b222b38daeda9b909a052548fb75740977137d1a15634d554627e90ab3fb23ecae37230fae6727beb0d9f634e92b52
6
+ metadata.gz: e275f3324443f7120656aba199c6da9ee87d175ac00248122a3b75938a1152a22cdc371c30e31fc38f1ab548c376d17b795d5dc62c2ee73065937a23fe460d4a
7
+ data.tar.gz: 6b5d7d3b20aaa33894e1e30830032e25565e78004af528e09f6ee7ba60f0652a255e7d60125840f79354563a79b13d865755ce8980a96f7beedad136669c2c9d
@@ -0,0 +1,31 @@
1
+ export default function oEmbed(elements) {
2
+ if (!elements) return;
3
+
4
+ // Ensure elements is an array-like collection
5
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
6
+
7
+ elements.forEach(function(embedViewer) {
8
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
9
+
10
+ if (!embedURL) return;
11
+
12
+ // Fetch JSON data from the embed URL
13
+ fetch(embedURL)
14
+ .then(response => {
15
+ if (!response.ok) {
16
+ throw new Error('Network response was not ok');
17
+ }
18
+ return response.json();
19
+ })
20
+ .then(data => {
21
+ if (data === null) {
22
+ return;
23
+ }
24
+ // Set the inner HTML of the element
25
+ embedViewer.innerHTML = data.html;
26
+ })
27
+ .catch(error => {
28
+ console.error('Error fetching embed data:', error);
29
+ });
30
+ });
31
+ }
@@ -1,5 +1,5 @@
1
1
  module Blacklight
2
2
  module Oembed
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
- //= require 'blacklight_oembed/jquery.oembed.js'
1
+ import oembed from 'blacklight_oembed/oembed'
2
2
 
3
3
  Blacklight.onLoad(function() {
4
- $('[data-embed-url]').oEmbed();
5
- });
4
+ oembed(document.querySelectorAll('[data-embed-url]'));
5
+ });
data/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "blacklight-oembed",
3
+ "version": "1.3.0",
4
+ "description": "Oembed behavior for Blacklight",
5
+ "main": "app/assets/javascripts/blacklight_oembed/oembed.js",
6
+ "files": [
7
+ "app/assets/javascripts/blacklight_oembed/*.js"
8
+ ],
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/projectblacklight/blacklight-oembed.git"
15
+ },
16
+ "author": "Chris Beer, Justin Coyne, et al.",
17
+ "license": "Apache-2.0",
18
+ "bugs": {
19
+ "url": "https://github.com/projectblacklight/blacklight-oembed/issues"
20
+ },
21
+ "homepage": "https://github.com/projectblacklight/blacklight-oembed#readme",
22
+ "dependencies": {}
23
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-oembed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-25 00:00:00.000000000 Z
11
+ date: 2025-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -213,6 +213,7 @@ files:
213
213
  - README.md
214
214
  - Rakefile
215
215
  - app/assets/javascripts/blacklight_oembed/jquery.oembed.js
216
+ - app/assets/javascripts/blacklight_oembed/oembed.js
216
217
  - app/components/blacklight/oembed/document_oembed_component.html.erb
217
218
  - app/components/blacklight/oembed/document_oembed_component.rb
218
219
  - app/controllers/blacklight/oembed/embed_controller.rb
@@ -230,6 +231,7 @@ files:
230
231
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.css.scss
231
232
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.js
232
233
  - lib/generators/blacklight_oembed/templates/oembed_providers.rb
234
+ - package.json
233
235
  - solr/conf/_rest_managed.json
234
236
  - solr/conf/admin-extra.html
235
237
  - solr/conf/elevate.xml
@@ -272,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
274
  - !ruby/object:Gem::Version
273
275
  version: '0'
274
276
  requirements: []
275
- rubygems_version: 3.5.9
277
+ rubygems_version: 3.5.23
276
278
  signing_key:
277
279
  specification_version: 4
278
280
  summary: Oembed display for Blacklight