Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@awinogrodzki/embed-plugin-youtube

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awinogrodzki/embed-plugin-youtube - npm Package Compare versions

Comparing version 5.0.7 to 5.0.8

2

package.json
{
"name": "@awinogrodzki/embed-plugin-youtube",
"version": "5.0.7",
"version": "5.0.8",
"description": "An embed-js plugin to embed youtube videos.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -360,3 +360,3 @@ (function (global, factory) {

var withoutDetailsTemplate = function (embedUrl, height, name) {
return ("<iframe class=\"ejs-embed ejs-" + name + "\" src=\"" + embedUrl + "\" frameBorder=\"0\" height=\"" + height + "\"></iframe>");
return ("<iframe sandbox=\"allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation\" class=\"ejs-embed ejs-" + name + "\" src=\"" + embedUrl + "\" frameBorder=\"0\" height=\"" + height + "\"></iframe>");
};

@@ -363,0 +363,0 @@

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.embedPluginYoutube=n()}(this,function(){"use strict";function e(){var n=[].slice.call(arguments),t=!1;"boolean"==typeof n[0]&&(t=n.shift());var r=n[0];if(!r||"object"!=typeof r&&"function"!=typeof r)throw new Error("extendee must be an object");for(var u=n.slice(1),o=u.length,i=0;i<o;i++){var c=u[i];for(var a in c)if(c.hasOwnProperty(a)){var s=c[a];if(t&&function(e){return Array.isArray(e)||"[object Object]"=={}.toString.call(e)}(s)){var f=Array.isArray(s)?[]:{};r[a]=e(!0,r.hasOwnProperty(a)?r[a]:f,s)}else r[a]=s}}return r}function n(e,n){var t=e.map(function(e){return function(e,n){var t=e.concat([e.index,e.input]);return n.apply(null,t).then(function(n){return f({},e,{replacement:n})})}(e,n)});return Promise.all(t)}function t(e,t,r){t.lastIndex=0;try{return Promise.resolve(function(e,t,r){return n(function(e,n){for(var t=[],r=n.exec(e);r&&(t.push(r),n.global);)r=n.exec(e);return t}(e,t),r).then(function(n){return function(e,t){return n.reverse().reduce(function(e,n){var t=e.slice(0,n.index),r=e.slice(n.index+n[0].length);return t+n.replacement+r},e)}(e)})}(e,t,r))}catch(e){return Promise.reject(e)}}function r(e,n,t){return void 0===t&&(t=!1),t?e.test(n):n.match(e)}function u(e,n){var t=e.result,r=e.plugins;void 0===r&&(r=[]);return function(e){return new RegExp("<a[^>]*>("+e.source+")<\\/a>","gi")}(n.regex).test(t)||r.filter(function(e){return"url"===e.id}).length}function o(e,n,t){var r=e._services,u=n.id;r.filter(function(e){return e.match===t}).length||r.push({id:u,match:t})}function i(e,n,r,u){return new Promise(function(i,a){var s,f;return f=r,s=f.regex,t(e,s,function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new Promise(function(t,i){return c(e,n,r).then(function(c){try{return n._embeds.push({content:c,index:u||e.find(function(e){return"number"==typeof e})}),o(n,r,e[0]),t()}catch(e){return i(e)}},i)})}).then(function(e){try{return i(n)}catch(e){return a(e)}},a)})}function c(e,n,t){var r=this;return new Promise(function(u,o){function i(){return u(a(e,n,t,s))}var c,a,s,f;return f=t,c=f._process,a=f.template,c?c(e,n,t).then(function(e){try{return s=e,i.call(r)}catch(e){return o(e)}},o):i.call(r)})}function a(e,n,t){var r=n.fetch,u=t.gAuthKey;return t.details?function(e,n,t){return new Promise(function(r,u){var o,i,c=function(e){try{return console.log(e),r({})}catch(e){return u(e)}};try{return n("https://www.googleapis.com/youtube/v3/videos?id="+e+"&key="+t+"&part=snippet,statistics").then(function(e){try{return(o=e).json().then(function(e){try{return i=e,r(i.items[0])}catch(e){return c(e)}},c)}catch(e){return c(e)}},c)}catch(e){c(e)}})}(e[1],r,u):Promise.resolve()}function s(e){var n={id:w,regex:h(),gAuthKey:"",details:!0,height:300,clickClass:"ejs-video-thumb",onVideoShow:function(){},_onLoadInternal:function(e,n){!function(e,n){var t=e.input,r=n.clickClass,u=n.onVideoShow,o=n.height;if(!l(t))throw new Error("input should be a DOM Element.");for(var i=document.getElementsByClassName(r),c=0;c<i.length;c++)i[c].onclick=function(){var e=this.getAttribute("data-url");u(e),e+="?autoplay=1",this.parentNode.innerHTML=y(e,o,w)}}(e,n)},onLoad:function(){},template:function(e,n,t,r){var u=t.details,o=t.height,i=t.clickClass;return new Promise(function(n,t){var c=b+"embed/"+e[1];return n(u?p(function(e){var n=e.snippet,t=e.id;return{title:n.title,thumbnail:n.thumbnails.medium.url,description:n.description,url:b+"watch?v="+t,embedUrl:b+"embed/"+t}}(r),i,!0):y(c,o,w))})}};if(!e.gAuthKey)throw new Error("You need to pass google auth key.");var t=f({},n,e,{_process:a});return g(t)}var f=e,l=function(e){return!(!e||"object"!=typeof e)&&("object"==typeof window&&"object"==typeof window.Node?e instanceof window.Node:"number"==typeof e.nodeType&&"string"==typeof e.nodeName)},h=function(){return/(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\/?\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/g},d=/<a[^>]*>([^<]+)<\/a>/gi,m=function(e,n){return new Promise(function(a,s){var l,h,m,v,p;l=e.inlineEmbed;var y;return y=n,h=y._ignoreAnchorCheck,m=y._ignoreInlineCheck,v=y.regex,l||m?new Promise(function(i,a){return u(e,{regex:v})&&!h?function(e,n){return new Promise(function(u,i){var a=e.result,s=e.replaceUrl,f=n.regex,l=n._replaceAnyways;return u(t(a,d,function(u,i){return new Promise(function(a,h){var d,m;return r(f,i,!0)?s||l?a(t(i,f,function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return new Promise(function(r,u){return o(e,n,t[0]),r(c(t,e,n))})})):(d=function(e,n){e.lastIndex=0;var t=e.exec(n);return e.lastIndex=0,t}(f,i),o(e,n,d[0]),c(d,e,n).then(function(e){try{return m=e,a(d?u+m:u)}catch(e){return h(e)}},h)):a(u)})}))})}(e,n).then(i,a):function(e,n){return new Promise(function(r,u){var i=e.result,a=e.replaceUrl,s=n.regex,f=n._replaceAnyways;return r(t(i,s,function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return new Promise(function(r,u){return o(e,n,t[0]),new Promise(function(r,u){return a||f?r(c(t,e,n)):c(t,e,n).then(function(e){try{return r(t[0]+" "+e)}catch(e){return u(e)}},u)}).then(r,u)})}))})}(e,n).then(i,a)}).then(function(n){try{return p=n,a(f({},e,{result:p}))}catch(e){return s(e)}},s):a(function(e,n){var c=this;return new Promise(function(a,s){function l(){return a(m)}var h,m,v;return v=n,h=v.regex,m=f({},e),u(m,{regex:h})?t(m.result,d,function(e,t,u){return new Promise(function(c,a){return r(h,e,!0)?(o(m,n,e),i(t,m,n,u).then(function(n){try{return m=n,c(e)}catch(e){return a(e)}},a)):c(e)})}).then(function(e){try{return l.call(c)}catch(e){return s(e)}},s):(m=i(m.result,m,n),l.call(c))})}(e,n))})},v=function(e,n,t){return null==n||n>=e.length?e:(null==t&&(t="..."),e.slice(0,Math.max(0,n-t.length))+t)},p=function(e,n,t){var r=e.url,u=e.title,o=e.embedUrl,i=e.description,c=e.thumbnail;return void 0===t&&(t=!1),'<div class="ejs-preview ejs-embed"><div class="ejs-thumb '+n+'" data-url="'+o+'" style="background-image:url('+c+')">'+(t?"<span>&#9658;</span>":"")+'</div><div class="ejs-info"><h4 class="ejs-title"><a href="'+r+'">'+u+'</a></h4><div class="ejs-desc">'+v(i,150)+"</div></div></div>"},y=function(e,n,t){return'<iframe class="ejs-embed ejs-'+t+'" src="'+e+'" frameBorder="0" height="'+n+'"></iframe>'},g=function(e){var n=f({},{_replaceAnyways:!1,_ignoreAnchorCheck:!1,_ignoreInlineCheck:!1,onLoad:function(){}},e),t=n._onLoadInternal,r=n.onLoad,u=n.regex,o=n.template,i=n.id;if(!u)throw new Error("regex not passed.");if(!o)throw new Error("template not passed.");return{id:i,transform:function(e){return new Promise(function(t,r){return m(e,n).then(function(n){try{return t(f({},e,n))}catch(e){return r(e)}},r)})},onLoad:function(e){t&&t(e,n),r&&r(e,n)}}},w="youtube",b="https://www.youtube.com/";return s.id=w,s});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.embedPluginYoutube=n()}(this,function(){"use strict";function e(){var n=[].slice.call(arguments),t=!1;"boolean"==typeof n[0]&&(t=n.shift());var r=n[0];if(!r||"object"!=typeof r&&"function"!=typeof r)throw new Error("extendee must be an object");for(var o=n.slice(1),u=o.length,i=0;i<u;i++){var c=o[i];for(var a in c)if(c.hasOwnProperty(a)){var s=c[a];if(t&&function(e){return Array.isArray(e)||"[object Object]"=={}.toString.call(e)}(s)){var l=Array.isArray(s)?[]:{};r[a]=e(!0,r.hasOwnProperty(a)?r[a]:l,s)}else r[a]=s}}return r}function n(e,n){var t=e.map(function(e){return function(e,n){var t=e.concat([e.index,e.input]);return n.apply(null,t).then(function(n){return l({},e,{replacement:n})})}(e,n)});return Promise.all(t)}function t(e,t,r){t.lastIndex=0;try{return Promise.resolve(function(e,t,r){return n(function(e,n){for(var t=[],r=n.exec(e);r&&(t.push(r),n.global);)r=n.exec(e);return t}(e,t),r).then(function(n){return function(e,t){return n.reverse().reduce(function(e,n){var t=e.slice(0,n.index),r=e.slice(n.index+n[0].length);return t+n.replacement+r},e)}(e)})}(e,t,r))}catch(e){return Promise.reject(e)}}function r(e,n,t){return void 0===t&&(t=!1),t?e.test(n):n.match(e)}function o(e,n){var t=e.result,r=e.plugins;void 0===r&&(r=[]);return function(e){return new RegExp("<a[^>]*>("+e.source+")<\\/a>","gi")}(n.regex).test(t)||r.filter(function(e){return"url"===e.id}).length}function u(e,n,t){var r=e._services,o=n.id;r.filter(function(e){return e.match===t}).length||r.push({id:o,match:t})}function i(e,n,r,o){return new Promise(function(i,a){var s,l;return l=r,s=l.regex,t(e,s,function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return new Promise(function(t,i){return c(e,n,r).then(function(c){try{return n._embeds.push({content:c,index:o||e.find(function(e){return"number"==typeof e})}),u(n,r,e[0]),t()}catch(e){return i(e)}},i)})}).then(function(e){try{return i(n)}catch(e){return a(e)}},a)})}function c(e,n,t){var r=this;return new Promise(function(o,u){function i(){return o(a(e,n,t,s))}var c,a,s,l;return l=t,c=l._process,a=l.template,c?c(e,n,t).then(function(e){try{return s=e,i.call(r)}catch(e){return u(e)}},u):i.call(r)})}function a(e,n,t){var r=n.fetch,o=t.gAuthKey;return t.details?function(e,n,t){return new Promise(function(r,o){var u,i,c=function(e){try{return console.log(e),r({})}catch(e){return o(e)}};try{return n("https://www.googleapis.com/youtube/v3/videos?id="+e+"&key="+t+"&part=snippet,statistics").then(function(e){try{return(u=e).json().then(function(e){try{return i=e,r(i.items[0])}catch(e){return c(e)}},c)}catch(e){return c(e)}},c)}catch(e){c(e)}})}(e[1],r,o):Promise.resolve()}function s(e){var n={id:g,regex:h(),gAuthKey:"",details:!0,height:300,clickClass:"ejs-video-thumb",onVideoShow:function(){},_onLoadInternal:function(e,n){!function(e,n){var t=e.input,r=n.clickClass,o=n.onVideoShow,u=n.height;if(!f(t))throw new Error("input should be a DOM Element.");for(var i=document.getElementsByClassName(r),c=0;c<i.length;c++)i[c].onclick=function(){var e=this.getAttribute("data-url");o(e),e+="?autoplay=1",this.parentNode.innerHTML=w(e,u,g)}}(e,n)},onLoad:function(){},template:function(e,n,t,r){var o=t.details,u=t.height,i=t.clickClass;return new Promise(function(n,t){var c=b+"embed/"+e[1];return n(o?v(function(e){var n=e.snippet,t=e.id;return{title:n.title,thumbnail:n.thumbnails.medium.url,description:n.description,url:b+"watch?v="+t,embedUrl:b+"embed/"+t}}(r),i,!0):w(c,u,g))})}};if(!e.gAuthKey)throw new Error("You need to pass google auth key.");var t=l({},n,e,{_process:a});return y(t)}var l=e,f=function(e){return!(!e||"object"!=typeof e)&&("object"==typeof window&&"object"==typeof window.Node?e instanceof window.Node:"number"==typeof e.nodeType&&"string"==typeof e.nodeName)},h=function(){return/(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\/?\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})/g},d=/<a[^>]*>([^<]+)<\/a>/gi,m=function(e,n){return new Promise(function(a,s){var f,h,m,p,v;f=e.inlineEmbed;var w;return w=n,h=w._ignoreAnchorCheck,m=w._ignoreInlineCheck,p=w.regex,f||m?new Promise(function(i,a){return o(e,{regex:p})&&!h?function(e,n){return new Promise(function(o,i){var a=e.result,s=e.replaceUrl,l=n.regex,f=n._replaceAnyways;return o(t(a,d,function(o,i){return new Promise(function(a,h){var d,m;return r(l,i,!0)?s||f?a(t(i,l,function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return new Promise(function(r,o){return u(e,n,t[0]),r(c(t,e,n))})})):(d=function(e,n){e.lastIndex=0;var t=e.exec(n);return e.lastIndex=0,t}(l,i),u(e,n,d[0]),c(d,e,n).then(function(e){try{return m=e,a(d?o+m:o)}catch(e){return h(e)}},h)):a(o)})}))})}(e,n).then(i,a):function(e,n){return new Promise(function(r,o){var i=e.result,a=e.replaceUrl,s=n.regex,l=n._replaceAnyways;return r(t(i,s,function(){for(var t=[],r=arguments.length;r--;)t[r]=arguments[r];return new Promise(function(r,o){return u(e,n,t[0]),new Promise(function(r,o){return a||l?r(c(t,e,n)):c(t,e,n).then(function(e){try{return r(t[0]+" "+e)}catch(e){return o(e)}},o)}).then(r,o)})}))})}(e,n).then(i,a)}).then(function(n){try{return v=n,a(l({},e,{result:v}))}catch(e){return s(e)}},s):a(function(e,n){var c=this;return new Promise(function(a,s){function f(){return a(m)}var h,m,p;return p=n,h=p.regex,m=l({},e),o(m,{regex:h})?t(m.result,d,function(e,t,o){return new Promise(function(c,a){return r(h,e,!0)?(u(m,n,e),i(t,m,n,o).then(function(n){try{return m=n,c(e)}catch(e){return a(e)}},a)):c(e)})}).then(function(e){try{return f.call(c)}catch(e){return s(e)}},s):(m=i(m.result,m,n),f.call(c))})}(e,n))})},p=function(e,n,t){return null==n||n>=e.length?e:(null==t&&(t="..."),e.slice(0,Math.max(0,n-t.length))+t)},v=function(e,n,t){var r=e.url,o=e.title,u=e.embedUrl,i=e.description,c=e.thumbnail;return void 0===t&&(t=!1),'<div class="ejs-preview ejs-embed"><div class="ejs-thumb '+n+'" data-url="'+u+'" style="background-image:url('+c+')">'+(t?"<span>&#9658;</span>":"")+'</div><div class="ejs-info"><h4 class="ejs-title"><a href="'+r+'">'+o+'</a></h4><div class="ejs-desc">'+p(i,150)+"</div></div></div>"},w=function(e,n,t){return'<iframe sandbox="allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation" class="ejs-embed ejs-'+t+'" src="'+e+'" frameBorder="0" height="'+n+'"></iframe>'},y=function(e){var n=l({},{_replaceAnyways:!1,_ignoreAnchorCheck:!1,_ignoreInlineCheck:!1,onLoad:function(){}},e),t=n._onLoadInternal,r=n.onLoad,o=n.regex,u=n.template,i=n.id;if(!o)throw new Error("regex not passed.");if(!u)throw new Error("template not passed.");return{id:i,transform:function(e){return new Promise(function(t,r){return m(e,n).then(function(n){try{return t(l({},e,n))}catch(e){return r(e)}},r)})},onLoad:function(e){t&&t(e,n),r&&r(e,n)}}},g="youtube",b="https://www.youtube.com/";return s.id=g,s});
//# sourceMappingURL=embed-plugin-youtube.min.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc