!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VenoBox=t()}(this,(function(){"use strict"; /** * VenoBox 2.1.6 * Copyright 2013-2024 Nicola Franchini * @license: https://github.com/nicolafranchini/VenoBox/blob/master/LICENSE */let e,t,o,n,s,i,a,r,l,d,c,v,u,b,p,g,m,f,y,x,h,L,w,k,S,C,A,E,q,P,M,T,j,H,O,z,I,V;const B=document.createElement("div");let N,D=0,Q=0,X=0,Y=!1,R=new Image,F=!1;const K={bounce:["sk-bounce","sk-bounce-dot",2],chase:["sk-chase","sk-chase-dot",6],circle:["sk-circle","sk-circle-dot",12],"circle-fade":["sk-circle-fade","sk-circle-fade-dot",12],flow:["sk-flow","sk-flow-dot",3],fold:["sk-fold","sk-fold-cube",4],grid:["sk-grid","sk-grid-cube",9],plane:["sk-plane","",0],pulse:["sk-pulse","",5],swing:["sk-swing","sk-swing-dot",2],wander:["sk-wander","sk-wander-cube",3],wave:["sk-wave","sk-wave-rect",5]},U={selector:".venobox",autoplay:!1,bgcolor:"#fff",border:"0",customClass:!1,infinigall:!1,maxWidth:"100%",navigation:!0,navKeyboard:!0,navTouch:!0,navSpeed:300,numeration:!1,overlayClose:!0,overlayColor:"rgba(23,23,23,0.95)",popup:!1,ratio:"16x9",share:!1,shareStyle:"pill",spinner:"bounce",spinColor:"#d2d2d2",titleattr:"title",titlePosition:"top",titleStyle:"bar",toolsBackground:"#1C1C1C",toolsColor:"#d2d2d2",onPreOpen:function(){return!0},onPostOpen:function(){},onPreClose:function(){return!0},onNavComplete:function(){},onContentLoaded:function(){},onInit:function(){},jQuerySelectors:!1,focusItem:!1,fitView:!1};function W(e,t,o){if("[object Object]"===Object.prototype.toString.call(e)){let n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(o,e[n],n,e)}else{let n=0,s=e.length;for(n=0;n1&&(a=1);let r=e(a);t(r),a<1&&requestAnimationFrame(s)}))}function G(e){if(!e)return!1;y=!0,r=e,L=!1,w=!1,S=e.getAttribute("data-maxwidth")||e.settings.maxWidth,C=e.getAttribute("data-overlay")||e.settings.overlayColor,A=e.getAttribute("data-ratio")||e.settings.ratio,E=e.hasAttribute("data-autoplay")||e.settings.autoplay,q=e.getAttribute("data-href")||e.getAttribute("href"),P=e.getAttribute("data-customclass")||e.settings.customClass,I=e.getAttribute(e.settings.titleattr)||"",O=e.getAttribute("data-border")||e.settings.border,M=e.hasAttribute("data-fitview")||e.settings.fitView}function J(){return!(!r||!document.body.classList.contains("vbox-open"))&&((!r.settings.onPreClose||"function"!=typeof r.settings.onPreClose||!1!==r.settings.onPreClose(r,p,j,H))&&(document.body.removeEventListener("keydown",te),document.body.classList.remove("vbox-open"),r.settings.focusItem&&r.focus(),void _({duration:200,timing:Z,draw:function(e){k.style.opacity=1-e,1===e&&k.remove()}})))}function $(){ue(j)}function ee(){ue(H)}function te(e){27===e.keyCode&&J(),V||(37==e.keyCode&&!0===w&&ue(H),39==e.keyCode&&!0===L&&ue(j),V=setTimeout((()=>{V=null}),100))}function oe(){y=!1,a.style.opacity=0,a.innerHTML=x,F?(a.classList.add("vbox-grab"),a.addEventListener("touchstart",ae,!1),a.addEventListener("touchend",re,!1),a.addEventListener("touchmove",le,!1),a.addEventListener("mousedown",ae,!1),a.addEventListener("mouseup",re,!1),a.addEventListener("mouseout",re,!1),a.addEventListener("mousemove",le,!1)):(a.classList.remove("vbox-grab"),a.removeEventListener("touchstart",ae,!1),a.removeEventListener("touchend",re,!1),a.removeEventListener("touchmove",le,!1),a.removeEventListener("mousedown",ae,!1),a.removeEventListener("mouseup",re,!1),a.removeEventListener("mouseout",re,!1),a.removeEventListener("mousemove",le,!1));let e=a.querySelector(":first-child");e.classList.add("vbox-child"),e.style.backgroundColor=r.settings.bgcolor,e.style.transform="scale(0.9)",e.style.transition="transform 200ms";let t=a.querySelector(".vbox-child img");t&&t.addEventListener("dragstart",(function(e){e.preventDefault()})),i.scrollTo(0,0),e.style.transform="scale(1)",k.style.setProperty("--vbox-padding",O),k.style.setProperty("--vbox-max-width",S),W(k.classList,(function(e){"vbox-overlay"!==e&&k.classList.remove(e)})),P&&k.classList.add(P),M?a.classList.add("vbox-fit"):a.classList.remove("vbox-fit"),_({duration:200,timing:Z,draw:function(e){a.style.opacity=e,1===e&&u.classList.add("vbox-hidden")}}),r.settings.onContentLoaded&&"function"==typeof r.settings.onContentLoaded&&r.settings.onContentLoaded(x)}function ne(e){a.classList.contains("vbox-"+e)||oe()}function se(e,t,o){let n;a.classList.add("vbox-loading");let s=function(e){let t,o,n;if(o=e.match(/(https?:\/\/)?((www\.)?(youtube(-nocookie)?|youtube.googleapis)\.com.*(v\/|v=|vi=|vi\/|e\/|embed\/|user\/.*\/u\/\d+\/)|youtu\.be\/)([_0-9a-z-]+)/i),o&&o[7])t="youtube",n=o[7];else{let s=/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/;o=e.match(s),o&&o[5]&&(t="vimeo",n=o[5])}return{type:t,id:n}}(e);if("vimeo"==s.type||"youtube"==s.type){let i;n=o?"?rel=0&autoplay=1":"?rel=0";let a=n+function(e){let t="",o=decodeURIComponent(e).split("?");if(void 0!==o[1]){let e,n,s=o[1].split("&");for(n=0;n'}else n=o?" autoplay":"",x='
";a.classList.remove("vbox-loading"),ne("animated")}function ie(){var e;if(e=x,B.innerHTML=e,g=B.querySelectorAll("img"),g.length){let e=0;W(g,(function(t){let o=t.src;R=new Image,R.onload=function(){e++,e==g.length&&(a.classList.remove("vbox-loading"),ne("animated"))},R.onerror=function(){e++,e==g.length&&(a.classList.remove("vbox-loading"),ne("animated"))},R.src=o}))}else a.classList.remove("vbox-loading"),ne("animated")}function ae(e){if(!y){let t=.84*r.settings.navSpeed;a.style.transition="margin "+t+"ms ease-out, opacity "+t+"ms ease-out",D=Q="touchstart"===e.type?e.touches[0].pageX:e.pageX,T=v="touchstart"===e.type?e.touches[0].pageY:e.pageY,Y=!0}}function re(e){if(Y){Y=!1;let e=r,t=!1;X=Q-D,X<0&&L&&(e=j,t=!0),X>0&&w&&(e=H,t=!0),Math.abs(X)>=50&&t?ue(e):(a.style.marginLeft=0,a.style.opacity=1)}}function le(e){if(Y&&!y){Q="touchmove"===e.type?e.touches[0].pageX:e.pageX,v="touchmove"===e.type?e.touches[0].pageY:e.pageY,d=Q-D,c=v-T;let t=Math.abs(d);if(t>Math.abs(c)&&t<=180){let o=1.5*(1-t/180);e.preventDefault(),a.style.marginLeft=d+"px",a.style.opacity=o}}}function de(e){if(!e)return!1;z=e.dataset.gall,h=e.settings.numeration,m=e.settings.infinigall,o.innerHTML="";let s=e.dataset.vbtype;e.settings.share&&"iframe"!==s&&"inline"!==s&&"ajax"!==s&&function(e){if(navigator.canShare){const t={url:e};o.insertAdjacentHTML("beforeend",''),o.querySelector(".vbox-share-mobile").addEventListener("click",(function(e){e.preventDefault(),navigator.share(t)}))}o.insertAdjacentHTML("beforeend",''),o.insertAdjacentHTML("beforeend",'
'),o.querySelector(".vbox-share-copy").addEventListener("click",(function(t){t.preventDefault();let o=document.getElementById("myTooltip");navigator.clipboard.writeText(e).then((function(){o.innerHTML='
Copied
'}),(function(){console.log("copy failed")}))}))}(e.href),f=document.querySelectorAll('.vbox-item[data-gall="'+z+'"]'),l=Array.prototype.indexOf.call(f,e),f.length<2&&(h=!1),f.length<3&&(m=!1),j=f[l+1],H=f[l-1],!j&&m&&(j=f[0]),!H&&m&&(H=f[f.length-1]),f.length>=1?(p=l+1,t.innerHTML=p+" / "+f.length):p=1,h?t.classList.remove("vbox-hidden"):t.classList.add("vbox-hidden"),""!==I?n.classList.remove("vbox-hidden"):n.classList.add("vbox-hidden"),n.innerHTML=I,w=!1,L=!1,(j||m)&&(L=!0),(l>0||m)&&(w=!0),F=(w||L)&&e.settings.navTouch;let i=k.querySelector(".vbox-next"),a=k.querySelector(".vbox-prev");w?a.classList.remove("vbox-hidden"):a.classList.add("vbox-hidden"),L?i.classList.remove("vbox-hidden"):i.classList.add("vbox-hidden"),e.settings.navigation||(i.classList.add("vbox-hidden"),a.classList.add("vbox-hidden"))}function ce(t){if(!t)return!1;e.style.backgroundColor=C,b.innerHTML=function(e){if(!e)return"Loading...";let t='
',o=0;for(o=0;o
';return t+="",t}(K[t.settings.spinner]),k.style.setProperty("--sk-color",t.settings.spinColor),u.classList.remove("vbox-hidden"),o.classList.remove("vbox-top","vbox-bottom"),n.classList.remove("vbox-top","vbox-bottom"),"top"==t.settings.titlePosition?(n.classList.add("vbox-top"),o.classList.add("vbox-bottom")):(n.classList.add("vbox-bottom"),o.classList.add("vbox-top"));let s="bar"===t.settings.titleStyle?"100%":"auto",i="pill"===t.settings.titleStyle?"5em":"0",a="bar"===t.settings.shareStyle?"100%":"auto",r="pill"===t.settings.shareStyle?"5em":"0",l="transparent"===t.settings.titleStyle?"transparent":t.settings.toolsBackground,d="transparent"===t.settings.shareStyle?"transparent":t.settings.toolsBackground;k.style.setProperty("--vbox-title-width",s),k.style.setProperty("--vbox-title-radius",i),k.style.setProperty("--vbox-share-width",a),k.style.setProperty("--vbox-share-radius",r),k.style.setProperty("--vbox-tools-color",t.settings.toolsColor),k.style.setProperty("--vbox-title-background",l),k.style.setProperty("--vbox-share-background",d)}function ve(){if(!r)return!1;switch(r.dataset.vbtype){case"iframe":e=q,t=A,a.classList.add("vbox-loading"),x='
',a.classList.remove("vbox-loading"),ne("animated");break;case"inline":!function(e){let t=document.querySelector(e);t&&(a.classList.add("vbox-loading"),x='
'+t.innerHTML+"
",a.classList.remove("vbox-loading"),ne("animated"))}(q);break;case"ajax":!function(e){a.classList.add("vbox-loading");let t=new XMLHttpRequest;t.open("GET",e,!0),t.onload=function(){x='
'+t.response+"
",ie()},t.onerror=function(){x='
',a.classList.remove("vbox-loading"),ne("animated")},t.send()}(q);break;case"video":se(q,A,E);break;default:!function(e){R.onload=function(){x='
',a.classList.remove("vbox-loading"),ne("animated")},R.src=e}(q)}var e,t}function ue(e){if(!e||y||!document.body.classList.contains("vbox-open"))return!1;G(e),ce(e);const t=.84*r.settings.navSpeed;a.style.transition="margin "+t+"ms ease-out, opacity "+t+"ms ease-out",e===H&&a.classList.add("swipe-right"),e===j&&a.classList.add("swipe-left"),u.classList.remove("vbox-hidden");const o=a.style.opacity;a.classList.add("vbox-animated","vbox-loading"),N=a.cloneNode(!1),N.classList.add("cloned"),N.classList.remove("swipe-left","swipe-right"),N.style.opacity=0,N.style.marginLeft="0",N.style.marginRight="0";const n=a;i.append(N),a=N,a.classList.remove("cloned"),de(e),_({duration:r.settings.navSpeed,timing:Z,draw:function(e){n.style.opacity=o-e/o,1===e&&(n.remove(),a.classList.remove("vbox-animated"),ne("loading"),y=!1,r.settings.onNavComplete&&"function"==typeof r.settings.onNavComplete&&r.settings.onNavComplete(r,p,j,H))}}),ve()}function be(l){return!(document.body.classList.contains("vbox-open")||!l)&&((!l.settings.onPreOpen||"function"!=typeof l.settings.onPreOpen||!1!==l.settings.onPreOpen(l))&&(G(l),document.body.insertAdjacentHTML("beforeend",s),document.body.classList.add("vbox-open"),k=document.querySelector(".vbox-overlay"),e=k.querySelector(".vbox-backdrop"),i=k.querySelector(".vbox-container"),a=i.querySelector(".vbox-content"),t=k.querySelector(".vbox-num"),o=k.querySelector(".vbox-share"),n=k.querySelector(".vbox-title"),u=k.querySelector(".vbox-preloader"),b=u.querySelector(".vbox-preloader-inner"),k.style.opacity=0,ce(l),de(l),a.classList.add("vbox-animated","vbox-loading"),_({duration:200,timing:Z,draw:function(e){k.style.opacity=e,1===e&&(a.classList.remove("vbox-animated"),y=!1,ne("loading"),r.settings.onPostOpen&&"function"==typeof r.settings.onPostOpen&&r.settings.onPostOpen(r,p,j,H))}}),ve(),l.settings.navKeyboard&&(document.body.addEventListener("keydown",te),document.body.addEventListener("keyup",(()=>{V&&(clearTimeout(V),V=null)}))),document.querySelector(".vbox-prev").addEventListener("click",(function(){ue(H)})),document.querySelector(".vbox-next").addEventListener("click",(function(){ue(j)})),void k.addEventListener("click",(function(e){let t=document.querySelector(".vbox-close");t&&(t.contains(e.target)||t===e.target||r.settings.overlayClose&&(e.target.classList.contains("vbox-overlay")||e.target.classList.contains("vbox-content")||e.target.classList.contains("vbox-backdrop")||e.target.classList.contains("vbox-close")||e.target.classList.contains("vbox-preloader")||e.target.classList.contains("vbox-container")))&&J()}))))}const pe=function(e){const t={};let o=function(e,t){let o={};return W(e,(function(t,n){o[n]=e[n]})),W(t,(function(e,n){o[n]=t[n]})),o}(U,e||{});return t.close=J,t.next=$,t.prev=ee,t.open=be,t.settings=o,function(e,t){t.onInit&&"function"==typeof t.onInit&&t.onInit(e);let o=t.jQuerySelectors||document.querySelectorAll(t.selector);if(s='',W(o,(function(e){if(e.classList.contains("vbox-item"))return!0;e.settings=t,e.classList.add("vbox-item"),e.addEventListener("click",(function(t){return t.preventDefault(),e.blur(),be(e),!1}))})),t.popup){let e=document.querySelector(t.popup);e.settings=t,be(e)}}(t,o),t};return"function"==typeof jQuery&&jQuery.fn.extend({venobox:function(e){const t=e||{};t.jQuerySelectors=this,new pe({pluginoptions:t})}}),pe})); //# sourceMappingURL=venobox.min.js.map