From 895184a62e15d1d3aec76f76eefa026f52285ccd Mon Sep 17 00:00:00 2001 From: Jon Uhlmann Date: Tue, 22 Mar 2022 19:02:34 +0100 Subject: [PATCH] Update: Store GDPR confirm in localstorage --- Resources/Private/Assets/Helper/iFrame.js | 13 +++++++++---- Resources/Public/Scripts/Main.js | 2 +- Resources/Public/Scripts/Main.js.map | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Resources/Private/Assets/Helper/iFrame.js b/Resources/Private/Assets/Helper/iFrame.js index 1e6b819..0c18349 100644 --- a/Resources/Private/Assets/Helper/iFrame.js +++ b/Resources/Private/Assets/Helper/iFrame.js @@ -60,7 +60,7 @@ function getPaddingTop(node, fallback = '56.25%') { } function write(link, playClass, type) { - if (checkGdpr(link)) { + if (checkGdpr(link, type)) { const IFRAME = markup(link); const IMAGE = getImage(link); if (!IFRAME) { @@ -83,14 +83,19 @@ function write(link, playClass, type) { } } -function checkGdpr(element) { +function checkGdpr(element, type) { const GDPR = element.dataset.gdpr; if (!GDPR) { return true; } - if (GDPR && confirm(GDPR)) { + + const LOCAL_STORAGE = window.localStorage; + const STORAGE_KEY = `jonnittoprettyembed_gdpr_${type}`; + + if (LOCAL_STORAGE[STORAGE_KEY] === 'true' || confirm(GDPR)) { element.removeAttribute('data-gdpr'); + LOCAL_STORAGE[STORAGE_KEY] = 'true'; return true; } return false; @@ -113,7 +118,7 @@ function lightbox(type) { const HTML = markup(this); if (HTML) { event.preventDefault(); - if (checkGdpr(this)) { + if (checkGdpr(this, type)) { const PADDING_TOP = getPaddingTop(this); lightboxHelper.get([type, 'iframe'], PADDING_TOP).innerHTML = HTML; lightboxHelper.show(() => { diff --git a/Resources/Public/Scripts/Main.js b/Resources/Public/Scripts/Main.js index babdef6..b6a380e 100644 --- a/Resources/Public/Scripts/Main.js +++ b/Resources/Public/Scripts/Main.js @@ -4,5 +4,5 @@ * Copyright 2019-2022 Jon Uhlmann * Licensed under GPL-3.0-or-later */ -!function(){"use strict";var t="jonnitto-prettyembed",e="".concat(t,"--init"),n="".concat(t,"--slim"),o="".concat(t,"--play"),a=Array.from(document.querySelectorAll(".".concat(t,"--video video:not([autoplay])"))),c=Array.from(document.querySelectorAll(".".concat(t,"--audio audio:not([autoplay])"))),i=[].concat(a,c);function r(t){var a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=arguments.length>2?arguments[2]:void 0,i=t.parentNode.classList;if(!i.contains(e))if("function"==typeof c&&c(),t.hasAttribute("data-controls")&&t.setAttribute("controls",!0),t.hasAttribute("controls")||(i.add(n),t.addEventListener("click",(function(){var e=!i.contains(o);i[e?"add":"remove"](o),e?t.play():t.pause()}))),t.hasAttribute("data-streaming")){var r=t.getAttribute("data-streaming");if(t.canPlayType("application/vnd.apple.mpegurl"))t.src=r,u(t,a,i);else if("undefined"==typeof Hls){var l=document.createElement("script");l.src="/_Resources/Static/Packages/Jonnitto.PrettyEmbedHelper/Scripts/Hls.js?v=1",document.head.appendChild(l),l.addEventListener("load",(function(){setTimeout((function(){d(t,r),u(t,a,i)}),100)}))}else d(t,r),u(t,a,i)}else u(t,a,i)}function u(t,n,a){a.add(e),n&&(a.add(o),setTimeout((function(){t.play()}),0))}function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.forEach((function(t){t!=e&&(t.hasAttribute("controls")||t.parentNode.classList.remove(o),t.pause())}))}function d(t,e){if(Hls.isSupported()){var n=new Hls;n.loadSource(e),n.attachMedia(t)}}function s(t){var e;t||(t={}),window.CustomEvent?e=new CustomEvent("prettyembed",{detail:t}):(e=document.createEvent("CustomEvent")).initCustomEvent("prettyembed",!0,!0,t),document.dispatchEvent(e)}i.forEach((function(t){t.addEventListener("play",(function(t){l(i,t.target)}))}));var f=document.querySelectorAll(".jonnitto-prettyembed--audio audio");function p(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector).call(t,e)}function m(t,e){document.documentElement.addEventListener("click",(function(n){var o=function(t,e){var n=t;do{if(p(n,e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}(n.target,t);o&&"function"==typeof e&&e.call(o,n)}))}function v(t){return t.getAttribute("aria-label")}Array.from(f).forEach((function(t){var e;r(t,!1),s({type:"audio",style:"inline",src:(e=t.querySelector("source"),e?e.src:null)})}));function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}m(".jonnitto-prettyembed--video.jonnitto-prettyembed--inline video",(function(t){var e=this;t.preventDefault(),r(this,!0,(function(){var t;s({type:"video",style:"inline",title:v(e),src:(t=e.querySelector("source"),t?t.src:null)})}))}));var h=document.documentElement,b=document.body,g="jonnitto-prettyembed",E="".concat(g,"__lightbox"),S=E,A="-".concat(E),T=h.classList,L="".concat(g,"__inner"),w="".concat(g,"__close"),H="".concat(g,"__content"),_=document.createElement("div");_.className=E,_.innerHTML='\n
\n \n
\n
');var j=!1,q=null;function C(){j.className="".concat(g," ").concat(H),j.removeAttribute("style"),j.innerHTML=""}function M(t,e){return j||(b.appendChild(_),j=document.getElementById(S)),C(),"object"!=y(t)&&(t=t?[t]:[]),t.forEach((function(t){j.classList.add("".concat(g,"--").concat(t))})),e&&(j.style.paddingTop=e),j}function N(t){clearTimeout(q),q=setTimeout((function(){"function"==typeof t&&t(),T.add(A)}),100)}function x(){T.remove(A),j&&(clearTimeout(q),q=setTimeout(C,300))}function k(t,e){"function"==typeof e&&"string"==typeof t&&m(t,e)}m(".".concat(H),(function(t){t.stopImmediatePropagation()})),m(".".concat(E),x),m(".".concat(w),x),h.addEventListener("keyup",(function(t){27==t.keyCode&&T.contains(A)&&x()}));var D,I="jonnitto-prettyembed";k(".".concat(I,"--video.").concat(I,"--lightbox video"),(function(t){var e=this;t.preventDefault(),clearTimeout(D),l();var n=M("video",!1).appendChild(this.cloneNode(!0));null==this.dataset.controls&&Array.from(this.parentNode.children).forEach((function(t){t==e||t.classList.contains("".concat(I,"__preview"))||n.parentNode.appendChild(t.cloneNode(!0))})),N((function(){var t;r(n),e.dataset.init||(e.dataset.init=!0,s({type:"video",style:"lightbox",title:v(e),src:(t=e.querySelector("source"),t?t.src:null)}))})),D=setTimeout((function(){n.play()}),500)}));var P="jonnitto-prettyembed";function R(t){var e=t.dataset,n=null!=e.fs;return!!e.embed&&'')}function W(t){var e=t.querySelector("img");return{node:e||null,src:e?e.getAttribute("src"):null}}function z(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"56.25%";if(t.dataset.ratio)return t.dataset.ratio;var n=W(t);if(!n.node)return e;var o=parseInt(n.node.naturalHeight)/parseInt(n.node.naturalWidth)*100;return"number"!=typeof o?e:o+"%"}function B(t,e,n){if(J(t)){var o=R(t),a=W(t);if(!o)return;var c=function(t,e){if("object"===y(t)&&"string"==typeof e){var n=t,o=n.tagName,a=new RegExp("^<"+o,"i"),c=new RegExp(o+">$","i"),i="<"+e,r=e+">",u=document.createElement("div");u.innerHTML=n.outerHTML.replace(a,i).replace(c,r);var l=u.firstChild;return t.parentNode.replaceChild(l,t),l}}(t,"div");c.classList.add(e),c.style.paddingTop=z(t),c.innerHTML=o,a.src&&c.setAttribute("data-img",a.src),s({type:n,style:"inline",title:v(t),src:t.dataset.embed})}}function J(t){var e=t.dataset.gdpr;return!e||!(!e||!confirm(e))&&(t.removeAttribute("data-gdpr"),!0)}function O(t){k("a.".concat(P,"--").concat(t,".").concat(P,"--lightbox"),(function(e){var n=this,o=R(this);if(o&&(e.preventDefault(),J(this))){var a=z(this);M([t,"iframe"],a).innerHTML=o,N((function(){n.dataset.init||(n.dataset.init=!0,s({type:t,style:"lightbox",title:v(n),src:n.dataset.embed}))}))}}))}function $(t){var e="a.".concat(P,"--").concat(t,".").concat(P,"--inline"),n="".concat(P,"--play");m(e,(function(e){e.preventDefault(),B(this,n,t)}))}function F(t){var e=t.getAttribute("src");t.naturalHeight<=90&&t.naturalWidth<=120&&-1==e.indexOf("/default.jpg")&&(e=e.replace("mqdefault","default").replace("hqdefault","mqdefault").replace("sddefault","hqdefault").replace("maxresdefault","sddefault"),t.setAttribute("src",e),setTimeout((function(){t.onload=function(){F(t)}}),10),setTimeout((function(){F(t)}),5e3))}$("vimeo"),O("vimeo"),$("youtube"),O("youtube"),window.addEventListener("load",(function(){!function(t){void 0===t&&(t=document.querySelectorAll("img.jonnitto-prettyembed__youtube-preview"));for(var e=t.length-1;e>=0;e--)F(t[e])}()}))}(); +!function(){"use strict";var t="jonnitto-prettyembed",e="".concat(t,"--init"),n="".concat(t,"--slim"),o="".concat(t,"--play"),a=Array.from(document.querySelectorAll(".".concat(t,"--video video:not([autoplay])"))),c=Array.from(document.querySelectorAll(".".concat(t,"--audio audio:not([autoplay])"))),i=[].concat(a,c);function r(t){var a=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],c=arguments.length>2?arguments[2]:void 0,i=t.parentNode.classList;if(!i.contains(e))if("function"==typeof c&&c(),t.hasAttribute("data-controls")&&t.setAttribute("controls",!0),t.hasAttribute("controls")||(i.add(n),t.addEventListener("click",(function(){var e=!i.contains(o);i[e?"add":"remove"](o),e?t.play():t.pause()}))),t.hasAttribute("data-streaming")){var r=t.getAttribute("data-streaming");if(t.canPlayType("application/vnd.apple.mpegurl"))t.src=r,u(t,a,i);else if("undefined"==typeof Hls){var l=document.createElement("script");l.src="/_Resources/Static/Packages/Jonnitto.PrettyEmbedHelper/Scripts/Hls.js?v=1",document.head.appendChild(l),l.addEventListener("load",(function(){setTimeout((function(){d(t,r),u(t,a,i)}),100)}))}else d(t,r),u(t,a,i)}else u(t,a,i)}function u(t,n,a){a.add(e),n&&(a.add(o),setTimeout((function(){t.play()}),0))}function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t.forEach((function(t){t!=e&&(t.hasAttribute("controls")||t.parentNode.classList.remove(o),t.pause())}))}function d(t,e){if(Hls.isSupported()){var n=new Hls;n.loadSource(e),n.attachMedia(t)}}function s(t){var e;t||(t={}),window.CustomEvent?e=new CustomEvent("prettyembed",{detail:t}):(e=document.createEvent("CustomEvent")).initCustomEvent("prettyembed",!0,!0,t),document.dispatchEvent(e)}i.forEach((function(t){t.addEventListener("play",(function(t){l(i,t.target)}))}));var f=document.querySelectorAll(".jonnitto-prettyembed--audio audio");function p(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector).call(t,e)}function m(t,e){document.documentElement.addEventListener("click",(function(n){var o=function(t,e){var n=t;do{if(p(n,e))return n;n=n.parentElement||n.parentNode}while(null!==n&&1===n.nodeType);return null}(n.target,t);o&&"function"==typeof e&&e.call(o,n)}))}function v(t){return t.getAttribute("aria-label")}Array.from(f).forEach((function(t){var e;r(t,!1),s({type:"audio",style:"inline",src:(e=t.querySelector("source"),e?e.src:null)})}));function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}m(".jonnitto-prettyembed--video.jonnitto-prettyembed--inline video",(function(t){var e=this;t.preventDefault(),r(this,!0,(function(){var t;s({type:"video",style:"inline",title:v(e),src:(t=e.querySelector("source"),t?t.src:null)})}))}));var b=document.documentElement,h=document.body,g="jonnitto-prettyembed",E="".concat(g,"__lightbox"),S=E,A="-".concat(E),T=b.classList,L="".concat(g,"__inner"),w="".concat(g,"__close"),_="".concat(g,"__content"),j=document.createElement("div");j.className=E,j.innerHTML='\n
\n \n
\n
');var H=!1,q=null;function C(){H.className="".concat(g," ").concat(_),H.removeAttribute("style"),H.innerHTML=""}function M(t,e){return H||(h.appendChild(j),H=document.getElementById(S)),C(),"object"!=y(t)&&(t=t?[t]:[]),t.forEach((function(t){H.classList.add("".concat(g,"--").concat(t))})),e&&(H.style.paddingTop=e),H}function N(t){clearTimeout(q),q=setTimeout((function(){"function"==typeof t&&t(),T.add(A)}),100)}function x(){T.remove(A),H&&(clearTimeout(q),q=setTimeout(C,300))}function k(t,e){"function"==typeof e&&"string"==typeof t&&m(t,e)}m(".".concat(_),(function(t){t.stopImmediatePropagation()})),m(".".concat(E),x),m(".".concat(w),x),b.addEventListener("keyup",(function(t){27==t.keyCode&&T.contains(A)&&x()}));var D,P="jonnitto-prettyembed";k(".".concat(P,"--video.").concat(P,"--lightbox video"),(function(t){var e=this;t.preventDefault(),clearTimeout(D),l();var n=M("video",!1).appendChild(this.cloneNode(!0));null==this.dataset.controls&&Array.from(this.parentNode.children).forEach((function(t){t==e||t.classList.contains("".concat(P,"__preview"))||n.parentNode.appendChild(t.cloneNode(!0))})),N((function(){var t;r(n),e.dataset.init||(e.dataset.init=!0,s({type:"video",style:"lightbox",title:v(e),src:(t=e.querySelector("source"),t?t.src:null)}))})),D=setTimeout((function(){n.play()}),500)}));var I="jonnitto-prettyembed";function R(t){var e=t.dataset,n=null!=e.fs;return!!e.embed&&'')}function W(t){var e=t.querySelector("img");return{node:e||null,src:e?e.getAttribute("src"):null}}function z(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"56.25%";if(t.dataset.ratio)return t.dataset.ratio;var n=W(t);if(!n.node)return e;var o=parseInt(n.node.naturalHeight)/parseInt(n.node.naturalWidth)*100;return"number"!=typeof o?e:o+"%"}function B(t,e,n){if(G(t,n)){var o=R(t),a=W(t);if(!o)return;var c=function(t,e){if("object"===y(t)&&"string"==typeof e){var n=t,o=n.tagName,a=new RegExp("^<"+o,"i"),c=new RegExp(o+">$","i"),i="<"+e,r=e+">",u=document.createElement("div");u.innerHTML=n.outerHTML.replace(a,i).replace(c,r);var l=u.firstChild;return t.parentNode.replaceChild(l,t),l}}(t,"div");c.classList.add(e),c.style.paddingTop=z(t),c.innerHTML=o,a.src&&c.setAttribute("data-img",a.src),s({type:n,style:"inline",title:v(t),src:t.dataset.embed})}}function G(t,e){var n=t.dataset.gdpr;if(!n)return!0;console.log({GDPR:n});var o=window.localStorage,a="jonnittoprettyembed_gdpr_".concat(e);return!("true"!==o[a]&&!confirm(n))&&(t.removeAttribute("data-gdpr"),o[a]="true",!0)}function J(t){k("a.".concat(I,"--").concat(t,".").concat(I,"--lightbox"),(function(e){var n=this,o=R(this);if(o&&(e.preventDefault(),G(this,t))){var a=z(this);M([t,"iframe"],a).innerHTML=o,N((function(){n.dataset.init||(n.dataset.init=!0,s({type:t,style:"lightbox",title:v(n),src:n.dataset.embed}))}))}}))}function O(t){var e="a.".concat(I,"--").concat(t,".").concat(I,"--inline"),n="".concat(I,"--play");m(e,(function(e){e.preventDefault(),B(this,n,t)}))}function $(t){var e=t.getAttribute("src");t.naturalHeight<=90&&t.naturalWidth<=120&&-1==e.indexOf("/default.jpg")&&(e=e.replace("mqdefault","default").replace("hqdefault","mqdefault").replace("sddefault","hqdefault").replace("maxresdefault","sddefault"),t.setAttribute("src",e),setTimeout((function(){t.onload=function(){$(t)}}),10),setTimeout((function(){$(t)}),5e3))}O("vimeo"),J("vimeo"),O("youtube"),J("youtube"),window.addEventListener("load",(function(){!function(t){void 0===t&&(t=document.querySelectorAll("img.jonnitto-prettyembed__youtube-preview"));for(var e=t.length-1;e>=0;e--)$(t[e])}()}))}(); //# sourceMappingURL=Main.js.map diff --git a/Resources/Public/Scripts/Main.js.map b/Resources/Public/Scripts/Main.js.map index 34a7579..a5a0217 100644 --- a/Resources/Public/Scripts/Main.js.map +++ b/Resources/Public/Scripts/Main.js.map @@ -1 +1 @@ -{"version":3,"file":"Main.js","sources":["../../Private/Assets/Helper/MediaInit.js","../../Private/Assets/Helper/triggerEvent.js","../../Private/Assets/Audio/Embed.js","../../Private/Assets/Helper/addEvent.js","../../Private/Assets/Helper/getAriaLabel.js","../../Private/Assets/Video/Embed.js","../../Private/Assets/Helper/Lightbox.js","../../Private/Assets/Video/Lightbox.js","../../Private/Assets/Helper/iFrame.js","../../Private/Assets/Youtube/Preview.js","../../Private/Assets/Vimeo/Embed.js","../../Private/Assets/Vimeo/Lightbox.js","../../Private/Assets/Youtube/Embed.js","../../Private/Assets/Youtube/Lightbox.js"],"sourcesContent":["const BASE = 'jonnitto-prettyembed';\nconst INIT_CLASS = `${BASE}--init`;\nconst SLIM_CLASS = `${BASE}--slim`;\nconst PLAY_CLASS = `${BASE}--play`;\n\nconst VIDEOS = Array.from(document.querySelectorAll(`.${BASE}--video video:not([autoplay])`));\nconst AUDIOS = Array.from(document.querySelectorAll(`.${BASE}--audio audio:not([autoplay])`));\nconst ELEMENTS = [].concat(VIDEOS, AUDIOS);\n\nfunction init(element, autoplay = true, callback) {\n const CLASS_LIST = element.parentNode.classList;\n if (CLASS_LIST.contains(INIT_CLASS)) {\n return;\n }\n\n if (typeof callback == 'function') {\n callback();\n }\n\n if (element.hasAttribute('data-controls')) {\n element.setAttribute('controls', true);\n }\n\n if (!element.hasAttribute('controls')) {\n CLASS_LIST.add(SLIM_CLASS);\n element.addEventListener('click', () => {\n const play = !CLASS_LIST.contains(PLAY_CLASS);\n CLASS_LIST[play ? 'add' : 'remove'](PLAY_CLASS);\n if (play) {\n element.play();\n } else {\n element.pause();\n }\n });\n }\n\n if (element.hasAttribute('data-streaming')) {\n const SRC = element.getAttribute('data-streaming');\n if (element.canPlayType('application/vnd.apple.mpegurl')) {\n element.src = SRC;\n addClassAndPlay(element, autoplay, CLASS_LIST);\n } else {\n if (typeof Hls === 'undefined') {\n const HLS_SCRIPT = document.createElement('script');\n HLS_SCRIPT.src = '/_Resources/Static/Packages/Jonnitto.PrettyEmbedHelper/Scripts/Hls.js?v=1';\n document.head.appendChild(HLS_SCRIPT);\n HLS_SCRIPT.addEventListener('load', () => {\n setTimeout(() => {\n loadHls(element, SRC);\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }, 100);\n });\n } else {\n loadHls(element, SRC);\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }\n }\n } else {\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }\n}\n\nfunction addClassAndPlay(element, autoplay, classList) {\n classList.add(INIT_CLASS);\n if (autoplay) {\n classList.add(PLAY_CLASS);\n setTimeout(() => {\n element.play();\n }, 0);\n }\n}\n\nfunction pause(elements = ELEMENTS, current = null) {\n elements.forEach((element) => {\n if (element != current) {\n if (!element.hasAttribute('controls')) {\n element.parentNode.classList.remove(PLAY_CLASS);\n }\n element.pause();\n }\n });\n}\n\nfunction loadHls(element, src) {\n if (Hls.isSupported()) {\n const HLS = new Hls();\n HLS.loadSource(src);\n HLS.attachMedia(element);\n }\n}\n\nELEMENTS.forEach((element) => {\n element.addEventListener('play', (event) => {\n pause(ELEMENTS, event.target);\n });\n});\n\nexport { init, pause };\n","export default function (options) {\n let event;\n if (!options) {\n options = {};\n }\n if (window.CustomEvent) {\n event = new CustomEvent('prettyembed', { detail: options });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent('prettyembed', true, true, options);\n }\n document.dispatchEvent(event);\n}\n","import { init } from '../Helper/MediaInit';\nimport triggerEvent from '../Helper/triggerEvent';\n\nconst elements = document.querySelectorAll('.jonnitto-prettyembed--audio audio');\nArray.from(elements).forEach((element) => {\n init(element, false);\n triggerEvent({\n type: 'audio',\n style: 'inline',\n src: (() => {\n const SOURCE = element.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n});\n","function matches(element, selector) {\n return (\n element.matches ||\n element.matchesSelector ||\n element.msMatchesSelector ||\n element.mozMatchesSelector ||\n element.webkitMatchesSelector ||\n element.oMatchesSelector\n ).call(element, selector);\n}\n\nfunction closest(element, selector) {\n let ancestor = element;\n\n do {\n if (matches(ancestor, selector)) {\n return ancestor;\n }\n ancestor = ancestor.parentElement || ancestor.parentNode;\n } while (ancestor !== null && ancestor.nodeType === 1);\n return null;\n}\n\nexport default function (selector, callback) {\n document.documentElement.addEventListener('click', (event) => {\n const ELEMENT = closest(event.target, selector);\n if (!ELEMENT || typeof callback != 'function') {\n return;\n }\n callback.call(ELEMENT, event);\n });\n}\n","export default function (node) {\n return node.getAttribute('aria-label');\n}\n","import { init } from '../Helper/MediaInit';\nimport addEvent from '../Helper/addEvent';\nimport triggerEvent from '../Helper/triggerEvent';\nimport getAriaLabel from '../Helper/getAriaLabel';\n\nconst SELECTOR = '.jonnitto-prettyembed--video.jonnitto-prettyembed--inline video';\n\naddEvent(SELECTOR, function (event) {\n event.preventDefault();\n init(this, true, () => {\n triggerEvent({\n type: 'video',\n style: 'inline',\n title: getAriaLabel(this),\n src: (() => {\n const SOURCE = this.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n });\n});\n","import addEvent from './addEvent';\n\nconst HTML_ELEMENT = document.documentElement;\nconst BODY_ELEMENT = document.body;\nconst BASE_CLASS = 'jonnitto-prettyembed';\nconst LIGHTBOX_CLASS = `${BASE_CLASS}__lightbox`;\nconst ID = LIGHTBOX_CLASS;\nconst VISIBLE_CLASS = `-${LIGHTBOX_CLASS}`;\nconst VISIBLE_CLASS_LIST = HTML_ELEMENT.classList;\nconst INNER_CLASS = `${BASE_CLASS}__inner`;\nconst CLOSE_CLASS = `${BASE_CLASS}__close`;\nconst CONTENT_CLASS = `${BASE_CLASS}__content`;\nconst LIGHTBOX = document.createElement('div');\n\nLIGHTBOX.className = LIGHTBOX_CLASS;\nLIGHTBOX.innerHTML = `\n
\n \n
\n
`;\n\nlet lighboxContent = false;\nlet timeout = null;\n\nfunction resetContent() {\n // Reset the content to the default class\n lighboxContent.className = `${BASE_CLASS} ${CONTENT_CLASS}`;\n // Remove style attribute\n lighboxContent.removeAttribute('style');\n // Clear all content\n lighboxContent.innerHTML = '';\n}\n\nfunction get(type, paddingTop) {\n if (!lighboxContent) {\n BODY_ELEMENT.appendChild(LIGHTBOX);\n lighboxContent = document.getElementById(ID);\n }\n resetContent();\n if (typeof type != 'object') {\n type = type ? [type] : [];\n }\n type.forEach((item) => {\n lighboxContent.classList.add(`${BASE_CLASS}--${item}`);\n });\n\n if (paddingTop) {\n lighboxContent.style.paddingTop = paddingTop;\n }\n return lighboxContent;\n}\n\nfunction show(callback) {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n if (typeof callback == 'function') {\n callback();\n }\n VISIBLE_CLASS_LIST.add(VISIBLE_CLASS);\n }, 100);\n}\n\nfunction closeLighbox() {\n VISIBLE_CLASS_LIST.remove(VISIBLE_CLASS);\n if (lighboxContent) {\n clearTimeout(timeout);\n timeout = setTimeout(resetContent, 300);\n }\n}\n\nfunction closeLighboxOnESC(event) {\n if (event.keyCode == 27) {\n if (VISIBLE_CLASS_LIST.contains(VISIBLE_CLASS)) {\n closeLighbox();\n }\n }\n}\n\nfunction init(selector, callback) {\n if (typeof callback == 'function' && typeof selector == 'string') {\n addEvent(selector, callback);\n }\n}\n\n// Catch click event to prevent closing lightbox if some clicks on content\naddEvent(`.${CONTENT_CLASS}`, (event) => {\n event.stopImmediatePropagation();\n});\n\n// Close lightbox on click on lightbox background or on close button\naddEvent(`.${LIGHTBOX_CLASS}`, closeLighbox);\naddEvent(`.${CLOSE_CLASS}`, closeLighbox);\n\n// Close on ESC\nHTML_ELEMENT.addEventListener('keyup', closeLighboxOnESC);\n\nexport { get, show, init };\n","import * as video from '../Helper/MediaInit';\nimport * as lightbox from '../Helper/Lightbox';\nimport triggerEvent from '../Helper/triggerEvent';\nimport getAriaLabel from '../Helper/getAriaLabel';\n\nconst BASE_CLASS = 'jonnitto-prettyembed';\nconst SELECTOR_CLASS = `.${BASE_CLASS}--video.${BASE_CLASS}--lightbox video`;\nlet timeout;\n\nlightbox.init(SELECTOR_CLASS, function (event) {\n event.preventDefault();\n clearTimeout(timeout);\n video.pause();\n const VIDEO_NODE = lightbox.get('video', false).appendChild(this.cloneNode(true));\n if (this.dataset.controls == undefined) {\n // As we have no controls, we need to add also the play and pause button\n Array.from(this.parentNode.children).forEach((element) => {\n if (element != this && !element.classList.contains(`${BASE_CLASS}__preview`)) {\n VIDEO_NODE.parentNode.appendChild(element.cloneNode(true));\n }\n });\n }\n lightbox.show(() => {\n video.init(VIDEO_NODE);\n if (!this.dataset.init) {\n this.dataset.init = true;\n triggerEvent({\n type: 'video',\n style: 'lightbox',\n title: getAriaLabel(this),\n src: (() => {\n const SOURCE = this.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n }\n });\n\n timeout = setTimeout(function () {\n // Make sure the VIDEO_NODE start playing\n VIDEO_NODE.play();\n }, 500);\n});\n","import addEvent from './addEvent';\nimport triggerEvent from './triggerEvent';\nimport getAriaLabel from './getAriaLabel';\nimport * as lightboxHelper from '../Helper/Lightbox';\n\nconst BASE = 'jonnitto-prettyembed';\n\nfunction markup(node) {\n const DATA = node.dataset;\n const FULLSCREEN = DATA.fs != null;\n if (!DATA.embed) {\n return false;\n }\n\n return ``;\n}\n\nfunction replace(element, tagName) {\n if (typeof element === 'object' && typeof tagName === 'string') {\n const ORIGINAL_ELEMENT = element;\n const ORIGINAL_TAG = ORIGINAL_ELEMENT.tagName;\n const START_RX = new RegExp('^<' + ORIGINAL_TAG, 'i');\n const END_RX = new RegExp(ORIGINAL_TAG + '>$', 'i');\n const START_SUBST = '<' + tagName;\n const END_SUBST = tagName + '>';\n const WRAPPER = document.createElement('div');\n WRAPPER.innerHTML = ORIGINAL_ELEMENT.outerHTML.replace(START_RX, START_SUBST).replace(END_RX, END_SUBST);\n const NEW_ELEMENT = WRAPPER.firstChild;\n element.parentNode.replaceChild(NEW_ELEMENT, element);\n return NEW_ELEMENT;\n }\n}\n\nfunction getImage(node) {\n const IMAGE = node.querySelector('img');\n return {\n node: IMAGE || null,\n src: IMAGE ? IMAGE.getAttribute('src') : null,\n };\n}\n\nfunction getPaddingTop(node, fallback = '56.25%') {\n // 56.25% is a 16:9 in percent\n\n if (node.dataset.ratio) {\n return node.dataset.ratio;\n }\n\n const IMAGE = getImage(node);\n if (!IMAGE.node) {\n return fallback;\n }\n const RATIO = (parseInt(IMAGE.node.naturalHeight) / parseInt(IMAGE.node.naturalWidth)) * 100;\n if (typeof RATIO != 'number') {\n return fallback;\n }\n return RATIO + '%';\n}\n\nfunction write(link, playClass, type) {\n if (checkGdpr(link)) {\n const IFRAME = markup(link);\n const IMAGE = getImage(link);\n if (!IFRAME) {\n return;\n }\n const ELEMENT = replace(link, 'div');\n ELEMENT.classList.add(playClass);\n ELEMENT.style.paddingTop = getPaddingTop(link);\n ELEMENT.innerHTML = IFRAME;\n\n if (IMAGE.src) {\n ELEMENT.setAttribute('data-img', IMAGE.src);\n }\n triggerEvent({\n type: type,\n style: 'inline',\n title: getAriaLabel(link),\n src: link.dataset.embed,\n });\n }\n}\n\nfunction checkGdpr(element) {\n const GDPR = element.dataset.gdpr;\n\n if (!GDPR) {\n return true;\n }\n if (GDPR && confirm(GDPR)) {\n element.removeAttribute('data-gdpr');\n return true;\n }\n return false;\n}\n\nfunction restore(element, playClass) {\n const IMAGE = element.getAttribute('data-img') || false;\n if (IMAGE) {\n element.classList.remove(playClass);\n element.removeAttribute('style');\n element.innerHTML = ``;\n replace(element, 'a');\n }\n}\n\nfunction lightbox(type) {\n const SELECTOR = `a.${BASE}--${type}.${BASE}--lightbox`;\n\n lightboxHelper.init(SELECTOR, function (event) {\n const HTML = markup(this);\n if (HTML) {\n event.preventDefault();\n if (checkGdpr(this)) {\n const PADDING_TOP = getPaddingTop(this);\n lightboxHelper.get([type, 'iframe'], PADDING_TOP).innerHTML = HTML;\n lightboxHelper.show(() => {\n if (!this.dataset.init) {\n this.dataset.init = true;\n triggerEvent({\n type: type,\n style: 'lightbox',\n title: getAriaLabel(this),\n src: this.dataset.embed,\n });\n }\n });\n }\n }\n });\n}\n\nfunction embed(type) {\n const SELECTOR = `a.${BASE}--${type}.${BASE}--inline`;\n const PLAY_CLASS = `${BASE}--play`;\n\n addEvent(SELECTOR, function (event) {\n event.preventDefault();\n write(this, PLAY_CLASS, type);\n });\n}\n\nexport { markup, replace, write, restore, lightbox, embed };\n","function fixPreview(img) {\n let src = img.getAttribute('src');\n if (img.naturalHeight <= 90 && img.naturalWidth <= 120 && src.indexOf('/default.jpg') == -1) {\n src = src\n .replace('mqdefault', 'default')\n .replace('hqdefault', 'mqdefault')\n .replace('sddefault', 'hqdefault')\n .replace('maxresdefault', 'sddefault');\n img.setAttribute('src', src);\n setTimeout(() => {\n img.onload = () => {\n fixPreview(img);\n };\n }, 10);\n setTimeout(() => {\n fixPreview(img);\n }, 5000);\n }\n}\n\nfunction fixPreviews(images) {\n if (typeof images === 'undefined') {\n images = document.querySelectorAll('img.jonnitto-prettyembed__youtube-preview');\n }\n for (let i = images.length - 1; i >= 0; i--) {\n fixPreview(images[i]);\n }\n}\n\nwindow.addEventListener('load', () => {\n fixPreviews();\n});\n","import { embed } from '../Helper/iFrame';\n\nembed('vimeo');\n","import { lightbox } from '../Helper/iFrame';\n\nlightbox('vimeo');\n","import { embed } from '../Helper/iFrame';\n\nembed('youtube');\n","import { lightbox } from '../Helper/iFrame';\n\nlightbox('youtube');\n"],"names":["BASE","INIT_CLASS","SLIM_CLASS","PLAY_CLASS","VIDEOS","Array","from","document","querySelectorAll","concat","AUDIOS","ELEMENTS","init","element","autoplay","callback","arguments","length","undefined","CLASS_LIST","parentNode","classList","contains","hasAttribute","setAttribute","add","addEventListener","play","pause","SRC","getAttribute","canPlayType","src","addClassAndPlay","Hls","HLS_SCRIPT","createElement","head","appendChild","setTimeout","loadHls","elements","current","forEach","remove","isSupported","HLS","loadSource","attachMedia","triggerEvent","options","event","window","CustomEvent","detail","createEvent","initCustomEvent","dispatchEvent","target","matches","selector","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","call","addEvent","documentElement","ELEMENT","ancestor","parentElement","nodeType","closest","getAriaLabel","node","SOURCE","type","style","querySelector","_this","this","preventDefault","title","HTML_ELEMENT","BODY_ELEMENT","body","BASE_CLASS","LIGHTBOX_CLASS","ID","VISIBLE_CLASS","VISIBLE_CLASS_LIST","INNER_CLASS","CLOSE_CLASS","CONTENT_CLASS","LIGHTBOX","className","innerHTML","lighboxContent","timeout","resetContent","removeAttribute","get","paddingTop","getElementById","_typeof","item","show","clearTimeout","closeLighbox","stopImmediatePropagation","keyCode","lightbox","video","VIDEO_NODE","cloneNode","dataset","controls","children","markup","DATA","FULLSCREEN","fs","embed","getImage","IMAGE","getPaddingTop","fallback","ratio","RATIO","parseInt","naturalHeight","naturalWidth","write","link","playClass","checkGdpr","IFRAME","tagName","ORIGINAL_ELEMENT","ORIGINAL_TAG","START_RX","RegExp","END_RX","START_SUBST","END_SUBST","WRAPPER","outerHTML","replace","NEW_ELEMENT","firstChild","replaceChild","GDPR","gdpr","confirm","lightboxHelper","HTML","PADDING_TOP","SELECTOR","fixPreview","img","indexOf","onload","images","i","fixPreviews"],"mappings":";;;;;;yBAAA,IAAMA,EAAO,uBACPC,EAAgBD,GAAAA,OAAAA,EAAtB,UACME,EAAgBF,GAAAA,OAAAA,EAAtB,UACMG,EAAgBH,GAAAA,OAAAA,EAAtB,UAEMI,EAASC,MAAMC,KAAKC,SAASC,iBAAT,IAAAC,OAA8BT,EAA9B,mCACpBU,EAASL,MAAMC,KAAKC,SAASC,iBAAT,IAAAC,OAA8BT,EAA9B,mCACpBW,EAAW,GAAGF,OAAOL,EAAQM,GAEnC,SAASE,EAAKC,GAASC,IAAAA,6DAAiBC,EAAUC,UAAAC,OAAA,EAAAD,UAAA,QAAAE,EACxCC,EAAaN,EAAQO,WAAWC,UACtC,IAAIF,EAAWG,SAASrB,GAyBxB,GArBuB,mBAAZc,GACPA,IAGAF,EAAQU,aAAa,kBACrBV,EAAQW,aAAa,YAAY,GAGhCX,EAAQU,aAAa,cACtBJ,EAAWM,IAAIvB,GACfW,EAAQa,iBAAiB,SAAS,WACxBC,IAAAA,GAAQR,EAAWG,SAASnB,GAClCgB,EAAWQ,EAAO,MAAQ,UAAUxB,GAChCwB,EACAd,EAAQc,OAERd,EAAQe,YAKhBf,EAAQU,aAAa,kBAAmB,CACxC,IAAMM,E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AzG,EAAM+B,iBACFsD,EAAUvD,OAAO,CACjB,IAAM4E,EAAc/B,EAAc7C,MAClC0E,EAAmB,CAAC9E,EAAM,UAAWgF,GAAa5D,UAAY2D,EAC9DD,GAAoB,WACX3E,EAAKoC,QAAQxG,OACdoE,EAAKoC,QAAQxG,MAAO,EACpBqC,EAAa,CACT4B,KAAMA,EACNC,MAAO,WACPK,MAAOT,EAAaM,GACpBhD,IAAKgD,EAAKoC,QAAQO,gBAS9C,SAASA,EAAM9C,GACX,IAAMiF,EAAgB9J,KAAAA,OAAAA,eAAS6E,EAAjB,KAAApE,OAAyBT,EAAvC,YACMG,EAAgBH,GAAAA,OAAAA,EAAtB,UAEAmE,EAAS2F,GAAU,SAAU3G,GACzBA,EAAM+B,iBACNmD,EAAMpD,KAAM9E,EAAY0E,MC5IhC,SAASkF,EAAWC,GAChB,IAAIhI,EAAMgI,EAAIlI,aAAa,OACvBkI,EAAI7B,eAAiB,IAAM6B,EAAI5B,cAAgB,MAAuC,GAAhCpG,EAAIiI,QAAQ,kBAClEjI,EAAMA,EACDoH,QAAQ,YAAa,WACrBA,QAAQ,YAAa,aACrBA,QAAQ,YAAa,aACrBA,QAAQ,gBAAiB,aAC9BY,EAAIxI,aAAa,MAAOQ,GACxBO,YAAW,WACPyH,EAAIE,OAAS,WACTH,EAAWC,MAEhB,IACHzH,YAAW,WACPwH,EAAWC,KACZ,MCdXrC,EAAM,SCANX,EAAS,SCATW,EAAM,WCANX,EAAS,WJ2BT5D,OAAO1B,iBAAiB,QAAQ,YAThC,SAAqByI,QACK,IAAXA,IACPA,EAAS5J,SAASC,iBAAiB,8CAEvC,IAAK,IAAI4J,EAAID,EAAOlJ,OAAS,EAAGmJ,GAAK,EAAGA,IACpCL,EAAWI,EAAOC,IAKtBC"} \ No newline at end of file +{"version":3,"file":"Main.js","sources":["../../Private/Assets/Helper/MediaInit.js","../../Private/Assets/Helper/triggerEvent.js","../../Private/Assets/Audio/Embed.js","../../Private/Assets/Helper/addEvent.js","../../Private/Assets/Helper/getAriaLabel.js","../../Private/Assets/Video/Embed.js","../../Private/Assets/Helper/Lightbox.js","../../Private/Assets/Video/Lightbox.js","../../Private/Assets/Helper/iFrame.js","../../Private/Assets/Youtube/Preview.js","../../Private/Assets/Vimeo/Embed.js","../../Private/Assets/Vimeo/Lightbox.js","../../Private/Assets/Youtube/Embed.js","../../Private/Assets/Youtube/Lightbox.js"],"sourcesContent":["const BASE = 'jonnitto-prettyembed';\nconst INIT_CLASS = `${BASE}--init`;\nconst SLIM_CLASS = `${BASE}--slim`;\nconst PLAY_CLASS = `${BASE}--play`;\n\nconst VIDEOS = Array.from(document.querySelectorAll(`.${BASE}--video video:not([autoplay])`));\nconst AUDIOS = Array.from(document.querySelectorAll(`.${BASE}--audio audio:not([autoplay])`));\nconst ELEMENTS = [].concat(VIDEOS, AUDIOS);\n\nfunction init(element, autoplay = true, callback) {\n const CLASS_LIST = element.parentNode.classList;\n if (CLASS_LIST.contains(INIT_CLASS)) {\n return;\n }\n\n if (typeof callback == 'function') {\n callback();\n }\n\n if (element.hasAttribute('data-controls')) {\n element.setAttribute('controls', true);\n }\n\n if (!element.hasAttribute('controls')) {\n CLASS_LIST.add(SLIM_CLASS);\n element.addEventListener('click', () => {\n const play = !CLASS_LIST.contains(PLAY_CLASS);\n CLASS_LIST[play ? 'add' : 'remove'](PLAY_CLASS);\n if (play) {\n element.play();\n } else {\n element.pause();\n }\n });\n }\n\n if (element.hasAttribute('data-streaming')) {\n const SRC = element.getAttribute('data-streaming');\n if (element.canPlayType('application/vnd.apple.mpegurl')) {\n element.src = SRC;\n addClassAndPlay(element, autoplay, CLASS_LIST);\n } else {\n if (typeof Hls === 'undefined') {\n const HLS_SCRIPT = document.createElement('script');\n HLS_SCRIPT.src = '/_Resources/Static/Packages/Jonnitto.PrettyEmbedHelper/Scripts/Hls.js?v=1';\n document.head.appendChild(HLS_SCRIPT);\n HLS_SCRIPT.addEventListener('load', () => {\n setTimeout(() => {\n loadHls(element, SRC);\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }, 100);\n });\n } else {\n loadHls(element, SRC);\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }\n }\n } else {\n addClassAndPlay(element, autoplay, CLASS_LIST);\n }\n}\n\nfunction addClassAndPlay(element, autoplay, classList) {\n classList.add(INIT_CLASS);\n if (autoplay) {\n classList.add(PLAY_CLASS);\n setTimeout(() => {\n element.play();\n }, 0);\n }\n}\n\nfunction pause(elements = ELEMENTS, current = null) {\n elements.forEach((element) => {\n if (element != current) {\n if (!element.hasAttribute('controls')) {\n element.parentNode.classList.remove(PLAY_CLASS);\n }\n element.pause();\n }\n });\n}\n\nfunction loadHls(element, src) {\n if (Hls.isSupported()) {\n const HLS = new Hls();\n HLS.loadSource(src);\n HLS.attachMedia(element);\n }\n}\n\nELEMENTS.forEach((element) => {\n element.addEventListener('play', (event) => {\n pause(ELEMENTS, event.target);\n });\n});\n\nexport { init, pause };\n","export default function (options) {\n let event;\n if (!options) {\n options = {};\n }\n if (window.CustomEvent) {\n event = new CustomEvent('prettyembed', { detail: options });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent('prettyembed', true, true, options);\n }\n document.dispatchEvent(event);\n}\n","import { init } from '../Helper/MediaInit';\nimport triggerEvent from '../Helper/triggerEvent';\n\nconst elements = document.querySelectorAll('.jonnitto-prettyembed--audio audio');\nArray.from(elements).forEach((element) => {\n init(element, false);\n triggerEvent({\n type: 'audio',\n style: 'inline',\n src: (() => {\n const SOURCE = element.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n});\n","function matches(element, selector) {\n return (\n element.matches ||\n element.matchesSelector ||\n element.msMatchesSelector ||\n element.mozMatchesSelector ||\n element.webkitMatchesSelector ||\n element.oMatchesSelector\n ).call(element, selector);\n}\n\nfunction closest(element, selector) {\n let ancestor = element;\n\n do {\n if (matches(ancestor, selector)) {\n return ancestor;\n }\n ancestor = ancestor.parentElement || ancestor.parentNode;\n } while (ancestor !== null && ancestor.nodeType === 1);\n return null;\n}\n\nexport default function (selector, callback) {\n document.documentElement.addEventListener('click', (event) => {\n const ELEMENT = closest(event.target, selector);\n if (!ELEMENT || typeof callback != 'function') {\n return;\n }\n callback.call(ELEMENT, event);\n });\n}\n","export default function (node) {\n return node.getAttribute('aria-label');\n}\n","import { init } from '../Helper/MediaInit';\nimport addEvent from '../Helper/addEvent';\nimport triggerEvent from '../Helper/triggerEvent';\nimport getAriaLabel from '../Helper/getAriaLabel';\n\nconst SELECTOR = '.jonnitto-prettyembed--video.jonnitto-prettyembed--inline video';\n\naddEvent(SELECTOR, function (event) {\n event.preventDefault();\n init(this, true, () => {\n triggerEvent({\n type: 'video',\n style: 'inline',\n title: getAriaLabel(this),\n src: (() => {\n const SOURCE = this.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n });\n});\n","import addEvent from './addEvent';\n\nconst HTML_ELEMENT = document.documentElement;\nconst BODY_ELEMENT = document.body;\nconst BASE_CLASS = 'jonnitto-prettyembed';\nconst LIGHTBOX_CLASS = `${BASE_CLASS}__lightbox`;\nconst ID = LIGHTBOX_CLASS;\nconst VISIBLE_CLASS = `-${LIGHTBOX_CLASS}`;\nconst VISIBLE_CLASS_LIST = HTML_ELEMENT.classList;\nconst INNER_CLASS = `${BASE_CLASS}__inner`;\nconst CLOSE_CLASS = `${BASE_CLASS}__close`;\nconst CONTENT_CLASS = `${BASE_CLASS}__content`;\nconst LIGHTBOX = document.createElement('div');\n\nLIGHTBOX.className = LIGHTBOX_CLASS;\nLIGHTBOX.innerHTML = `\n
\n \n
\n
`;\n\nlet lighboxContent = false;\nlet timeout = null;\n\nfunction resetContent() {\n // Reset the content to the default class\n lighboxContent.className = `${BASE_CLASS} ${CONTENT_CLASS}`;\n // Remove style attribute\n lighboxContent.removeAttribute('style');\n // Clear all content\n lighboxContent.innerHTML = '';\n}\n\nfunction get(type, paddingTop) {\n if (!lighboxContent) {\n BODY_ELEMENT.appendChild(LIGHTBOX);\n lighboxContent = document.getElementById(ID);\n }\n resetContent();\n if (typeof type != 'object') {\n type = type ? [type] : [];\n }\n type.forEach((item) => {\n lighboxContent.classList.add(`${BASE_CLASS}--${item}`);\n });\n\n if (paddingTop) {\n lighboxContent.style.paddingTop = paddingTop;\n }\n return lighboxContent;\n}\n\nfunction show(callback) {\n clearTimeout(timeout);\n timeout = setTimeout(function () {\n if (typeof callback == 'function') {\n callback();\n }\n VISIBLE_CLASS_LIST.add(VISIBLE_CLASS);\n }, 100);\n}\n\nfunction closeLighbox() {\n VISIBLE_CLASS_LIST.remove(VISIBLE_CLASS);\n if (lighboxContent) {\n clearTimeout(timeout);\n timeout = setTimeout(resetContent, 300);\n }\n}\n\nfunction closeLighboxOnESC(event) {\n if (event.keyCode == 27) {\n if (VISIBLE_CLASS_LIST.contains(VISIBLE_CLASS)) {\n closeLighbox();\n }\n }\n}\n\nfunction init(selector, callback) {\n if (typeof callback == 'function' && typeof selector == 'string') {\n addEvent(selector, callback);\n }\n}\n\n// Catch click event to prevent closing lightbox if some clicks on content\naddEvent(`.${CONTENT_CLASS}`, (event) => {\n event.stopImmediatePropagation();\n});\n\n// Close lightbox on click on lightbox background or on close button\naddEvent(`.${LIGHTBOX_CLASS}`, closeLighbox);\naddEvent(`.${CLOSE_CLASS}`, closeLighbox);\n\n// Close on ESC\nHTML_ELEMENT.addEventListener('keyup', closeLighboxOnESC);\n\nexport { get, show, init };\n","import * as video from '../Helper/MediaInit';\nimport * as lightbox from '../Helper/Lightbox';\nimport triggerEvent from '../Helper/triggerEvent';\nimport getAriaLabel from '../Helper/getAriaLabel';\n\nconst BASE_CLASS = 'jonnitto-prettyembed';\nconst SELECTOR_CLASS = `.${BASE_CLASS}--video.${BASE_CLASS}--lightbox video`;\nlet timeout;\n\nlightbox.init(SELECTOR_CLASS, function (event) {\n event.preventDefault();\n clearTimeout(timeout);\n video.pause();\n const VIDEO_NODE = lightbox.get('video', false).appendChild(this.cloneNode(true));\n if (this.dataset.controls == undefined) {\n // As we have no controls, we need to add also the play and pause button\n Array.from(this.parentNode.children).forEach((element) => {\n if (element != this && !element.classList.contains(`${BASE_CLASS}__preview`)) {\n VIDEO_NODE.parentNode.appendChild(element.cloneNode(true));\n }\n });\n }\n lightbox.show(() => {\n video.init(VIDEO_NODE);\n if (!this.dataset.init) {\n this.dataset.init = true;\n triggerEvent({\n type: 'video',\n style: 'lightbox',\n title: getAriaLabel(this),\n src: (() => {\n const SOURCE = this.querySelector('source');\n return SOURCE ? SOURCE.src : null;\n })(),\n });\n }\n });\n\n timeout = setTimeout(function () {\n // Make sure the VIDEO_NODE start playing\n VIDEO_NODE.play();\n }, 500);\n});\n","import addEvent from './addEvent';\nimport triggerEvent from './triggerEvent';\nimport getAriaLabel from './getAriaLabel';\nimport * as lightboxHelper from '../Helper/Lightbox';\n\nconst BASE = 'jonnitto-prettyembed';\n\nfunction markup(node) {\n const DATA = node.dataset;\n const FULLSCREEN = DATA.fs != null;\n if (!DATA.embed) {\n return false;\n }\n\n return ``;\n}\n\nfunction replace(element, tagName) {\n if (typeof element === 'object' && typeof tagName === 'string') {\n const ORIGINAL_ELEMENT = element;\n const ORIGINAL_TAG = ORIGINAL_ELEMENT.tagName;\n const START_RX = new RegExp('^<' + ORIGINAL_TAG, 'i');\n const END_RX = new RegExp(ORIGINAL_TAG + '>$', 'i');\n const START_SUBST = '<' + tagName;\n const END_SUBST = tagName + '>';\n const WRAPPER = document.createElement('div');\n WRAPPER.innerHTML = ORIGINAL_ELEMENT.outerHTML.replace(START_RX, START_SUBST).replace(END_RX, END_SUBST);\n const NEW_ELEMENT = WRAPPER.firstChild;\n element.parentNode.replaceChild(NEW_ELEMENT, element);\n return NEW_ELEMENT;\n }\n}\n\nfunction getImage(node) {\n const IMAGE = node.querySelector('img');\n return {\n node: IMAGE || null,\n src: IMAGE ? IMAGE.getAttribute('src') : null,\n };\n}\n\nfunction getPaddingTop(node, fallback = '56.25%') {\n // 56.25% is a 16:9 in percent\n\n if (node.dataset.ratio) {\n return node.dataset.ratio;\n }\n\n const IMAGE = getImage(node);\n if (!IMAGE.node) {\n return fallback;\n }\n const RATIO = (parseInt(IMAGE.node.naturalHeight) / parseInt(IMAGE.node.naturalWidth)) * 100;\n if (typeof RATIO != 'number') {\n return fallback;\n }\n return RATIO + '%';\n}\n\nfunction write(link, playClass, type) {\n if (checkGdpr(link, type)) {\n const IFRAME = markup(link);\n const IMAGE = getImage(link);\n if (!IFRAME) {\n return;\n }\n const ELEMENT = replace(link, 'div');\n ELEMENT.classList.add(playClass);\n ELEMENT.style.paddingTop = getPaddingTop(link);\n ELEMENT.innerHTML = IFRAME;\n\n if (IMAGE.src) {\n ELEMENT.setAttribute('data-img', IMAGE.src);\n }\n triggerEvent({\n type: type,\n style: 'inline',\n title: getAriaLabel(link),\n src: link.dataset.embed,\n });\n }\n}\n\nfunction checkGdpr(element, type) {\n const GDPR = element.dataset.gdpr;\n\n if (!GDPR) {\n return true;\n }\n console.log({ GDPR });\n const LOCAL_STORAGE = window.localStorage;\n const STORAGE_KEY = `jonnittoprettyembed_gdpr_${type}`;\n\n if (LOCAL_STORAGE[STORAGE_KEY] === 'true' || confirm(GDPR)) {\n element.removeAttribute('data-gdpr');\n LOCAL_STORAGE[STORAGE_KEY] = 'true';\n return true;\n }\n return false;\n}\n\nfunction restore(element, playClass) {\n const IMAGE = element.getAttribute('data-img') || false;\n if (IMAGE) {\n element.classList.remove(playClass);\n element.removeAttribute('style');\n element.innerHTML = ``;\n replace(element, 'a');\n }\n}\n\nfunction lightbox(type) {\n const SELECTOR = `a.${BASE}--${type}.${BASE}--lightbox`;\n\n lightboxHelper.init(SELECTOR, function (event) {\n const HTML = markup(this);\n if (HTML) {\n event.preventDefault();\n if (checkGdpr(this, type)) {\n const PADDING_TOP = getPaddingTop(this);\n lightboxHelper.get([type, 'iframe'], PADDING_TOP).innerHTML = HTML;\n lightboxHelper.show(() => {\n if (!this.dataset.init) {\n this.dataset.init = true;\n triggerEvent({\n type: type,\n style: 'lightbox',\n title: getAriaLabel(this),\n src: this.dataset.embed,\n });\n }\n });\n }\n }\n });\n}\n\nfunction embed(type) {\n const SELECTOR = `a.${BASE}--${type}.${BASE}--inline`;\n const PLAY_CLASS = `${BASE}--play`;\n\n addEvent(SELECTOR, function (event) {\n event.preventDefault();\n write(this, PLAY_CLASS, type);\n });\n}\n\nexport { markup, replace, write, restore, lightbox, embed };\n","function fixPreview(img) {\n let src = img.getAttribute('src');\n if (img.naturalHeight <= 90 && img.naturalWidth <= 120 && src.indexOf('/default.jpg') == -1) {\n src = src\n .replace('mqdefault', 'default')\n .replace('hqdefault', 'mqdefault')\n .replace('sddefault', 'hqdefault')\n .replace('maxresdefault', 'sddefault');\n img.setAttribute('src', src);\n setTimeout(() => {\n img.onload = () => {\n fixPreview(img);\n };\n }, 10);\n setTimeout(() => {\n fixPreview(img);\n }, 5000);\n }\n}\n\nfunction fixPreviews(images) {\n if (typeof images === 'undefined') {\n images = document.querySelectorAll('img.jonnitto-prettyembed__youtube-preview');\n }\n for (let i = images.length - 1; i >= 0; i--) {\n fixPreview(images[i]);\n }\n}\n\nwindow.addEventListener('load', () => {\n fixPreviews();\n});\n","import { embed } from '../Helper/iFrame';\n\nembed('vimeo');\n","import { lightbox } from '../Helper/iFrame';\n\nlightbox('vimeo');\n","import { embed } from '../Helper/iFrame';\n\nembed('youtube');\n","import { lightbox } from '../Helper/iFrame';\n\nlightbox('youtube');\n"],"names":["BASE","INIT_CLASS","SLIM_CLASS","PLAY_CLASS","VIDEOS","Array","from","document","querySelectorAll","concat","AUDIOS","ELEMENTS","init","element","autoplay","callback","arguments","length","undefined","CLASS_LIST","parentNode","classList","contains","hasAttribute","setAttribute","add","addEventListener","play","pause","SRC","getAttribute","canPlayType","src","addClassAndPlay","Hls","HLS_SCRIPT","createElement","head","appendChild","setTimeout","loadHls","elements","current","forEach","remove","isSupported","HLS","loadSource","attachMedia","triggerEvent","options","event","window","CustomEvent","detail","createEvent","initCustomEvent","dispatchEvent","target","matches","selector","matchesSelector","msMatchesSelector","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","call","addEvent","documentElement","ELEMENT","ancestor","parentElement","nodeType","closest","getAriaLabel","node","SOURCE","type","style","querySelector","_this","this","preventDefault","title","HTML_ELEMENT","BODY_ELEMENT","body","BASE_CLASS","LIGHTBOX_CLASS","ID","VISIBLE_CLASS","VISIBLE_CLASS_LIST","INNER_CLASS","CLOSE_CLASS","CONTENT_CLASS","LIGHTBOX","className","innerHTML","lighboxContent","timeout","resetContent","removeAttribute","get","paddingTop","getElementById","_typeof","item","show","clearTimeout","closeLighbox","stopImmediatePropagation","keyCode","lightbox","video","VIDEO_NODE","cloneNode","dataset","controls","children","markup","DATA","FULLSCREEN","fs","embed","getImage","IMAGE","getPaddingTop","fallback","ratio","RATIO","parseInt","naturalHeight","naturalWidth","write","link","playClass","checkGdpr","IFRAME","tagName","ORIGINAL_ELEMENT","ORIGINAL_TAG","START_RX","RegExp","END_RX","START_SUBST","END_SUBST","WRAPPER","outerHTML","replace","NEW_ELEMENT","firstChild","replaceChild","GDPR","gdpr","console","log","LOCAL_STORAGE","localStorage","STORAGE_KEY","confirm","lightboxHelper","HTML","PADDING_TOP","SELECTOR","fixPreview","img","indexOf","onload","images","i","fixPreviews"],"mappings":";;;;;;yBAAA,IAAMA,EAAO,uBACPC,EAAgBD,GAAAA,OAAAA,EAAtB,UACME,EAAgBF,GAAAA,OAAAA,EAAtB,UACMG,EAAgBH,GAAAA,OAAAA,EAAtB,UAEMI,EAASC,MAAMC,KAAKC,SAASC,iBAAT,IAAAC,OAA8BT,EAA9B,mCACpBU,EAASL,MAAMC,KAAKC,SAASC,iBAAT,IAAAC,OAA8BT,EAA9B,mCACpBW,EAAW,GAAGF,OAAOL,EAAQM,GAEnC,SAASE,EAAKC,GAASC,IAAAA,6DAAiBC,EAAUC,UAAAC,OAAA,EAAAD,UAAA,QAAAE,EACxCC,EAAaN,EAAQO,WAAWC,UACtC,IAAIF,EAAWG,SAASrB,GAyBxB,GArBu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