mirror of
https://github.com/godotengine/godot-website.git
synced 2025-12-31 09:48:43 +03:00
2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
!function(){if("function"!=typeof window.CustomEvent){var t=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};t.prototype=window.Event.prototype,window.CustomEvent=t}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)({}).hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},e.apply(null,arguments)}window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=function(t,e){e=e||window;for(var i=0;i<this.length;i++)t.call(e,this[i],i,this)});var i=/*#__PURE__*/function(){function t(){this.figcaptionId=0,this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){var n=this;this.userSettings=i;var r,a=document.createElement("figure"),o=document.createElement("img"),s=t.querySelector("img"),l=document.createElement("div");if(a.tabIndex=-1,a.setAttribute("role","group"),a.style.opacity="0",s&&(o.alt=s.alt||""),o.setAttribute("data-src",t.href),t.hasAttribute("data-srcset")&&o.setAttribute("data-srcset",t.getAttribute("data-srcset")),t.hasAttribute("data-sizes")&&o.setAttribute("data-sizes",t.getAttribute("data-sizes")),a.appendChild(o),"function"==typeof this.userSettings.captionText?r=this.userSettings.captionText(t):"self"===this.userSettings.captionsSelector&&t.getAttribute(this.userSettings.captionAttribute)?r=t.getAttribute(this.userSettings.captionAttribute):"img"===this.userSettings.captionsSelector&&s&&s.getAttribute(this.userSettings.captionAttribute)&&(r=s.getAttribute(this.userSettings.captionAttribute)),this.userSettings.captions&&r){var d=document.createElement("figcaption");d.id="tobii-figcaption-"+this.figcaptionId;var u=document.createElement("span");if(this.userSettings.captionHTML?u.innerHTML=r:u.textContent=r,d.appendChild(u),this.userSettings.captionToggle){var c=document.createElement("button");c.className="caption-toggle",c.textContent=c.title=this.userSettings.captionToggleLabel[0],c.setAttribute("aria-controls",d.id),c.setAttribute("aria-expanded",!0);var p=function(t){t.preventDefault(),t.stopPropagation()};c.addEventListener("pointerdown",function(t){return p(t)}),c.addEventListener("pointerup",function(t){return p(t)}),c.addEventListener("click",function(t){p(t);var e="true"===c.getAttribute("aria-expanded");c.textContent=c.title=e?n.userSettings.captionToggleLabel[1]:n.userSettings.captionToggleLabel[0],c.setAttribute("aria-expanded",!e),u.setAttribute("aria-hidden",e)}),d.appendChild(c)}a.appendChild(d),o.setAttribute("aria-labelledby",d.id),a.setAttribute("aria-label",u.textContent),++this.figcaptionId}e.appendChild(a),l.className="tobii__loader",l.setAttribute("role","progressbar"),l.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),e.appendChild(l),e.setAttribute("data-type","image"),e.classList.add("tobii-image")},e.onPreload=function(t){this.onLoad(t)},e.onLoad=function(t){var e=t.querySelector("img");if(e.hasAttribute("data-src")){var i=t.querySelector("figure"),n=t.querySelector(".tobii__loader"),r=function(){t.removeChild(n),i.style.opacity="1"};e.addEventListener("load",r),e.addEventListener("error",r),e.hasAttribute("data-srcset")&&(e.setAttribute("srcset",e.getAttribute("data-srcset")),e.removeAttribute("data-srcset")),e.hasAttribute("data-sizes")&&(e.setAttribute("sizes",e.getAttribute("data-sizes")),e.removeAttribute("data-sizes")),e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("data-src")}},e.onLeave=function(t){},e.onCleanup=function(t){},e.onReset=function(){this.figcaptionId=0},t}(),n=/*#__PURE__*/function(){function t(){this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=t.hasAttribute("data-target")?t.getAttribute("data-target"):t.getAttribute("href");e.setAttribute("data-HREF",n),t.getAttribute("data-allow")&&e.setAttribute("data-allow",t.getAttribute("data-allow")),t.hasAttribute("data-width")&&e.setAttribute("data-width",""+t.getAttribute("data-width")),t.hasAttribute("data-height")&&e.setAttribute("data-height",""+t.getAttribute("data-height")),e.setAttribute("data-type","iframe"),e.classList.add("tobii-iframe")},e.onPreload=function(t){},e.onLoad=function(t){var e=t.querySelector("iframe"),i=document.createElement("div");if(i.className="tobii__loader",i.setAttribute("role","progressbar"),i.setAttribute("aria-label",this.userSettings.loadingIndicatorLabel),t.appendChild(i),null==e){e=document.createElement("iframe");var n=t.getAttribute("data-href");e.setAttribute("frameborder","0"),e.setAttribute("src",n),e.setAttribute("allowfullscreen",""),n.indexOf("youtube.com")>-1?e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"):n.indexOf("vimeo.com")>-1?e.setAttribute("allow","autoplay; picture-in-picture"):t.hasAttribute("data-allow")&&e.setAttribute("allow",t.getAttribute("data-allow")),t.getAttribute("data-width")&&(e.style.maxWidth=""+t.getAttribute("data-width")),t.getAttribute("data-height")&&(e.style.maxHeight=""+t.getAttribute("data-height")),e.style.opacity="0",t.appendChild(e),e.addEventListener("load",function(){e.style.opacity="1";var i=t.querySelector(".tobii__loader");i&&t.removeChild(i)}),e.addEventListener("error",function(){e.style.opacity="1";var i=t.querySelector(".tobii__loader");i&&t.removeChild(i)})}else e.setAttribute("src",t.getAttribute("data-href"))},e.onLeave=function(t){},e.onCleanup=function(t){var e=t.querySelector("iframe");e.setAttribute("src",""),e.style.opacity="0"},e.onReset=function(){},t}(),r=/*#__PURE__*/function(){function t(){this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=t.hasAttribute("data-target")?t.getAttribute("data-target"):t.getAttribute("href"),r=document.querySelector(n).cloneNode(!0);if(!r)throw new Error("Ups, I can't find the target "+n+".");e.appendChild(r),e.setAttribute("data-type","html"),e.classList.add("tobii-html")},e.onPreload=function(t){},e.onLoad=function(t,e){var i=t.querySelector("video");i&&(i.hasAttribute("data-time")&&i.readyState>0&&(i.currentTime=i.getAttribute("data-time")),this.userSettings.autoplayVideo&&i.play());var n=t.querySelector("audio");n&&this.userSettings.autoplayAudio&&n.play(),t.classList.add("tobii-group-"+e)},e.onLeave=function(t){var e=t.querySelector("video");e&&(e.paused||e.pause(),e.readyState>0&&e.setAttribute("data-time",e.currentTime));var i=t.querySelector("audio");i&&(i.paused||i.pause())},e.onCleanup=function(t){var e=t.querySelector("video");if(e&&e.readyState>0&&e.readyState<3&&e.duration!==e.currentTime){var i=e.cloneNode(!0);this._removeSources(e),e.load(),e.parentNode.removeChild(e),t.appendChild(i)}},e.onReset=function(){},e._removeSources=function(t){var e=t.querySelectorAll("src");e&&e.forEach(function(t){t.setAttribute("src","")})},t}(),a=/*#__PURE__*/function(){function t(){this.playerId=0,this.PLAYER=[],this.userSettings=null}var e=t.prototype;return e.init=function(t,e,i){this.userSettings=i;var n=document.createElement("div");e.appendChild(n),this.PLAYER[this.playerId]=new window.YT.Player(n,{host:"https://www.youtube-nocookie.com",height:t.getAttribute("data-height")||"360",width:t.getAttribute("data-width")||"640",videoId:t.getAttribute("data-id"),playerVars:{controls:t.getAttribute("data-controls")||1,rel:0,playsinline:1}}),e.setAttribute("data-player",this.playerId),e.setAttribute("data-type","youtube"),e.classList.add("tobii-youtube"),this.playerId++},e.onPreload=function(t){},e.onLoad=function(t){this.userSettings.autoplayVideo&&this.PLAYER[t.getAttribute("data-player")].playVideo()},e.onLeave=function(t){1===this.PLAYER[t.getAttribute("data-player")].getPlayerState()&&this.PLAYER[t.getAttribute("data-player")].pauseVideo()},e.onCleanup=function(t){1===this.PLAYER[t.getAttribute("data-player")].getPlayerState()&&this.PLAYER[t.getAttribute("data-player")].pauseVideo()},e.onReset=function(){},t}();function o(t){var s={image:new i,html:new r,iframe:new n,youtube:new a},l=['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])'],d={},u=[],c={gallery:[],slider:null,sliderElements:[],elementsLength:0,currentIndex:0,x:0},p=null,f=null,b=null,h=null,g=null,m=null,v=null,y=!1,w={},A=null,x=[],E=0,L={element:null,originX:0,originY:0,translateX:0,translateY:0,scale:1},I={startX:0,startY:0,x:0,y:0,distance:0},S=function(t){if(null===document.querySelector('[data-type="youtube"]')||y)C(t);else{if(null===document.getElementById("iframe_api")){var e=document.createElement("script"),i=document.getElementsByTagName("script")[0];e.id="iframe_api",e.src="https://www.youtube.com/iframe_api",i.parentNode.insertBefore(e,i)}-1===u.indexOf(t)&&u.push(t),window.onYouTubePlayerAPIReady=function(){u.forEach(function(t){C(t)}),y=!0}}},_=function(t){return t.hasAttribute("data-group")?t.getAttribute("data-group"):"default"},C=function(t){var e=_(t);if(Object.prototype.hasOwnProperty.call(w,e)||(w[e]=JSON.parse(JSON.stringify(c)),w[e].slider=document.createElement("div"),w[e].slider.className="tobii__slider",w[e].slider.setAttribute("aria-hidden","true"),p.appendChild(w[e].slider)),-1!==w[e].gallery.indexOf(t))throw new Error("Ups, element already added.");if(w[e].gallery.push(t),w[e].elementsLength++,d.zoom&&t.querySelector("img")&&"false"!==t.getAttribute("data-zoom")||"true"===t.getAttribute("data-zoom")){var i=document.createElement("div");i.className="tobii-zoom__icon",i.innerHTML=d.zoomText,t.classList.add("tobii-zoom"),t.appendChild(i)}t.addEventListener("click",D);var n=document.createElement("div"),r=document.createElement("div");n.className="tobii__slide",n.style.position="absolute",n.style.left=100*w[e].x+"%",n.setAttribute("aria-hidden","true"),Y(t).init(t,r,d),n.appendChild(r),w[e].slider.appendChild(n),w[e].sliderElements.push(n),++w[e].x,ut()&&e===A&&(st(),lt())},T=function(t){var e=_(t);if(-1===w[e].gallery.indexOf(t))throw new Error("Ups, I can't find a slide for the element "+t+".");var i=w[e].gallery.indexOf(t),n=w[e].sliderElements[i];if(ut()&&e===A&&i===w[e].currentIndex){if(1===w[e].elementsLength)throw X(),new Error("Ups, I've closed. There are no slides more to show.");0===w[e].currentIndex?z():P(),st(),lt()}if(w[e].gallery.splice(w[e].gallery.indexOf(t)),w[e].sliderElements.splice(w[e].gallery.indexOf(t)),w[e].elementsLength--,--w[e].x,d.zoom&&t.querySelector(".tobii-zoom__icon")){var r=t.querySelector(".tobii-zoom__icon");r.parentNode.classList.remove("tobii-zoom"),r.parentNode.removeChild(r)}t.removeEventListener("click",D),n.parentNode.removeChild(n)},Y=function(t){var e=t.getAttribute("data-type");return void 0!==s[e]?s[e]:(t.hasAttribute("data-type")&&console.log("Unknown lightbox element type: "+e),s.image)},N=function(t){if(void 0===t&&(t=0),ut())throw new Error("Ups, I'm aleady open.");if(-1===t||t>=w[A].elementsLength)throw new Error("Ups, I can't find slide "+t+".");document.documentElement.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open"),document.body.classList.add("tobii-is-open-"+A),st(),d.close||(h.disabled=!1,h.setAttribute("aria-hidden","true")),m=document.activeElement;var e=window.location.href;window.history.pushState({tobii:"close"},"Image",e),w[A].currentIndex=t,at(),M(w[A].currentIndex),w[A].slider.setAttribute("aria-hidden","false"),p.setAttribute("aria-hidden","false"),lt(),q(w[A].currentIndex+1),q(w[A].currentIndex-1),w[A].slider.classList.add("tobii__slider--animate");var i=new window.CustomEvent("open",{detail:{group:A}});p.dispatchEvent(i)},X=function(){if(!ut())throw new Error("Ups, I'm already closed.");document.documentElement.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open"),document.body.classList.remove("tobii-is-open-"+A),ot(),null!==window.history.state&&"close"===window.history.state.tobii&&window.history.back(),m.focus(),k(w[A].currentIndex),R(w[A].currentIndex),p.setAttribute("aria-hidden","true"),w[A].slider.setAttribute("aria-hidden","true"),w[A].currentIndex=0,w[A].slider.classList.remove("tobii__slider--animate");var t=new window.CustomEvent("close",{detail:{group:A}});p.dispatchEvent(t)},q=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]");Y(e).onPreload(e)}},M=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]"),i=Y(e);w[A].sliderElements[t].classList.add("tobii__slide--is-active"),w[A].sliderElements[t].setAttribute("aria-hidden","false"),i.onLoad(e,A)}},P=function(){if(!ut())throw new Error("Ups, I'm closed.");w[A].currentIndex>0&&(k(w[A].currentIndex),M(--w[A].currentIndex),lt("left"),R(w[A].currentIndex+1),q(w[A].currentIndex-1));var t=new window.CustomEvent("previous",{detail:{group:A}});p.dispatchEvent(t)},z=function(){if(!ut())throw new Error("Ups, I'm closed.");w[A].currentIndex<w[A].elementsLength-1&&(k(w[A].currentIndex),M(++w[A].currentIndex),lt("right"),R(w[A].currentIndex-1),q(w[A].currentIndex+1));var t=new window.CustomEvent("next",{detail:{group:A}});p.dispatchEvent(t)},O=function(t){if(ut())throw new Error("Ups, I'm open.");if(!t)throw new Error("Ups, no group specified.");if(t&&!Object.prototype.hasOwnProperty.call(w,t))throw new Error("Ups, I don't have a group called \""+t+'".');A=t},k=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]"),i=Y(e);w[A].sliderElements[t].classList.remove("tobii__slide--is-active"),w[A].sliderElements[t].setAttribute("aria-hidden","true"),i.onLeave(e)}},R=function(t){if(void 0!==w[A].sliderElements[t]){var e=w[A].sliderElements[t].querySelector("[data-type]");Y(e).onCleanup(e),I.startX=0,I.startY=0,I.x=0,I.y=0,I.distance=0,E=0,$()&&rt(),L.element=null}},U=function(){w[A].slider.style.transform="translate("+(v=-w[A].currentIndex*p.offsetWidth)+"px, 0)"},H=function(){U()},D=function(t){t.preventDefault(),A=_(t.currentTarget),N(w[A].gallery.indexOf(t.currentTarget))},B=function(t){t.target===f?P():t.target===b?z():(t.target===h||t.target.classList.contains("tobii__slide")||t.target.classList.contains("tobii")&&d.docClose)&&X(),t.stopPropagation()},V=function(t,e,i){t.setAttribute("aria-hidden",e?"true":"false"),t.disabled=i},j=function(t){var e=Array.prototype.slice.call(p.querySelectorAll(".tobii__btn:not([disabled]), .tobii__slide--is-active "+l.join(", .tobii__slide--is-active "))).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}),i=e.indexOf(document.activeElement);9===t.keyCode||"Tab"===t.code?t.shiftKey&&0===i?(e[e.length-1].focus(),t.preventDefault()):t.shiftKey||i!==e.length-1&&-1!==i||(e[0].focus(),t.preventDefault()):27===t.keyCode||"Escape"===t.code?(t.preventDefault(),X()):37===t.keyCode||"ArrowLeft"===t.code?(t.preventDefault(),P()):39!==t.keyCode&&"ArrowRight"!==t.code||(t.preventDefault(),z())},W=function(){x=[],U(),w[A].slider.classList.remove("tobii__slider--is-"+($()?"moving":"dragging"))},G=function(t){if(!pt(t.target)&&(t.preventDefault(),t.stopPropagation(),I.startX=I.x=t.clientX,I.startY=I.y=t.clientY,I.distance=0,x.push(t),2===x.length)){var e=nt(x[0].clientX,x[0].clientY,x[1].clientX,x[1].clientY),i=e.y;I.startX=I.x=e.x,I.startY=I.y=i,I.distance=it(x[0].clientX-x[1].clientX,x[0].clientY-x[1].clientY)/L.scale}},J=function(t){if(x.length){w[A].slider.classList.add("tobii__slider--is-"+($()?"moving":"dragging"));var e=x.findIndex(function(e){return e.pointerId===t.pointerId});if(x[e]=t,2===x.length){var i=nt(x[0].clientX,x[0].clientY,x[1].clientX,x[1].clientY),n=i.x,r=i.y,a=it(x[0].clientX-x[1].clientX,x[0].clientY-x[1].clientY)/I.distance;return et(t.target,Z(a,1,4),n,r,n-I.x,r-I.y),I.x=n,void(I.y=r)}if($()&&tt(t.clientX-I.x,t.clientY-I.y),I.x=t.clientX,I.y=t.clientY,!$()){var o=I.startX-I.x,s=I.startY-I.y;if(it(o,s)<10)return;Math.abs(o)>Math.abs(s)&&w[A].elementsLength>1?w[A].slider.style.transform="translate("+(v-Math.round(o))+"px, 0)":d.swipeClose&&(w[A].slider.style.transform="translate("+v+"px, -"+Math.round(s)+"px)")}}},K=function(t){if(x.length){w[A].slider.classList.remove("tobii__slider--is-"+($()?"moving":"dragging"));var e=x.findIndex(function(e){return e.pointerId===t.pointerId});x.splice(e,1);var i=t.clientX,n=t.clientY,r=I.startX-i,a=I.startY-n,o=Math.abs(r),s=Math.abs(a);if(o>8||s>8)$()||(r<0&&o>d.threshold&&w[A].currentIndex>0?P():r>0&&o>d.threshold&&w[A].currentIndex!==w[A].elementsLength-1?z():a>0&&s>d.threshold&&d.swipeClose?X():U());else{var l=Date.now(),u=l-E;u<500&&u>100?(t.preventDefault(),E=0,$()?rt():et(t.target,2,i,n,0,0)):(E=l,ct()&&window.setTimeout(function(){var e=t.target.getBoundingClientRect(),r=e.left,a=e.right,o=e.width;n<e.top||n>e.bottom||!E||(i>r&&i<r+o/2?P():i<a&&i>a-o/2&&z())},500))}}},F=function(t){if(ft(t.target)){var e=Math.sign(t.deltaY)>0?-1:1;($()||e)&&(t.preventDefault(),et(t.target,Z(L.scale+e/(10/L.scale),1,4),t.clientX,t.clientY,0,0))}},Q=function(t,e){var i=L.element,n=L.scale,r="x"===t,a=r?L.originX:L.originY,o=r?"offsetWidth":"offsetHeight",s=i.parentNode[o],l=i[o],d=i.getBoundingClientRect(),u=(a-l/2)*(n-1),c=Math.max(0,Math.round(r?d.width:d.height)-s),p=Math.round(c/2);return Z(e,0-p+u,p+u)},Z=function(t,e,i){return Math.max(Math.min(t,i),e)},$=function(){return 1!==L.scale},tt=function(t,e){0!==t&&(L.translateX=Q("x",L.translateX+t)),0!==e&&(L.translateY=Q("y",L.translateY+e));var i=L.element,n=L.translateX,r=L.translateY,a=L.scale;i.style.transformOrigin=L.originX+"px "+L.originY+"px",i.style.transform="translate("+n+"px, "+r+"px) scale("+a+")"},et=function(t,e,i,n,r,a){if(ft(t)){var o=t.getBoundingClientRect(),s=(i-o.left)/L.scale,l=(n-o.top)/L.scale;L.element=t,L.originX=s,L.originY=l,L.scale=e,tt(r,a)}},it=function(t,e){return Math.hypot(t,e)},nt=function(t,e,i,n){return{x:(t+i)/2,y:(e+n)/2}},rt=function(){L.scale=1,L.originX=0,L.originY=0,L.translateX=0,L.translateY=0,tt(0,0)},at=function(){d.keyboard&&window.addEventListener("keydown",j),window.addEventListener("resize",H),window.addEventListener("popstate",X),bt("click",B),d.draggable&&(bt("pointerdown",G),bt("pointermove",J),bt("pointerup",K),bt("pointercancel",W),bt("pointerout",W),bt("pointerleave",W),bt("contextmenu",W)),bt("wheel",F)},ot=function(){d.keyboard&&window.removeEventListener("keydown",j),window.removeEventListener("resize",H),window.removeEventListener("popstate",X),ht("click",B),d.draggable&&(ht("pointerdown",G),ht("pointermove",J),ht("pointerup",K),ht("pointercancel",W),ht("pointerout",W),ht("pointerleave",W),ht("contextmenu",W)),ht("wheel",F)},st=function(){var t=w[A],e=t.slider;d.draggable&&!e.classList.contains("tobii__slider--is-draggable")&&e.classList.add("tobii__slider--is-draggable");var i=!d.nav||1===t.elementsLength||"auto"===d.nav&&ct();V(f,i,i),V(b,i,i),g.setAttribute("aria-hidden",d.counter&&1!==t.elementsLength?"false":"true")},lt=function(t){void 0===t&&(t=null),U(),g.innerHTML="<p>"+(w[A].currentIndex+1)+"/"+w[A].elementsLength+"</p>",function(t){var e=w[A],i=e.elementsLength>1;if(!0!==d.nav&&"auto"!==d.nav||ct()||!i?d.close&&h.focus():(V(f,!0,!0),V(b,!0,!0),0===e.currentIndex?(V(b,!1,!1),b.focus()):e.currentIndex===e.elementsLength-1?(V(f,!1,!1),f.focus()):(V(f,!1,!1),V(b,!1,!1),"left"===t?f.focus():b.focus())),i&&0!==e.currentIndex){var n=p.querySelector('.tobii__slide--is-active figure[tabindex="-1"]');n&&setTimeout(function(){n.focus()},250)}}(t)},dt=function(){ut()&&X();var t=Object.entries(w);for(var e in t.forEach(function(t){t[1].gallery.forEach(function(t){T(t)})}),w={},A=null,s)s[e].onReset()},ut=function(){return"false"===p.getAttribute("aria-hidden")},ct=function(){return"ontouchstart"in window},pt=function(t){return-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(t.tagName)||t===f||t===b||t===h},ft=function(t){return"IMG"===t.tagName},bt=function(t,e){p.addEventListener(t,e)},ht=function(t,e){p.removeEventListener(t,e)};return function(t){d=function(t){return e({},{selector:".lightbox",captions:!0,captionsSelector:"img",captionAttribute:"alt",captionText:null,captionHTML:!1,captionToggle:!0,captionToggleLabel:["Hide caption","Show caption"],nav:"auto",navText:['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="15 6 9 12 15 18" /></svg>','<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="9 6 15 12 9 18" /></svg>'],navLabel:["Previous image","Next image"],close:!0,closeText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" /></svg>',closeLabel:"Close lightbox",dialogTitle:"Lightbox",loadingIndicatorLabel:"Image loading",counter:!0,download:!1,downloadText:"",downloadLabel:"Download image",keyboard:!0,zoom:!0,zoomText:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="16 4 20 4 20 8" /><line x1="14" y1="10" x2="20" y2="4" /><polyline points="8 20 4 20 4 16" /><line x1="4" y1="20" x2="10" y2="14" /><polyline points="16 20 20 20 20 16" /><line x1="14" y1="14" x2="20" y2="20" /><polyline points="8 4 4 4 4 8" /><line x1="4" y1="4" x2="10" y2="10" /></svg>',docClose:!0,swipeClose:!0,hideScrollbar:!0,draggable:!0,threshold:100,rtl:!1,loop:!1,autoplayVideo:!1,modal:!1,theme:"tobii--theme-default"},t)}(t),p||((p=document.createElement("div")).setAttribute("role","dialog"),p.setAttribute("aria-hidden","true"),p.setAttribute("aria-modal","true"),p.setAttribute("aria-label",d.dialogTitle),p.classList.add("tobii"),p.classList.add(d.theme),(f=document.createElement("button")).className="tobii__btn tobii__btn--previous",f.setAttribute("type","button"),f.setAttribute("aria-label",d.navLabel[0]),f.innerHTML=d.navText[0],p.appendChild(f),(b=document.createElement("button")).className="tobii__btn tobii__btn--next",b.setAttribute("type","button"),b.setAttribute("aria-label",d.navLabel[1]),b.innerHTML=d.navText[1],p.appendChild(b),(h=document.createElement("button")).className="tobii__btn tobii__btn--close",h.setAttribute("type","button"),h.setAttribute("aria-label",d.closeLabel),h.innerHTML=d.closeText,p.appendChild(h),(g=document.createElement("div")).className="tobii__counter",p.appendChild(g),document.body.appendChild(p));var i=document.querySelectorAll(d.selector);if(!i)throw new Error("Ups, I can't find the selector "+d.selector+" on this website.");var n=[];i.forEach(function(t){var e=t.hasAttribute("data-group")?t.getAttribute("data-group"):"default",i=t.href;t.hasAttribute("data-target")&&(i=t.getAttribute("data-target")),void 0!==n[i+="__"+e]?t.addEventListener("click",function(t){O(e),N(),t.preventDefault()}):(n[i]=1,S(t))})}(t),o.open=N,o.previous=P,o.next=z,o.close=X,o.add=S,o.remove=T,o.reset=dt,o.destroy=function(){dt(),p.parentNode.removeChild(p)},o.isOpen=ut,o.slidesIndex=function(){return w[A].currentIndex},o.select=function(t){var e=w[A].currentIndex;if(!ut())throw new Error("Ups, I'm closed.");if(ut()){if(!t&&0!==t)throw new Error("Ups, no slide specified.");if(t===w[A].currentIndex)throw new Error("Ups, slide "+t+" is already selected.");if(-1===t||t>=w[A].elementsLength)throw new Error("Ups, I can't find slide "+t+".")}w[A].currentIndex=t,k(e),M(t),t<e&&(lt("left"),R(e),q(t-1)),t>e&&(lt("right"),R(e),q(t+1))},o.slidesCount=function(){return w[A].elementsLength},o.selectGroup=O,o.currentGroup=function(){return A},o.on=bt,o.off=ht,o}typeof module<"u"?module.exports=o:self.Tobii=o}();
|