/*! * baguettebox.js * @author feimosi * @version 1.8.2 * @url https://github.com/feimosi/baguettebox.js */ !function(t,e){"use strict";"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.baguettebox=e()}(this,function(){"use strict";function t(t,n){m.transforms=w(),m.svg=k(),i(),o(t),e(t,n)}function e(t,e){var n=document.queryselectorall(t),o={galleries:[],nodelist:n};u[t]=o,[].foreach.call(n,function(t){e&&e.filter&&(v=e.filter);var n=[];if(n="a"===t.tagname?[t]:t.getelementsbytagname("a"),n=[].filter.call(n,function(t){return v.test(t.href)}),0!==n.length){var i=[];[].foreach.call(n,function(t,n){var o=function(t){t.preventdefault?t.preventdefault():t.returnvalue=!1,u(i,e),c(n)},a={eventhandler:o,imageelement:t};e(t,"click",o),i.push(a)}),o.galleries.push(i)}})}function n(){for(var t in u)u.hasownproperty(t)&&o(t)}function o(t){if(u.hasownproperty(t)){var e=u[t].galleries;[].foreach.call(e,function(t){[].foreach.call(t,function(t){b(t.imageelement,"click",t.eventhandler)}),r===t&&(r=[])}),delete u[t]}}function i(){if(s=t("baguettebox-overlay"))return p=t("baguettebox-slider"),f=t("previous-button"),h=t("next-button"),void(l=t("close-button"));s=n("div"),s.setattribute("role","dialog"),s.id="baguettebox-overlay",document.getelementsbytagname("body")[0].appendchild(s),p=n("div"),p.id="baguettebox-slider",s.appendchild(p),f=n("button"),f.setattribute("type","button"),f.id="previous-button",f.setattribute("aria-label","previous"),f.innerhtml=m.svg?i:"<",s.appendchild(f),h=n("button"),h.setattribute("type","button"),h.id="next-button",h.setattribute("aria-label","next"),h.innerhtml=m.svg?y:">",s.appendchild(h),l=n("button"),l.setattribute("type","button"),l.id="close-button",l.setattribute("aria-label","close"),l.innerhtml=m.svg?q:"×",s.appendchild(l),f.classname=h.classname=l.classname="baguettebox-button",r()}function a(t){switch(t.keycode){case 37:v();break;case 39:h();break;case 27:m()}}function r(){e(s,"click",j),e(f,"click",k),e(h,"click",q),e(l,"click",z),e(s,"touchstart",$),e(s,"touchmove",_),e(s,"touchend",tt),e(document,"focus",et,!0)}function l(){b(s,"click",j),b(f,"click",k),b(h,"click",q),b(l,"click",z),b(s,"touchstart",$),b(s,"touchmove",_),b(s,"touchend",tt),b(document,"focus",et,!0)}function u(t,e){if(r!==t){for(r=t,s(e);p.firstchild;)p.removechild(p.firstchild);w.length=0;for(var n,o=[],i=[],a=0;a
',j.captions&&r){var s=n("figcaption");s.id="baguettebox-figcaption-"+t,s.innerhtml=r,u.appendchild(s)}n.appendchild(u);var c=n("img");c.onload=function(){var n=document.queryselector("#baguette-img-"+t+" .baguettebox-spinner");u.removechild(n),!j.async&&e&&e()},c.setattribute("src",l),c.alt=a?a.alt||"":"",j.titletag&&r&&(c.title=r),u.appendchild(c),j.async&&e&&e()}}function b(t){var e=t.href;if(t.dataset){var n=[];for(var o in t.dataset)"at-"!==o.substring(0,3)||isnan(o.substring(3))||(n[o.replace("at-","")]=t.dataset[o]);for(var i=object.keys(n).sort(function(t,e){return parseint(t,10)=1?(z--,y(),c(z),t=!0):j.animation&&(p.classname="bounce-from-left",settimeout(function(){p.classname=""},400),t=!1),j.onchange&&j.onchange(z,w.length),t}function y(){var t=100*-z+"%";"fadein"===j.animation?(p.style.opacity=0,settimeout(function(){m.transforms?p.style.transform=p.style.webkittransform="translate3d("+t+",0,0)":p.style.left=t,p.style.opacity=1},400)):m.transforms?p.style.transform=p.style.webkittransform="translate3d("+t+",0,0)":p.style.left=t}function w(){var t=n("div");return void 0!==t.style.perspective||void 0!==t.style.webkitperspective}function k(){var t=n("div");return t.innerhtml="","http://www.w3.org/2000/svg"===(t.firstchild&&t.firstchild.namespaceuri)}function x(t){t-z>=j.preload||p(t+1,function(){x(t+1)})}function c(t){z-t>=j.preload||p(t-1,function(){c(t-1)})}function e(t,e,n,o){t.addeventlistener?t.addeventlistener(e,n,o):t.attachevent("on"+e,function(t){t=t||window.event,t.target=t.target||t.srcelement,n(t)})}function b(t,e,n,o){t.removeeventlistener?t.removeeventlistener(e,n,o):t.detachevent("on"+e,n)}function t(t){return document.getelementbyid(t)}function n(t){return document.createelement(t)}function a(){l(),n(),b(document,"keydown",a),document.getelementsbytagname("body")[0].removechild(document.getelementbyid("baguettebox-overlay")),u={},r=[],z=0}var s,p,f,h,l,i='',y='',q='',j={},x={captions:!0,fullscreen:!1,noscrollbars:!1,titletag:!1,buttons:"auto",async:!1,preload:2,animation:"slidein",aftershow:null,afterhide:null,onchange:null,overlaybackgroundcolor:"rgba(0,0,0,.8)"},m={},r=[],z=0,d={},o=!1,v=/.+\.(gif|jpe?g|png|webp)/i,u={},w=[],g=null,j=function(t){t.target.id.indexof("baguette-img")!==-1&&m()},k=function(t){t.stoppropagation?t.stoppropagation():t.cancelbubble=!0,v()},q=function(t){t.stoppropagation?t.stoppropagation():t.cancelbubble=!0,h()},z=function(t){t.stoppropagation?t.stoppropagation():t.cancelbubble=!0,m()},$=function(t){d.count++,d.count>1&&(d.multitouch=!0),d.startx=t.changedtouches[0].pagex,d.starty=t.changedtouches[0].pagey},_=function(t){if(!o&&!d.multitouch){t.preventdefault?t.preventdefault():t.returnvalue=!1;var e=t.touches[0]||t.changedtouches[0];e.pagex-d.startx>40?(o=!0,v()):e.pagex-d.startx<-40?(o=!0,h()):d.starty-e.pagey>100&&m()}},tt=function(){d.count--,d.count<=0&&(d.multitouch=!1),o=!1},et=function(t){"block"===s.style.display&&s.contains&&!s.contains(t.target)&&(t.stoppropagation(),d())};return[].foreach||(array.prototype.foreach=function(t,e){for(var n=0;n