From c09ad28db61a27f6014c720f5e7a607f8ccf0b1b Mon Sep 17 00:00:00 2001 From: Dong Nguyen Date: Wed, 21 Sep 2022 22:04:44 +0700 Subject: [PATCH] v3.1.1 - Add `fetchOption` parameter - Allow to pass request to proxy --- README.md | 86 ++++++++++++++----- dist/cjs/oembed-parser.js | 39 +++++---- dist/cjs/package.json | 2 +- dist/oembed-parser.esm.js | 39 +++++---- examples/browser-oembed-parser/README.md | 16 ++-- examples/browser-oembed-parser/package.json | 6 +- .../public/chota.min.css | 1 + .../browser-oembed-parser/public/index.html | 16 ++-- examples/browser-oembed-parser/server.js | 30 +++++++ package.json | 2 +- src/main.js | 4 +- src/utils/fetchEmbed.js | 11 +-- src/utils/retrieve.js | 28 ++++-- src/utils/retrieve.test.js | 19 ++++ 14 files changed, 219 insertions(+), 80 deletions(-) create mode 100644 examples/browser-oembed-parser/public/chota.min.css create mode 100644 examples/browser-oembed-parser/server.js diff --git a/README.md b/README.md index 8cec78b..12f827b 100644 --- a/README.md +++ b/README.md @@ -64,28 +64,25 @@ View [more examples](https://github.com/ndaidong/oembed-parser/tree/main/example ## APIs -### `.extract(String url [, Object params])` +### `.extract()` Load and extract oembed data. -Example: +#### Syntax ```js -import { extract } from 'oembed-parser' +extract(String url) +extract(String url, Object params) +extract(String url, Object params, Object fetchOptions) +``` -const getOembed = async (url) => { - try { - const oembed = await extract(url) - return oembed - } catch (err) { - console.trace(err) - return null - } -} +#### Parameters -const data = getOembed('your url') -console.log(data) -``` +##### `url` *required* + +URL of a valid oEmbed resource, e.g. `https://www.youtube.com/watch?v=x2bqscVkGxk` + +##### `params` *optional* Optional argument `params` can be useful when you want to specify some additional customizations. @@ -99,15 +96,62 @@ Here are several popular params: Note that some params are supported by these providers but not by the others. Please see the provider's oEmbed API docs carefully for exact information. +##### `fetchOptions` *optional* + +You can use this param to set request headers to fetch. + +For example: + +```js +import { extract } from 'oembed-parser' + +const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' +extract(url, null, { + headers: { + 'user-agent': 'Opera/9.60 (Windows NT 6.0; U; en) Presto/2.1.1' + } +}) +``` + +You can also specify a proxy endpoint to load remote content, instead of fetching directly. -### `.setProviderList(Array providers)` +For example: + +```js +import { extract } from 'oembed-parser' + +const url = 'https://codepen.io/ndaidong/pen/LYmLKBw' +extract(url, null, { + headers: { + 'user-agent': 'Opera/9.60 (Windows NT 6.0; U; en) Presto/2.1.1' + }, + proxy: { + target: 'https://your-secret-proxy.io/loadJson?url=', + headers: { + 'Proxy-Authorization': 'Bearer YWxhZGRpbjpvcGVuc2VzYW1l...' + } + } +}) +``` + +With the above setting, request will be forwarded to `https://your-secret-proxy.io/loadJson?url={OEMBED_ENDPOINT}`. + + +### `.setProviderList()` Apply a list of providers to use, overriding the [default](https://raw.githubusercontent.com/ndaidong/oembed-parser/master/src/utils/providers.json). -This can be useful for whitelisting only certain providers, or for adding -custom providers. +#### Syntax -Default list of resource providers is synchronized from [oembed.com](http://oembed.com/providers.json). +```js +setProviderList(Array providers) +``` + +#### Parameters + +##### `providers` *required* + +List of providers to apply. For example: @@ -134,6 +178,9 @@ const providers = [ setProviderList(providers) ``` +Default list of resource providers is synchronized from [oembed.com](http://oembed.com/providers.json). + + ## Facebook and Instagram In order to work with the links from Facebook and Instagram, you need a [reviewed Facebook's app](https://developers.facebook.com/docs/app-review) with [oEmbed Read](https://developers.facebook.com/docs/features-reference/oembed-read) permission. @@ -149,7 +196,6 @@ export FACEBOOK_CLIENT_TOKEN=your_client_token npm run eval https://www.instagram.com/tv/CVlR5GFqF68/ ``` - ## License The MIT License (MIT) diff --git a/dist/cjs/oembed-parser.js b/dist/cjs/oembed-parser.js index 416e8cc..0301bdf 100644 --- a/dist/cjs/oembed-parser.js +++ b/dist/cjs/oembed-parser.js @@ -1,4 +1,4 @@ -// oembed-parser@3.1.0, by @ndaidong - built with esbuild at 2022-09-19T09:58:58.156Z - published under MIT license +// oembed-parser@3.1.1, by @ndaidong - built with esbuild at 2022-09-21T15:03:39.445Z - published under MIT license var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; @@ -2921,19 +2921,31 @@ var getDomain = (url) => { // src/utils/retrieve.js var import_cross_fetch = __toESM(require_node_ponyfill(), 1); -var retrieve_default = async (url) => { - const res = await (0, import_cross_fetch.default)(url, { - headers: { - "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" - } +var profetch = async (url, proxy = {}) => { + const { + target, + headers = {} + } = proxy; + const res = await (0, import_cross_fetch.default)(target + encodeURIComponent(url), { + headers }); + return res; +}; +var retrieve_default = async (url, options = {}) => { + const { + headers = { + "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" + }, + proxy = null + } = options; + const res = proxy ? await profetch(url, proxy) : await (0, import_cross_fetch.default)(url, { headers }); const status = res.status; if (status >= 400) { throw new Error(`Request failed with error code ${status}`); } try { const text = await res.text(); - return JSON.parse(text); + return JSON.parse(text.trim()); } catch (err) { throw new Error("Failed to convert data to JSON object"); } @@ -2949,10 +2961,7 @@ var getFacebookGraphToken = () => { const clientToken = env.FACEBOOK_CLIENT_TOKEN; return `${appId}|${clientToken}`; }; -var getRegularUrl = (query, basseUrl) => { - return basseUrl + "?" + query; -}; -var fetchEmbed_default = async (url, params = {}, endpoint = "") => { +var fetchEmbed_default = async (url, params = {}, endpoint = "", options = {}) => { const query = { url, format: "json", @@ -2968,8 +2977,8 @@ var fetchEmbed_default = async (url, params = {}, endpoint = "") => { query.access_token = getFacebookGraphToken(); } const queryParams = new URLSearchParams(query).toString(); - const link = getRegularUrl(queryParams, endpoint); - const body = retrieve_default(link); + const link = endpoint + "?" + queryParams; + const body = retrieve_default(link, options); return body; }; @@ -5057,7 +5066,7 @@ var getEndpoint = (url) => { }; // src/main.js -var extract = async (url, params = {}) => { +var extract = async (url, params = {}, options = {}) => { if (!isValid(url)) { throw new Error("Invalid input URL"); } @@ -5065,7 +5074,7 @@ var extract = async (url, params = {}) => { if (!endpoint) { throw new Error(`No provider found with given url "${url}"`); } - const data = await fetchEmbed_default(url, params, endpoint); + const data = await fetchEmbed_default(url, params, endpoint, options); return data; }; // Annotate the CommonJS export names for ESM import in node: diff --git a/dist/cjs/package.json b/dist/cjs/package.json index 78a2b7f..9f47f0c 100644 --- a/dist/cjs/package.json +++ b/dist/cjs/package.json @@ -1,5 +1,5 @@ { "name": "oembed-parser", - "version": "3.1.0", + "version": "3.1.1", "main": "./oembed-parser.js" } \ No newline at end of file diff --git a/dist/oembed-parser.esm.js b/dist/oembed-parser.esm.js index 8bab9c6..3f0dcad 100644 --- a/dist/oembed-parser.esm.js +++ b/dist/oembed-parser.esm.js @@ -1,4 +1,4 @@ -// oembed-parser@3.1.0, by @ndaidong - built with esbuild at 2022-09-19T09:58:58.156Z - published under MIT license +// oembed-parser@3.1.1, by @ndaidong - built with esbuild at 2022-09-21T15:03:39.445Z - published under MIT license // src/utils/linker.js var isValid = (url = "") => { @@ -18,19 +18,31 @@ var getDomain = (url) => { var cross_fetch_default = fetch; // src/utils/retrieve.js -var retrieve_default = async (url) => { - const res = await cross_fetch_default(url, { - headers: { - "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" - } +var profetch = async (url, proxy = {}) => { + const { + target, + headers = {} + } = proxy; + const res = await cross_fetch_default(target + encodeURIComponent(url), { + headers }); + return res; +}; +var retrieve_default = async (url, options = {}) => { + const { + headers = { + "user-agent": "Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0" + }, + proxy = null + } = options; + const res = proxy ? await profetch(url, proxy) : await cross_fetch_default(url, { headers }); const status = res.status; if (status >= 400) { throw new Error(`Request failed with error code ${status}`); } try { const text = await res.text(); - return JSON.parse(text); + return JSON.parse(text.trim()); } catch (err) { throw new Error("Failed to convert data to JSON object"); } @@ -46,10 +58,7 @@ var getFacebookGraphToken = () => { const clientToken = env.FACEBOOK_CLIENT_TOKEN; return `${appId}|${clientToken}`; }; -var getRegularUrl = (query, basseUrl) => { - return basseUrl + "?" + query; -}; -var fetchEmbed_default = async (url, params = {}, endpoint = "") => { +var fetchEmbed_default = async (url, params = {}, endpoint = "", options = {}) => { const query = { url, format: "json", @@ -65,8 +74,8 @@ var fetchEmbed_default = async (url, params = {}, endpoint = "") => { query.access_token = getFacebookGraphToken(); } const queryParams = new URLSearchParams(query).toString(); - const link = getRegularUrl(queryParams, endpoint); - const body = retrieve_default(link); + const link = endpoint + "?" + queryParams; + const body = retrieve_default(link, options); return body; }; @@ -2154,7 +2163,7 @@ var getEndpoint = (url) => { }; // src/main.js -var extract = async (url, params = {}) => { +var extract = async (url, params = {}, options = {}) => { if (!isValid(url)) { throw new Error("Invalid input URL"); } @@ -2162,7 +2171,7 @@ var extract = async (url, params = {}) => { if (!endpoint) { throw new Error(`No provider found with given url "${url}"`); } - const data = await fetchEmbed_default(url, params, endpoint); + const data = await fetchEmbed_default(url, params, endpoint, options); return data; }; export { diff --git a/examples/browser-oembed-parser/README.md b/examples/browser-oembed-parser/README.md index 6f3e818..33a78ef 100644 --- a/examples/browser-oembed-parser/README.md +++ b/examples/browser-oembed-parser/README.md @@ -1,6 +1,8 @@ # browser-oembed-parser -Install dependencies: +This demo shows how to use oembed-parser at client side, with or without proxy. + +To install: ```bash npm i @@ -14,14 +16,18 @@ Start server: npm start ``` -Open `http://127.0.0.1:3102/` to test. - - -### Note +Open `http://127.0.0.1:3101/` to test. Basically `oembed-parser` only works at server side. However there are some noble providers those enable `Access-Control-Allow-Origin` on their service. For example with oembed links from YouTube, TED or CodeSandbox, we can parse from browser. +Another ideal environment to run `oembed-parser` directly is browser extensions. + +With the remaining cases, we need a proxy layer to bypass CORS policy. + +![oembed-parser on browser](https://res.cloudinary.com/pwshub/image/upload/v1663745151/documentation/oembed-parser-on-browser.png) + + --- diff --git a/examples/browser-oembed-parser/package.json b/examples/browser-oembed-parser/package.json index d7384c3..5a5c782 100644 --- a/examples/browser-oembed-parser/package.json +++ b/examples/browser-oembed-parser/package.json @@ -1,10 +1,12 @@ { "name": "browser-oembed-parser", "version": "1.0.0", + "type": "module", "scripts": { - "start": "http-server ./public -p 3102" + "start": "node server" }, "dependencies": { - "http-server": "^14.1.1" + "express": "^4.18.1", + "got": "^12.5.0" } } diff --git a/examples/browser-oembed-parser/public/chota.min.css b/examples/browser-oembed-parser/public/chota.min.css new file mode 100644 index 0000000..b445236 --- /dev/null +++ b/examples/browser-oembed-parser/public/chota.min.css @@ -0,0 +1 @@ +/*! chota.css v0.7.2 | MIT License | github.com/jenil/chota */:root{--bg-color:#fff;--bg-secondary-color:#f3f3f6;--color-primary:#14854f;--color-lightGrey:#d2d6dd;--color-grey:#747681;--color-darkGrey:#3f4144;--color-error:#d43939;--color-success:#28bd14;--grid-maxWidth:120rem;--grid-gutter:2rem;--font-size:1.6rem;--font-color:#333;--font-family-sans:-apple-system,BlinkMacSystemFont,Avenir,"Avenir Next","Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;--font-family-mono:monaco,"Consolas","Lucida Console",monospace}html{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:62.5%;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}*,:after,:before{-webkit-box-sizing:inherit;box-sizing:inherit}body{background-color:var(--bg-color);line-height:1.6;font-size:var(--font-size);color:var(--font-color);font-family:Segoe UI,Helvetica Neue,sans-serif;font-family:var(--font-family-sans);margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-weight:500;margin:.35em 0 .7em}h1{font-size:2em}h2{font-size:1.75em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1em}h6{font-size:.85em}a{color:var(--color-primary);text-decoration:none}a:hover:not(.button){opacity:.75}button{font-family:inherit}p{margin-top:0}blockquote{background-color:var(--bg-secondary-color);padding:1.5rem 2rem;border-left:3px solid var(--color-lightGrey)}dl dt{font-weight:700}hr{background-color:var(--color-lightGrey);height:1px;margin:1rem 0}hr,table{border:none}table{width:100%;border-collapse:collapse;border-spacing:0;text-align:left}table.striped tr:nth-of-type(2n){background-color:var(--bg-secondary-color)}td,th{vertical-align:middle;padding:1.2rem .4rem}thead{border-bottom:2px solid var(--color-lightGrey)}tfoot{border-top:2px solid var(--color-lightGrey)}code,kbd,pre,samp,tt{font-family:var(--font-family-mono)}code,kbd{font-size:90%;white-space:pre-wrap;border-radius:4px;padding:.2em .4em;color:var(--color-error)}code,kbd,pre{background-color:var(--bg-secondary-color)}pre{font-size:1em;padding:1rem;overflow-x:auto}pre code{background:none;padding:0}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}img{max-width:100%}fieldset{border:1px solid var(--color-lightGrey)}iframe{border:0}.container{max-width:var(--grid-maxWidth);margin:0 auto;width:96%;padding:0 calc(var(--grid-gutter)/2)}.row{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-ms-flex-flow:row wrap;flex-flow:row wrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;margin-left:calc(var(--grid-gutter)/-2);margin-right:calc(var(--grid-gutter)/-2)}.row,.row.reverse{-webkit-box-orient:horizontal}.row.reverse{-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.col{-webkit-box-flex:1;-ms-flex:1;flex:1}.col,[class*=" col-"],[class^=col-]{margin:0 calc(var(--grid-gutter)/2) calc(var(--grid-gutter)/2)}.col-1{-ms-flex:0 0 calc(8.33333% - var(--grid-gutter));flex:0 0 calc(8.33333% - var(--grid-gutter));max-width:calc(8.33333% - var(--grid-gutter))}.col-1,.col-2{-webkit-box-flex:0}.col-2{-ms-flex:0 0 calc(16.66667% - var(--grid-gutter));flex:0 0 calc(16.66667% - var(--grid-gutter));max-width:calc(16.66667% - var(--grid-gutter))}.col-3{-ms-flex:0 0 calc(25% - var(--grid-gutter));flex:0 0 calc(25% - var(--grid-gutter));max-width:calc(25% - var(--grid-gutter))}.col-3,.col-4{-webkit-box-flex:0}.col-4{-ms-flex:0 0 calc(33.33333% - var(--grid-gutter));flex:0 0 calc(33.33333% - var(--grid-gutter));max-width:calc(33.33333% - var(--grid-gutter))}.col-5{-ms-flex:0 0 calc(41.66667% - var(--grid-gutter));flex:0 0 calc(41.66667% - var(--grid-gutter));max-width:calc(41.66667% - var(--grid-gutter))}.col-5,.col-6{-webkit-box-flex:0}.col-6{-ms-flex:0 0 calc(50% - var(--grid-gutter));flex:0 0 calc(50% - var(--grid-gutter));max-width:calc(50% - var(--grid-gutter))}.col-7{-ms-flex:0 0 calc(58.33333% - var(--grid-gutter));flex:0 0 calc(58.33333% - var(--grid-gutter));max-width:calc(58.33333% - var(--grid-gutter))}.col-7,.col-8{-webkit-box-flex:0}.col-8{-ms-flex:0 0 calc(66.66667% - var(--grid-gutter));flex:0 0 calc(66.66667% - var(--grid-gutter));max-width:calc(66.66667% - var(--grid-gutter))}.col-9{-ms-flex:0 0 calc(75% - var(--grid-gutter));flex:0 0 calc(75% - var(--grid-gutter));max-width:calc(75% - var(--grid-gutter))}.col-9,.col-10{-webkit-box-flex:0}.col-10{-ms-flex:0 0 calc(83.33333% - var(--grid-gutter));flex:0 0 calc(83.33333% - var(--grid-gutter));max-width:calc(83.33333% - var(--grid-gutter))}.col-11{-ms-flex:0 0 calc(91.66667% - var(--grid-gutter));flex:0 0 calc(91.66667% - var(--grid-gutter));max-width:calc(91.66667% - var(--grid-gutter))}.col-11,.col-12{-webkit-box-flex:0}.col-12{-ms-flex:0 0 calc(100% - var(--grid-gutter));flex:0 0 calc(100% - var(--grid-gutter));max-width:calc(100% - var(--grid-gutter))}@media screen and (max-width:599px){.container{width:100%}.col,[class*=col-],[class^=col-]{-webkit-box-flex:0;-ms-flex:0 1 100%;flex:0 1 100%;max-width:100%}}@media screen and (min-width:900px){.col-1-md{-webkit-box-flex:0;-ms-flex:0 0 calc(8.33333% - var(--grid-gutter));flex:0 0 calc(8.33333% - var(--grid-gutter));max-width:calc(8.33333% - var(--grid-gutter))}.col-2-md{-webkit-box-flex:0;-ms-flex:0 0 calc(16.66667% - var(--grid-gutter));flex:0 0 calc(16.66667% - var(--grid-gutter));max-width:calc(16.66667% - var(--grid-gutter))}.col-3-md{-webkit-box-flex:0;-ms-flex:0 0 calc(25% - var(--grid-gutter));flex:0 0 calc(25% - var(--grid-gutter));max-width:calc(25% - var(--grid-gutter))}.col-4-md{-webkit-box-flex:0;-ms-flex:0 0 calc(33.33333% - var(--grid-gutter));flex:0 0 calc(33.33333% - var(--grid-gutter));max-width:calc(33.33333% - var(--grid-gutter))}.col-5-md{-webkit-box-flex:0;-ms-flex:0 0 calc(41.66667% - var(--grid-gutter));flex:0 0 calc(41.66667% - var(--grid-gutter));max-width:calc(41.66667% - var(--grid-gutter))}.col-6-md{-webkit-box-flex:0;-ms-flex:0 0 calc(50% - var(--grid-gutter));flex:0 0 calc(50% - var(--grid-gutter));max-width:calc(50% - var(--grid-gutter))}.col-7-md{-webkit-box-flex:0;-ms-flex:0 0 calc(58.33333% - var(--grid-gutter));flex:0 0 calc(58.33333% - var(--grid-gutter));max-width:calc(58.33333% - var(--grid-gutter))}.col-8-md{-webkit-box-flex:0;-ms-flex:0 0 calc(66.66667% - var(--grid-gutter));flex:0 0 calc(66.66667% - var(--grid-gutter));max-width:calc(66.66667% - var(--grid-gutter))}.col-9-md{-webkit-box-flex:0;-ms-flex:0 0 calc(75% - var(--grid-gutter));flex:0 0 calc(75% - var(--grid-gutter));max-width:calc(75% - var(--grid-gutter))}.col-10-md{-webkit-box-flex:0;-ms-flex:0 0 calc(83.33333% - var(--grid-gutter));flex:0 0 calc(83.33333% - var(--grid-gutter));max-width:calc(83.33333% - var(--grid-gutter))}.col-11-md{-webkit-box-flex:0;-ms-flex:0 0 calc(91.66667% - var(--grid-gutter));flex:0 0 calc(91.66667% - var(--grid-gutter));max-width:calc(91.66667% - var(--grid-gutter))}.col-12-md{-webkit-box-flex:0;-ms-flex:0 0 calc(100% - var(--grid-gutter));flex:0 0 calc(100% - var(--grid-gutter));max-width:calc(100% - var(--grid-gutter))}}@media screen and (min-width:1200px){.col-1-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(8.33333% - var(--grid-gutter));flex:0 0 calc(8.33333% - var(--grid-gutter));max-width:calc(8.33333% - var(--grid-gutter))}.col-2-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(16.66667% - var(--grid-gutter));flex:0 0 calc(16.66667% - var(--grid-gutter));max-width:calc(16.66667% - var(--grid-gutter))}.col-3-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(25% - var(--grid-gutter));flex:0 0 calc(25% - var(--grid-gutter));max-width:calc(25% - var(--grid-gutter))}.col-4-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(33.33333% - var(--grid-gutter));flex:0 0 calc(33.33333% - var(--grid-gutter));max-width:calc(33.33333% - var(--grid-gutter))}.col-5-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(41.66667% - var(--grid-gutter));flex:0 0 calc(41.66667% - var(--grid-gutter));max-width:calc(41.66667% - var(--grid-gutter))}.col-6-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(50% - var(--grid-gutter));flex:0 0 calc(50% - var(--grid-gutter));max-width:calc(50% - var(--grid-gutter))}.col-7-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(58.33333% - var(--grid-gutter));flex:0 0 calc(58.33333% - var(--grid-gutter));max-width:calc(58.33333% - var(--grid-gutter))}.col-8-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(66.66667% - var(--grid-gutter));flex:0 0 calc(66.66667% - var(--grid-gutter));max-width:calc(66.66667% - var(--grid-gutter))}.col-9-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(75% - var(--grid-gutter));flex:0 0 calc(75% - var(--grid-gutter));max-width:calc(75% - var(--grid-gutter))}.col-10-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(83.33333% - var(--grid-gutter));flex:0 0 calc(83.33333% - var(--grid-gutter));max-width:calc(83.33333% - var(--grid-gutter))}.col-11-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(91.66667% - var(--grid-gutter));flex:0 0 calc(91.66667% - var(--grid-gutter));max-width:calc(91.66667% - var(--grid-gutter))}.col-12-lg{-webkit-box-flex:0;-ms-flex:0 0 calc(100% - var(--grid-gutter));flex:0 0 calc(100% - var(--grid-gutter));max-width:calc(100% - var(--grid-gutter))}}fieldset{padding:.5rem 2rem}legend{text-transform:uppercase;font-size:.8em;letter-spacing:.1rem}input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]):not([type=button]):not([type=reset]),select,textarea,textarea[type=text]{font-family:inherit;padding:.8rem 1rem;border-radius:4px;border:1px solid var(--color-lightGrey);font-size:1em;-webkit-transition:all .2s ease;transition:all .2s ease;display:block;width:100%}input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]):not([type=button]):not([type=reset]):not(:disabled):hover,select:hover,textarea:hover,textarea[type=text]:hover{border-color:var(--color-grey)}input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]):not([type=button]):not([type=reset]):focus,select:focus,textarea:focus,textarea[type=text]:focus{outline:none;border-color:var(--color-primary);-webkit-box-shadow:0 0 1px var(--color-primary);box-shadow:0 0 1px var(--color-primary)}input.error:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]):not([type=button]):not([type=reset]),textarea.error{border-color:var(--color-error)}input.success:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=color]):not([type=button]):not([type=reset]),textarea.success{border-color:var(--color-success)}select{-webkit-appearance:none;background:#f3f3f6 no-repeat 100%;background-size:1ex;background-origin:content-box;background-image:url("data:image/svg+xml;utf8,")}[type=checkbox],[type=radio]{width:1.6rem;height:1.6rem}.button,[type=button],[type=reset],[type=submit],button{padding:1rem 2.5rem;color:var(--color-darkGrey);background:var(--color-lightGrey);border-radius:4px;border:1px solid transparent;font-size:var(--font-size);line-height:1;text-align:center;-webkit-transition:opacity .2s ease;transition:opacity .2s ease;text-decoration:none;-webkit-transform:scale(1);transform:scale(1);display:inline-block;cursor:pointer}.grouped{display:-webkit-box;display:-ms-flexbox;display:flex}.grouped>:not(:last-child){margin-right:16px}.grouped.gapless>*{margin:0 0 0 -1px!important;border-radius:0!important}.grouped.gapless>:first-child{margin:0!important;border-radius:4px 0 0 4px!important}.grouped.gapless>:last-child{border-radius:0 4px 4px 0!important}.button+.button{margin-left:1rem}.button:hover,[type=button]:hover,[type=reset]:hover,[type=submit]:hover,button:hover{opacity:.8}.button:active,[type=button]:active,[type=reset]:active,[type=submit]:active,button:active{-webkit-transform:scale(.98);transform:scale(.98)}button:disabled,button:disabled:hover,input:disabled,input:disabled:hover{opacity:.4;cursor:not-allowed}.button.dark,.button.error,.button.primary,.button.secondary,.button.success,[type=submit]{color:#fff;z-index:1;background-color:#000;background-color:var(--color-primary)}.button.secondary{background-color:var(--color-grey)}.button.dark{background-color:var(--color-darkGrey)}.button.error{background-color:var(--color-error)}.button.success{background-color:var(--color-success)}.button.outline{background-color:transparent;border-color:var(--color-lightGrey)}.button.outline.primary{border-color:var(--color-primary);color:var(--color-primary)}.button.outline.secondary{border-color:var(--color-grey);color:var(--color-grey)}.button.outline.dark{border-color:var(--color-darkGrey);color:var(--color-darkGrey)}.button.clear{background-color:transparent;border-color:transparent;color:var(--color-primary)}.button.icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.button.icon>img{margin-left:2px}.button.icon-only{padding:1rem}::-webkit-input-placeholder{color:#bdbfc4}::-moz-placeholder{color:#bdbfc4}:-ms-input-placeholder{color:#bdbfc4}::-ms-input-placeholder{color:#bdbfc4}::placeholder{color:#bdbfc4}.nav{display:-webkit-box;display:-ms-flexbox;display:flex;min-height:5rem;-webkit-box-align:stretch;-ms-flex-align:stretch;align-items:stretch}.nav img{max-height:3rem}.nav-center,.nav-left,.nav-right,.nav>.container{display:-webkit-box;display:-ms-flexbox;display:flex}.nav-center,.nav-left,.nav-right{-webkit-box-flex:1;-ms-flex:1;flex:1}.nav-left{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.nav-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.nav-center{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}@media screen and (max-width:480px){.nav,.nav>.container{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.nav-center,.nav-left,.nav-right{-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}}.nav .brand,.nav a{text-decoration:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1rem 2rem;color:var(--color-darkGrey)}.nav .active:not(.button){color:#000;color:var(--color-primary)}.nav .brand{font-size:1.75em;padding-top:0;padding-bottom:0}.nav .brand img{padding-right:1rem}.nav .button{margin:auto 1rem}.card{padding:1rem 2rem;border-radius:4px;background:var(--bg-color);-webkit-box-shadow:0 1px 3px var(--color-grey);box-shadow:0 1px 3px var(--color-grey)}.card p:last-child{margin:0}.card header>*{margin-top:0;margin-bottom:1rem}.tabs{display:-webkit-box;display:-ms-flexbox;display:flex}.tabs a{text-decoration:none}.tabs>.dropdown>summary,.tabs>a{padding:1rem 2rem;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;color:var(--color-darkGrey);border-bottom:2px solid var(--color-lightGrey);text-align:center}.tabs>a.active,.tabs>a:hover{opacity:1;border-bottom:2px solid var(--color-darkGrey)}.tabs>a.active{border-color:var(--color-primary)}.tabs.is-full a{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto}.tag{display:inline-block;border:1px solid var(--color-lightGrey);text-transform:uppercase;color:var(--color-grey);padding:.5rem;line-height:1;letter-spacing:.5px}.tag.is-small{padding:.4rem;font-size:.75em}.tag.is-large{padding:.7rem;font-size:1.125em}.tag+.tag{margin-left:1rem}details.dropdown{position:relative;display:inline-block}details.dropdown>:last-child{position:absolute;left:0;white-space:nowrap}.bg-primary{background-color:var(--color-primary)!important}.bg-light{background-color:var(--color-lightGrey)!important}.bg-dark{background-color:var(--color-darkGrey)!important}.bg-grey{background-color:var(--color-grey)!important}.bg-error{background-color:var(--color-error)!important}.bg-success{background-color:var(--color-success)!important}.bd-primary{border:1px solid var(--color-primary)!important}.bd-light{border:1px solid var(--color-lightGrey)!important}.bd-dark{border:1px solid var(--color-darkGrey)!important}.bd-grey{border:1px solid var(--color-grey)!important}.bd-error{border:1px solid var(--color-error)!important}.bd-success{border:1px solid var(--color-success)!important}.text-primary{color:var(--color-primary)!important}.text-light{color:var(--color-lightGrey)!important}.text-dark{color:var(--color-darkGrey)!important}.text-grey{color:var(--color-grey)!important}.text-error{color:var(--color-error)!important}.text-success{color:var(--color-success)!important}.text-white{color:#fff!important}.pull-right{float:right!important}.pull-left{float:left!important}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.text-justify{text-align:justify}.text-uppercase{text-transform:uppercase}.text-lowercase{text-transform:lowercase}.text-capitalize{text-transform:capitalize}.is-full-screen{width:100%;min-height:100vh}.is-full-width{width:100%!important}.is-vertical-align{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.is-center,.is-horizontal-align{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.is-center{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.is-right{-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end}.is-left,.is-right{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.is-left{-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start}.is-fixed{position:fixed;width:100%}.is-paddingless{padding:0!important}.is-marginless{margin:0!important}.is-pointer{cursor:pointer!important}.is-rounded{border-radius:100%}.clearfix{content:"";display:table;clear:both}.is-hidden{display:none!important}@media screen and (max-width:599px){.hide-xs{display:none!important}}@media screen and (min-width:600px) and (max-width:899px){.hide-sm{display:none!important}}@media screen and (min-width:900px) and (max-width:1199px){.hide-md{display:none!important}}@media screen and (min-width:1200px){.hide-lg{display:none!important}}@media print{.hide-pr{display:none!important}} \ No newline at end of file diff --git a/examples/browser-oembed-parser/public/index.html b/examples/browser-oembed-parser/public/index.html index ddd2839..a533372 100644 --- a/examples/browser-oembed-parser/public/index.html +++ b/examples/browser-oembed-parser/public/index.html @@ -2,7 +2,7 @@ Example oembed-parser - +