blacklight-oembed 1.3.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: ca622e6493231613d2e1e8709cd59bdd5b092102e8add584aa8729cc62dafd92
4
- data.tar.gz: 71350e1b92d7bda34dbd15a9da041c6320d1fe722920e29d72517f3e58774fc5
3
+ metadata.gz: 7c4944caa252256a06f3db9bb7d7f9f007729917dfaf28a308891344b2343d4c
4
+ data.tar.gz: b751021ec49bd9064a41b0f954e6343fdaa462a72b1f1e92c472649f2e3ea578
5
5
  SHA512:
6
- metadata.gz: e275f3324443f7120656aba199c6da9ee87d175ac00248122a3b75938a1152a22cdc371c30e31fc38f1ab548c376d17b795d5dc62c2ee73065937a23fe460d4a
7
- data.tar.gz: 6b5d7d3b20aaa33894e1e30830032e25565e78004af528e09f6ee7ba60f0652a255e7d60125840f79354563a79b13d865755ce8980a96f7beedad136669c2c9d
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;;;;"}
@@ -1,31 +1,42 @@
1
- export default function oEmbed(elements) {
2
- if (!elements) return;
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';
3
6
 
4
- // Ensure elements is an array-like collection
5
- elements = elements instanceof NodeList ? Array.from(elements) : [elements];
7
+ function oEmbed(elements) {
8
+ if (!elements) return;
6
9
 
7
- elements.forEach(function(embedViewer) {
8
- const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
10
+ // Ensure elements is an array-like collection
11
+ elements = elements instanceof NodeList ? Array.from(elements) : [elements];
9
12
 
10
- if (!embedURL) return;
13
+ elements.forEach(function(embedViewer) {
14
+ const embedURL = embedViewer.dataset.embedUrl; // Get the embed URL from the data attribute
11
15
 
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
- }
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.3.0'
3
+ VERSION = '1.4.0'
4
4
  end
5
5
  end
data/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "blacklight-oembed",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Oembed behavior for Blacklight",
5
5
  "main": "app/assets/javascripts/blacklight_oembed/oembed.js",
6
+ "type": "module",
6
7
  "files": [
7
8
  "app/assets/javascripts/blacklight_oembed/*.js"
8
9
  ],
9
10
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
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"
11
13
  },
12
14
  "repository": {
13
15
  "type": "git",
@@ -19,5 +21,8 @@
19
21
  "url": "https://github.com/projectblacklight/blacklight-oembed/issues"
20
22
  },
21
23
  "homepage": "https://github.com/projectblacklight/blacklight-oembed#readme",
22
- "dependencies": {}
24
+ "dependencies": {
25
+ "rollup": "^4.30.1",
26
+ "rollup-plugin-includepaths": "^0.2.4"
27
+ }
23
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.3.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: 2025-01-08 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,11 +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
216
218
  - app/assets/javascripts/blacklight_oembed/oembed.js
219
+ - app/assets/javascripts/blacklight_oembed/oembed.js.map
217
220
  - app/components/blacklight/oembed/document_oembed_component.html.erb
218
221
  - app/components/blacklight/oembed/document_oembed_component.rb
219
222
  - app/controllers/blacklight/oembed/embed_controller.rb
220
223
  - app/helpers/blacklight/oembed/oembed_helper.rb
224
+ - app/javascript/oembed.js
221
225
  - app/views/catalog/_oembed_default.html.erb
222
226
  - blacklight-oembed.gemspec
223
227
  - config/jetty.yml
@@ -232,6 +236,7 @@ files:
232
236
  - lib/generators/blacklight_oembed/templates/blacklight_oembed.js
233
237
  - lib/generators/blacklight_oembed/templates/oembed_providers.rb
234
238
  - package.json
239
+ - rollup.config.js
235
240
  - solr/conf/_rest_managed.json
236
241
  - solr/conf/admin-extra.html
237
242
  - solr/conf/elevate.xml