2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
|
!function(){if("function"!=typeof window.CustomEvent){const e=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};const r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r};e.prototype=window.Event.prototype,window.CustomEvent=e}function e(t){const r=['a[href]:not([tabindex^="-"]):not([inert])','area[href]:not([tabindex^="-"]):not([inert])',"input:not([disabled]):not([inert])","select:not([disabled]):not([inert])","textarea:not([disabled]):not([inert])","button:not([disabled]):not([inert])",'iframe:not([tabindex^="-"]):not([inert])','audio:not([tabindex^="-"]):not([inert])','video:not([tabindex^="-"]):not([inert])','[contenteditable]:not([tabindex^="-"]):not([inert])','[tabindex]:not([tabindex^="-"]):not([inert])'],i=[],n={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0},o=[];let a={},s=0,d=null,l=null,u=null,c=null,p=null,b={},m=!1,h=!1,g=!1,f=null,v=null,y=null,w=!1,x=!1,E=0,A={},L=null,_=null;const C={image:{checkSupport:e=>!e.hasAttribute("data-type")&&e.href.match(/\.(png|jpe?g|tiff|tif|gif|bmp|webp|avif|svg|ico)(\?.*)?$/i),init(e,t){const r=document.createElement("figure"),i=document.createElement("figcaption"),n=document.createElement("img"),o=e.querySelector("img"),d=document.createElement("div");r.style.opacity="0",o&&(n.alt=o.alt||""),n.setAttribute("src",""),n.setAttribute("data-src",e.href),r.appendChild(n),a.captions&&("function"==typeof a.captionText?i.textContent=a.captionText(e):"self"===a.captionsSelector&&e.getAttribute(a.captionAttribute)?i.textContent=e.getAttribute(a.captionAttribute):"img"===a.captionsSelector&&o&&o.getAttribute(a.captionAttribute)&&(i.textContent=o.getAttribute(a.captionAttribute)),i.textContent&&(i.id=`tobii-figcaption-${s}`,r.appendChild(i),n.setAttribute("aria-labelledby",i.id),++s)),t.appendChild(r),d.className="tobii__loader",d.setAttribute("role","progressbar"),d.setAttribute("aria-label",a.loadingIndicatorLabel),t.appendChild(d),t.setAttribute("data-type","image")},onPreload(e){C.image.onLoad(e)},onLoad(e){const t=e.querySelector("img");if(!t.hasAttribute("data-src"))return;const r=e.querySelector("figure"),i=e.querySelector(".tobii__loader");t.onload=()=>{e.removeChild(i),r.style.opacity="1"},t.setAttribute("src",t.getAttribute("data-src")),t.removeAttribute("data-src")},onLeave(e){},onCleanup(e){}},html:{checkSupport:e=>ne(e,"html"),init(e,t){const r=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-target"),i=document.querySelector(r);if(!i)throw new Error(`Ups, I can't find the target ${r}.`);t.appendChild(i),t.setAttribute("data-type","html")},onPreload(e){},onLoad(e){const t=e.querySelector("video");t&&(t.hasAttribute("data-time")&&t.readyState>0&&(t.currentTime=t.getAttribute("data-time")),a.autoplayVideo&&t.play())},onLeave(e){const t=e.querySelector("video");t&&(t.paused||t.pause(),t.readyState>0&&t.setAttribute("data-time",t.currentTime))},onCleanup(e){const t=e.querySelector("video");if(t&&t.readyState>0&&t.readyState<3&&t.duration!==t.currentTime){const r=t.cloneNode(!0);oe(t),t.load(),t.parentNode.removeChild(t),e.appendChild(r)}}},iframe:{checkSupport:e=>ne(e,"iframe"),init(e,t){const r=document.createElement("iframe"),i=e.hasAttribute("href")?e.getAttribute("href"):e.getAttribute("data-target");r.setAttribute("frameborder","0"),r.setAttribute("src",""),r.setAttribute("data-src",i),e.getAttribute("data-width")&&(r.style.maxWidth=`${e.getAttribute("data-width")}px`),e.getAttribute("data-height")&&(r.style.maxHeight=`${e.getAttribute("data-height")}px`),t.appendChild(r),t.setAttribute("data-type","iframe")},onPreload(e){},onLoad(e){const t=e.querySelector("iframe");t.setAttribute("src",t.getAttribute("data-src"))},onLeave(e){},onCleanup(e){}},youtube:{checkSupport:e=>ne(e,"youtube"),init(e,t){const r=document.createElement("div");t.appendChild(r),o[E]=new window.YT.Player(r,{host:"https://www.youtube-nocookie.com",height:e.getAttribute("data-height")||"360",width:e.getAttribute("data-width")||"640",videoId:e.getAttribute("data-id"),playerVars:{controls:e.getAttr
|