blacklight-oembed 1.2.0 → 1.4.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: 7c4944caa252256a06f3db9bb7d7f9f007729917dfaf28a308891344b2343d4c
4
+ data.tar.gz: b751021ec49bd9064a41b0f954e6343fdaa462a72b1f1e92c472649f2e3ea578
5
5
  SHA512:
6
- metadata.gz: b7804204d05c70d791e8eb1002fa3c6403d10e1ae09c6ca636e3f637e9e40aa258ae55f31acff8034bf0153b12cafebddf9e95389f3de54849916c5907d537a0
7
- data.tar.gz: 55127a170107f36f033db58458a45810a6b222b38daeda9b909a052548fb75740977137d1a15634d554627e90ab3fb23ecae37230fae6727beb0d9f634e92b52
6
+ metadata.gz: 185a2f95792bca7d9ea4a76a534d4be09e58da59956c24344149c290f34c551863f0c4dbe61fad47ca893deb6f62ded16415504dbc186758dd7cbe0237e0aeec
7
+ data.tar.gz: 1b431ee4d17ae3b9ca1240c3c23ec01efcf49340c06a8aba575a2cfa3736f5130efd019613701630265287af34e8303a1c2d8811196ff5d4aa6e8704a6074835
data/.gitignore CHANGED
@@ -16,3 +16,6 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .internal_test_app
19
+
20
+ node_modules
21
+ package-lock.json
@@ -0,0 +1,34 @@
1
+ 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
+ }
32
+
33
+ export { oEmbed as default };
34
+ //# sourceMappingURL=oembed.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oembed.esm.js","sources":["../../../javascript/oembed.js"],"sourcesContent":["export default function oEmbed(elements) {\n if (!elements) return;\n\n // Ensure elements is an array-like collection\n elements = elements instanceof NodeList ? Array.from(elements) : [elements];\n\n elements.forEach(function(embedViewer) {\n const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute\n\n if (!embedURL) return;\n\n // Fetch JSON data from the embed URL\n fetch(embedURL)\n .then(response => {\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n return response.json();\n })\n .then(data => {\n if (data === null) {\n return;\n }\n // Set the inner HTML of the element\n embedViewer.innerHTML = data.html;\n })\n .catch(error => {\n console.error('Error fetching embed data:', error);\n });\n });\n}\n"],"names":[],"mappings":"AAAe,SAAS,MAAM,CAAC,QAAQ,EAAE;AACzC,EAAE,IAAI,CAAC,QAAQ,EAAE;;AAEjB;AACA,EAAE,QAAQ,GAAG,QAAQ,YAAY,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;;AAE7E,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,WAAW,EAAE;AACzC,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;AAElD,IAAI,IAAI,CAAC,QAAQ,EAAE;;AAEnB;AACA,IAAI,KAAK,CAAC,QAAQ;AAClB,OAAO,IAAI,CAAC,QAAQ,IAAI;AACxB,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAC1B,UAAU,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;AACxD;AACA,QAAQ,OAAO,QAAQ,CAAC,IAAI,EAAE;AAC9B,OAAO;AACP,OAAO,IAAI,CAAC,IAAI,IAAI;AACpB,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;AAC3B,UAAU;AACV;AACA;AACA,QAAQ,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI;AACzC,OAAO;AACP,OAAO,KAAK,CAAC,KAAK,IAAI;AACtB,QAAQ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC;AAC1D,OAAO,CAAC;AACR,GAAG,CAAC;AACJ;;;;"}
@@ -0,0 +1,42 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BlacklightOembed = factory());
5
+ })(this, (function () { 'use strict';
6
+
7
+ function oEmbed(elements) {
8
+ if (!elements) return;
9
+
10
+ // Ensure elements is an array-like collection
11
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
12
+
13
+ elements.forEach(function(embedViewer) {
14
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
15
+
16
+ if (!embedURL) return;
17
+
18
+ // Fetch JSON data from the embed URL
19
+ fetch(embedURL)
20
+ .then(response => {
21
+ if (!response.ok) {
22
+ throw new Error('Network response was not ok');
23
+ }
24
+ return response.json();
25
+ })
26
+ .then(data => {
27
+ if (data === null) {
28
+ return;
29
+ }
30
+ // Set the inner HTML of the element
31
+ embedViewer.innerHTML = data.html;
32
+ })
33
+ .catch(error => {
34
+ console.error('Error fetching embed data:', error);
35
+ });
36
+ });
37
+ }
38
+
39
+ return oEmbed;
40
+
41
+ }));
42
+ //# sourceMappingURL=oembed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oembed.js","sources":["../../../javascript/oembed.js"],"sourcesContent":["export default function oEmbed(elements) {\n if (!elements) return;\n\n // Ensure elements is an array-like collection\n elements = elements instanceof NodeList ? Array.from(elements) : [elements];\n\n elements.forEach(function(embedViewer) {\n const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute\n\n if (!embedURL) return;\n\n // Fetch JSON data from the embed URL\n fetch(embedURL)\n .then(response => {\n if (!response.ok) {\n throw new Error('Network response was not ok');\n }\n return response.json();\n })\n .then(data => {\n if (data === null) {\n return;\n }\n // Set the inner HTML of the element\n embedViewer.innerHTML = data.html;\n })\n .catch(error => {\n console.error('Error fetching embed data:', error);\n });\n });\n}\n"],"names":[],"mappings":";;;;;;EAAe,SAAS,MAAM,CAAC,QAAQ,EAAE;EACzC,EAAE,IAAI,CAAC,QAAQ,EAAE;;EAEjB;EACA,EAAE,QAAQ,GAAG,QAAQ,YAAY,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;;EAE7E,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,WAAW,EAAE;EACzC,IAAI,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC;;EAElD,IAAI,IAAI,CAAC,QAAQ,EAAE;;EAEnB;EACA,IAAI,KAAK,CAAC,QAAQ;EAClB,OAAO,IAAI,CAAC,QAAQ,IAAI;EACxB,QAAQ,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;EAC1B,UAAU,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC;EACxD;EACA,QAAQ,OAAO,QAAQ,CAAC,IAAI,EAAE;EAC9B,OAAO;EACP,OAAO,IAAI,CAAC,IAAI,IAAI;EACpB,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE;EAC3B,UAAU;EACV;EACA;EACA,QAAQ,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI;EACzC,OAAO;EACP,OAAO,KAAK,CAAC,KAAK,IAAI;EACtB,QAAQ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC;EAC1D,OAAO,CAAC;EACR,GAAG,CAAC;EACJ;;;;;;;;"}
@@ -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.4.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,28 @@
1
+ {
2
+ "name": "blacklight-oembed",
3
+ "version": "1.4.0",
4
+ "description": "Oembed behavior for Blacklight",
5
+ "main": "app/assets/javascripts/blacklight_oembed/oembed.js",
6
+ "type": "module",
7
+ "files": [
8
+ "app/assets/javascripts/blacklight_oembed/*.js"
9
+ ],
10
+ "scripts": {
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "prepare": "rollup --config rollup.config.js --sourcemap && ESM=true rollup --config rollup.config.js --sourcemap"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/projectblacklight/blacklight-oembed.git"
17
+ },
18
+ "author": "Chris Beer, Justin Coyne, et al.",
19
+ "license": "Apache-2.0",
20
+ "bugs": {
21
+ "url": "https://github.com/projectblacklight/blacklight-oembed/issues"
22
+ },
23
+ "homepage": "https://github.com/projectblacklight/blacklight-oembed#readme",
24
+ "dependencies": {
25
+ "rollup": "^4.30.1",
26
+ "rollup-plugin-includepaths": "^0.2.4"
27
+ }
28
+ }
data/rollup.config.js ADDED
@@ -0,0 +1,27 @@
1
+ import includePaths from 'rollup-plugin-includepaths';
2
+
3
+
4
+ const BUNDLE = process.env.BUNDLE === 'true'
5
+ const ESM = process.env.ESM === 'true'
6
+
7
+ const fileDest = `oembed${ESM ? '.esm' : ''}`
8
+
9
+ let includePathOptions = {
10
+ include: {},
11
+ paths: ['app/javascript'],
12
+ external: [],
13
+ extensions: ['.js']
14
+ };
15
+
16
+ const rollupConfig = {
17
+ input: 'app/javascript/oembed.js',
18
+ output: {
19
+ file: `app/assets/javascripts/blacklight_oembed/${fileDest}.js`,
20
+ format: ESM ? 'es' : 'umd',
21
+ generatedCode: { preset: 'es2015' },
22
+ name: ESM ? undefined : 'BlacklightOembed'
23
+ },
24
+ plugins: [includePaths(includePathOptions)]
25
+ }
26
+
27
+ export default rollupConfig
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.4.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-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -213,10 +213,15 @@ 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.esm.js
217
+ - app/assets/javascripts/blacklight_oembed/oembed.esm.js.map
218
+ - app/assets/javascripts/blacklight_oembed/oembed.js
219
+ - app/assets/javascripts/blacklight_oembed/oembed.js.map
216
220
  - app/components/blacklight/oembed/document_oembed_component.html.erb
217
221
  - app/components/blacklight/oembed/document_oembed_component.rb
218
222
  - app/controllers/blacklight/oembed/embed_controller.rb
219
223
  - app/helpers/blacklight/oembed/oembed_helper.rb
224
+ - app/javascript/oembed.js
220
225
  - app/views/catalog/_oembed_default.html.erb
221
226
  - blacklight-oembed.gemspec
222
227
  - config/jetty.yml
@@ -230,6 +235,8 @@ files:
230
235
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.css.scss
231
236
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.js
232
237
  - lib/generators/blacklight_oembed/templates/oembed_providers.rb
238
+ - package.json
239
+ - rollup.config.js
233
240
  - solr/conf/_rest_managed.json
234
241
  - solr/conf/admin-extra.html
235
242
  - solr/conf/elevate.xml
@@ -272,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
279
  - !ruby/object:Gem::Version
273
280
  version: '0'
274
281
  requirements: []
275
- rubygems_version: 3.5.9
282
+ rubygems_version: 3.5.23
276
283
  signing_key:
277
284
  specification_version: 4
278
285
  summary: Oembed display for Blacklight