diff --git a/public/assets/contao-video-bundle.js b/public/assets/contao-video-bundle.js new file mode 100644 index 0000000..a14bf16 --- /dev/null +++ b/public/assets/contao-video-bundle.js @@ -0,0 +1 @@ +!function(e){function t(t){for(var i,a,l=t[0],c=t[1],s=t[2],d=0,v=[];d1&&void 0!==arguments[1]?arguments[1]:"video";o(this,e),l(this,"configuration",void 0),l(this,"previewImageElement",void 0),l(this,"privacyMode",void 0),l(this,"videoContainerElement",void 0),l(this,"wrapperElement",void 0),l(this,"type",void 0),this.wrapperElement=t,this.type=n,this.configuration=this.wrapperElement.dataset,this.privacyMode="privacyMode"in this.configuration,"link"!==n?(this.previewImageElement=this.wrapperElement.querySelector(".video-wrapper .video-thumbnail"),this.videoContainerElement=this.wrapperElement.querySelector(".video-wrapper .video-container"),this.applyPrivacySettingsToVideo(),"toggleVideo"in this.configuration&&this.videoToggle()):this.applyPrivacySettingsToLink()}var t,n,i;return t=e,(n=[{key:"applyPrivacySettingsToVideo",value:function(){var t=this;if(this.privacyMode){if(this.videoContainerElement&&this.videoContainerElement.querySelector(":scope > video"))return void this.showVideo();localStorage.getItem(e.privacyKey)&&this.showVideo(),this.previewImageElement&&this.previewImageElement.addEventListener("click",(function(){return t.privacyDialog(t.previewImageElement,(function(){return t.showVideo()}))}))}else this.showVideo()}},{key:"applyPrivacySettingsToLink",value:function(){var e=this;this.wrapperElement.addEventListener("click",(function(t){t.preventDefault(),e.privacyMode&&e.privacyDialog(e.wrapperElement,(function(e){return window.open(e.getAttribute("href"))}))}))}},{key:"privacyDialog",value:function(t,n){var i=r.a.confirm().set({labels:this.privacyDialogLabels(),onshow:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))},defaultFocusOff:!0,onfocus:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}}),o=null;if("privacyModalContent"in this.configuration)o=this.configuration.privacyModalContent;else{if(!this.previewImageElement||!("privacyHtml"in this.previewImageElement.dataset))return;o=this.previewImageElement.dataset.privacyHtml.replace(/\\"/g,'"')}t||(t=this.previewImageElement,this.previewImageElement||(t=this.wrapperElement)),r.a.confirm(" ",o,(function(){i.elements.content.querySelector("[name="+e.storeDecisionFieldName+"]").checked&&localStorage.setItem(e.privacyKey,!0),t.dispatchEvent(new CustomEvent("huh.video.privacy.accept",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),n(t)}),(function(){t.dispatchEvent(new CustomEvent("huh.video.privacy.cancel",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}))}},{key:"privacyDialogLabels",value:function(){var e={ok:"Ok",cancel:"Cancel"};return"btnLabelOk"in this.wrapperElement.dataset?e.ok=this.wrapperElement.dataset.btnLabelOk:this.previewImageElement&&"btnPrivacyOk"in this.previewImageElement.dataset&&(e.ok=this.previewImageElement.dataset.btnPrivacyOk),"btnLabelOk"in this.wrapperElement.dataset?e.cancel=this.wrapperElement.dataset.btnLabelCancel:this.previewImageElement&&"btnPrivacyCancel"in this.previewImageElement.dataset&&(e.cancel=this.previewImageElement.dataset.btnPrivacyCancel),e}},{key:"showVideo",value:function(){if("element"in this.wrapperElement.dataset){if(this.videoContainerElement)this.videoContainerElement.innerHTML="";else{this.videoContainerElement=document.createElement("div"),this.videoContainerElement.classList.add(["video-container"]);var e=this.wrapperElement.querySelector(".video-wrapper");if(!e)return!1;e.appendChild(this.videoContainerElement)}var t=JSON.parse(this.wrapperElement.dataset.element),n=document.createElement(t.type);Object.entries(t.attributes).forEach((function(e){n.setAttribute(e[0],e[1])})),this.videoContainerElement.appendChild(n)}else{if(!this.videoContainerElement)return!1;var i=this.videoContainerElement.querySelectorAll("iframe");if(i.length>0)i.forEach((function(e){e.src=e.dataset.src,document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}));else{var r=this.videoContainerElement.querySelectorAll(":scope > video");if(r.length<1)return!1;r.forEach((function(e){document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}))}}return this.videoContainerElement.classList.remove("video-hidden"),this.previewImageElement&&(this.previewImageElement.style="display:none;"),!0}},{key:"videoToggle",value:function(){var e=this,t=[!0,!0],n=this.wrapperElement.querySelectorAll(".huh_video .video-toggle-ctn button"),i=this.wrapperElement.querySelector("#videoToggleLiveRegionOutput"),r=function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t.slice(0);a[r]=!1,n.length>0&&(a.forEach((function(t,i){var r=e.wrapperElement.querySelector("#"+n[i].getAttribute("aria-controls"));if(t){n[i].classList.add("btn-video-show"),r.style.display="none";var o=r.querySelector("iframe");null!==o&&o.setAttribute("src",o.src)}else n[i].classList.remove("btn-video-show"),r.style.display="block"})),o&&(i.textContent=r?"Audiodeskription steht im folgenden Video nicht mehr zur Verfügung":"Audiodeskription steht im folgenden Video zur Verfügung"))};n.length>0&&(n.forEach((function(e,t){e.addEventListener("click",(function(e){r(t,!0)}))})),r(1))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();l(c,"privacyKey","huh_video_privacy"),l(c,"storeDecisionFieldName","video-save-privacy"),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".huh_video").forEach((function(e){return new c(e)})),document.querySelectorAll(".huh_video.video-link").forEach((function(e){new c(e,"link")}))})),document.addEventListener("afterUnlockProtectedCode",(function(e){var t=document.querySelector('[data-identifier="'+e.detail.identifier+'"] .huh_video');if(null!==t&&(new c(t),e.detail.unlockByClick)){var n=t.querySelector(".video-toggle-ctn button");n?n.focus():t.querySelector('[tabindex="0"]').focus()}}))}}); \ No newline at end of file diff --git a/src/Resources/public/assets/contao-video-bundle.js b/src/Resources/public/assets/contao-video-bundle.js index 0d356d8..eed72c7 100644 --- a/src/Resources/public/assets/contao-video-bundle.js +++ b/src/Resources/public/assets/contao-video-bundle.js @@ -1 +1 @@ -!function(e){function t(t){for(var i,a,l=t[0],c=t[1],s=t[2],d=0,v=[];d1&&void 0!==arguments[1]?arguments[1]:"video";o(this,e),l(this,"configuration",void 0),l(this,"previewImageElement",void 0),l(this,"privacyMode",void 0),l(this,"videoContainerElement",void 0),l(this,"wrapperElement",void 0),l(this,"type",void 0),this.wrapperElement=t,this.type=n,this.configuration=this.wrapperElement.dataset,this.privacyMode="privacyMode"in this.configuration,"link"!==n?(this.previewImageElement=this.wrapperElement.querySelector(".video-wrapper .video-thumbnail"),this.videoContainerElement=this.wrapperElement.querySelector(".video-wrapper .video-container"),this.legacyPrivacyCheck(),this.applyPrivacySettingsToVideo(),"toggleVideo"in this.configuration&&this.videoToggle()):this.applyPrivacySettingsToLink()}var t,n,i;return t=e,(n=[{key:"applyPrivacySettingsToVideo",value:function(){var t=this;if(this.privacyMode){if(this.videoContainerElement&&this.videoContainerElement.querySelector(":scope > video"))return void this.showVideo();localStorage.getItem(e.privacyKey)&&this.showVideo(),this.previewImageElement&&this.previewImageElement.addEventListener("click",(function(){return t.privacyDialog(t.previewImageElement,(function(){return t.showVideo()}))}))}else this.showVideo()}},{key:"applyPrivacySettingsToLink",value:function(){var e=this;this.privacyMode||"privacy"in this.configuration&&(this.privacyMode=!0,console.warn("You're using an outdated video fullsize template. Please adjust your template according to the docs. Since version 1.2.0")),this.wrapperElement.addEventListener("click",(function(t){t.preventDefault(),e.privacyMode&&e.privacyDialog(e.wrapperElement,(function(e){return window.open(e.getAttribute("href"))}))}))}},{key:"privacyDialog",value:function(t,n){var i=r.a.confirm().set({labels:this.privacyDialogLabels(),onshow:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))},defaultFocusOff:!0,onfocus:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}}),o=null;if("privacyModalContent"in this.configuration)o=this.configuration.privacyModalContent;else{if(!this.previewImageElement||!("privacyHtml"in this.previewImageElement.dataset))return;o=this.previewImageElement.dataset.privacyHtml.replace(/\\"/g,'"')}t||(t=this.previewImageElement,this.previewImageElement||(t=this.wrapperElement)),r.a.confirm(" ",o,(function(){i.elements.content.querySelector("[name="+e.storeDecisionFieldName+"]").checked&&localStorage.setItem(e.privacyKey,!0),t.dispatchEvent(new CustomEvent("huh.video.privacy.accept",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),n(t)}),(function(){t.dispatchEvent(new CustomEvent("huh.video.privacy.cancel",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}))}},{key:"privacyDialogLabels",value:function(){var e={ok:"Ok",cancel:"Cancel"};return"btnLabelOk"in this.wrapperElement.dataset?e.ok=this.wrapperElement.dataset.btnLabelOk:this.previewImageElement&&"btnPrivacyOk"in this.previewImageElement.dataset&&(e.ok=this.previewImageElement.dataset.btnPrivacyOk),"btnLabelOk"in this.wrapperElement.dataset?e.cancel=this.wrapperElement.dataset.btnLabelCancel:this.previewImageElement&&"btnPrivacyCancel"in this.previewImageElement.dataset&&(e.cancel=this.previewImageElement.dataset.btnPrivacyCancel),e}},{key:"showVideo",value:function(){if("element"in this.wrapperElement.dataset){if(this.videoContainerElement)this.videoContainerElement.innerHTML="";else{this.videoContainerElement=document.createElement("div"),this.videoContainerElement.classList.add(["video-container"]);var e=this.wrapperElement.querySelector(".video-wrapper");if(!e)return!1;e.appendChild(this.videoContainerElement)}var t=JSON.parse(this.wrapperElement.dataset.element),n=document.createElement(t.type);Object.entries(t.attributes).forEach((function(e){n.setAttribute(e[0],e[1])})),this.videoContainerElement.appendChild(n)}else{if(!this.videoContainerElement)return!1;var i=this.videoContainerElement.querySelectorAll("iframe");if(i.length>0)i.forEach((function(e){e.src=e.dataset.src,document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}));else{var r=this.videoContainerElement.querySelectorAll(":scope > video");if(r.length<1)return!1;r.forEach((function(e){document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}))}}return this.videoContainerElement.classList.remove("video-hidden"),this.previewImageElement&&(this.previewImageElement.style="display:none;"),!0}},{key:"videoToggle",value:function(){var e=this,t=[!0,!0],n=this.wrapperElement.querySelectorAll(".huh_video .video-toggle-ctn button"),i=this.wrapperElement.querySelector("#videoToggleLiveRegionOutput"),r=function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t.slice(0);a[r]=!1,n.length>0&&(a.forEach((function(t,i){var r=e.wrapperElement.querySelector("#"+n[i].getAttribute("aria-controls"));if(t){n[i].classList.add("btn-video-show"),r.style.display="none";var o=r.querySelector("iframe");null!==o&&o.setAttribute("src",o.src)}else n[i].classList.remove("btn-video-show"),r.style.display="block"})),o&&(i.textContent=r?"Audiodeskription steht im folgenden Video nicht mehr zur Verfügung":"Audiodeskription steht im folgenden Video zur Verfügung"))};n.length>0&&(n.forEach((function(e,t){e.addEventListener("click",(function(e){r(t,!0)}))})),r(1))}},{key:"legacyPrivacyCheck",value:function(){!this.privacyMode&&this.previewImageElement&&"privacy"in this.previewImageElement.dataset&&(this.privacyMode=!0,console.warn("You're using an outdated video templates. Please adjust your template according to the docs. Since version 1.2.0"))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();l(c,"privacyKey","huh_video_privacy"),l(c,"storeDecisionFieldName","video-save-privacy"),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".huh_video").forEach((function(e){return new c(e)})),document.querySelectorAll(".huh_video.video-link").forEach((function(e){new c(e,"link")}))})),document.addEventListener("afterUnlockProtectedCode",(function(e){var t=document.querySelector('[data-identifier="'+e.detail.identifier+'"] .huh_video');if(null!==t&&(new c(t),e.detail.unlockByClick)){var n=t.querySelector(".video-toggle-ctn button");n?n.focus():t.querySelector('[tabindex="0"]').focus()}}))}}); \ No newline at end of file +!function(e){function t(t){for(var i,a,l=t[0],c=t[1],s=t[2],d=0,v=[];d1&&void 0!==arguments[1]?arguments[1]:"video";o(this,e),l(this,"configuration",void 0),l(this,"previewImageElement",void 0),l(this,"privacyMode",void 0),l(this,"videoContainerElement",void 0),l(this,"wrapperElement",void 0),l(this,"type",void 0),this.wrapperElement=t,this.type=n,this.configuration=this.wrapperElement.dataset,this.privacyMode="privacyMode"in this.configuration,"link"!==n?(this.previewImageElement=this.wrapperElement.querySelector(".video-wrapper .video-thumbnail"),this.videoContainerElement=this.wrapperElement.querySelector(".video-wrapper .video-container"),this.applyPrivacySettingsToVideo(),"toggleVideo"in this.configuration&&this.videoToggle()):this.applyPrivacySettingsToLink()}var t,n,i;return t=e,(n=[{key:"applyPrivacySettingsToVideo",value:function(){var t=this;if(this.privacyMode){if(this.videoContainerElement&&this.videoContainerElement.querySelector(":scope > video"))return void this.showVideo();localStorage.getItem(e.privacyKey)&&this.showVideo(),this.previewImageElement&&this.previewImageElement.addEventListener("click",(function(){return t.privacyDialog(t.previewImageElement,(function(){return t.showVideo()}))}))}else this.showVideo()}},{key:"applyPrivacySettingsToLink",value:function(){var e=this;this.privacyMode||"privacy"in this.configuration&&(this.privacyMode=!0,console.warn("You're using an outdated video fullsize template. Please adjust your template according to the docs. Since version 1.2.0")),this.wrapperElement.addEventListener("click",(function(t){t.preventDefault(),e.privacyMode&&e.privacyDialog(e.wrapperElement,(function(e){return window.open(e.getAttribute("href"))}))}))}},{key:"privacyDialog",value:function(t,n){var i=r.a.confirm().set({labels:this.privacyDialogLabels(),onshow:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onshow",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))},defaultFocusOff:!0,onfocus:function(){document.dispatchEvent(new CustomEvent("huh.video.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),document.dispatchEvent(new CustomEvent("huh.video.event.alertify.onfocus",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}}),o=null;if("privacyModalContent"in this.configuration)o=this.configuration.privacyModalContent;else{if(!this.previewImageElement||!("privacyHtml"in this.previewImageElement.dataset))return;o=this.previewImageElement.dataset.privacyHtml.replace(/\\"/g,'"')}t||(t=this.previewImageElement,this.previewImageElement||(t=this.wrapperElement)),r.a.confirm(" ",o,(function(){i.elements.content.querySelector("[name="+e.storeDecisionFieldName+"]").checked&&localStorage.setItem(e.privacyKey,!0),t.dispatchEvent(new CustomEvent("huh.video.privacy.accept",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}})),n(t)}),(function(){t.dispatchEvent(new CustomEvent("huh.video.privacy.cancel",{bubbles:!0,cancelable:!0,detail:{elements:i.elements}}))}))}},{key:"privacyDialogLabels",value:function(){var e={ok:"Ok",cancel:"Cancel"};return"btnLabelOk"in this.wrapperElement.dataset?e.ok=this.wrapperElement.dataset.btnLabelOk:this.previewImageElement&&"btnPrivacyOk"in this.previewImageElement.dataset&&(e.ok=this.previewImageElement.dataset.btnPrivacyOk),"btnLabelOk"in this.wrapperElement.dataset?e.cancel=this.wrapperElement.dataset.btnLabelCancel:this.previewImageElement&&"btnPrivacyCancel"in this.previewImageElement.dataset&&(e.cancel=this.previewImageElement.dataset.btnPrivacyCancel),e}},{key:"showVideo",value:function(){if("element"in this.wrapperElement.dataset){if(this.videoContainerElement)this.videoContainerElement.innerHTML="";else{this.videoContainerElement=document.createElement("div"),this.videoContainerElement.classList.add(["video-container"]);var e=this.wrapperElement.querySelector(".video-wrapper");if(!e)return!1;e.appendChild(this.videoContainerElement)}var t=JSON.parse(this.wrapperElement.dataset.element),n=document.createElement(t.type);Object.entries(t.attributes).forEach((function(e){n.setAttribute(e[0],e[1])})),this.videoContainerElement.appendChild(n)}else{if(!this.videoContainerElement)return!1;var i=this.videoContainerElement.querySelectorAll("iframe");if(i.length>0)i.forEach((function(e){e.src=e.dataset.src,document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}));else{var r=this.videoContainerElement.querySelectorAll(":scope > video");if(r.length<1)return!1;r.forEach((function(e){document.dispatchEvent(new CustomEvent("videoInitialized",{detail:e,bubbles:!0,cancelable:!0}))}))}}return this.videoContainerElement.classList.remove("video-hidden"),this.previewImageElement&&(this.previewImageElement.style="display:none;"),!0}},{key:"videoToggle",value:function(){var e=this,t=[!0,!0],n=this.wrapperElement.querySelectorAll(".huh_video .video-toggle-ctn button"),i=this.wrapperElement.querySelector("#videoToggleLiveRegionOutput"),r=function(r){var o=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=t.slice(0);a[r]=!1,n.length>0&&(a.forEach((function(t,i){var r=e.wrapperElement.querySelector("#"+n[i].getAttribute("aria-controls"));if(t){n[i].classList.add("btn-video-show"),r.style.display="none";var o=r.querySelector("iframe");null!==o&&o.setAttribute("src",o.src)}else n[i].classList.remove("btn-video-show"),r.style.display="block"})),o&&(i.textContent=r?"Audiodeskription steht im folgenden Video nicht mehr zur Verfügung":"Audiodeskription steht im folgenden Video zur Verfügung"))};n.length>0&&(n.forEach((function(e,t){e.addEventListener("click",(function(e){r(t,!0)}))})),r(1))}},{key:"legacyPrivacyCheck",value:function(){!this.privacyMode&&this.previewImageElement&&"privacy"in this.previewImageElement.dataset&&(this.privacyMode=!0,console.warn("You're using an outdated video templates. Please adjust your template according to the docs. Since version 1.2.0"))}}])&&a(t.prototype,n),i&&a(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();l(c,"privacyKey","huh_video_privacy"),l(c,"storeDecisionFieldName","video-save-privacy"),document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".huh_video").forEach((function(e){return new c(e)})),document.querySelectorAll(".huh_video.video-link").forEach((function(e){new c(e,"link")}))})),document.addEventListener("afterUnlockProtectedCode",(function(e){var t=document.querySelector('[data-identifier="'+e.detail.identifier+'"] .huh_video');if(null!==t&&(new c(t),e.detail.unlockByClick)){var n=t.querySelector(".video-toggle-ctn button");n?n.focus():t.querySelector('[tabindex="0"]').focus()}}))}}); \ No newline at end of file