jquery.magnificpopup.min.js 20 KB

1
  1. !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?e(require("jquery")):e(window.jQuery||window.Zepto)}(function(c){function e(){}function d(e,t){f.ev.on(I+e+x,t)}function u(e,t,n,o){var i=document.createElement("div");return i.className="mfp-"+e,n&&(i.innerHTML=n),o?t&&t.appendChild(i):(i=c(i),t&&i.appendTo(t)),i}function p(e,t){f.ev.triggerHandler(I+e,t),f.st.callbacks&&(e=e.charAt(0).toLowerCase()+e.slice(1),f.st.callbacks[e]&&f.st.callbacks[e].apply(f,Array.isArray(t)?t:[t]))}function m(e){return e===H&&f.currTemplate.closeBtn||(f.currTemplate.closeBtn=c(f.st.closeMarkup.replace("%title%",f.st.tClose)),H=e),f.currTemplate.closeBtn}function a(){c.magnificPopup.instance||((f=new e).init(),c.magnificPopup.instance=f)}function r(){y&&(v.after(y.addClass(l)).detach(),y=null)}function i(){n&&c(document.body).removeClass(n)}function t(){i(),f.req&&f.req.abort()}var f,o,g,s,h,H,l,v,y,n,C="Close",F="BeforeClose",w="MarkupParse",b="Open",j="Change",I="mfp",x="."+I,k="mfp-ready",N="mfp-removing",T="mfp-prevent-close",_=!!window.jQuery,P=c(window),S=(c.magnificPopup={instance:null,proto:e.prototype={constructor:e,init:function(){var e=navigator.appVersion;f.isLowIE=f.isIE8=document.all&&!document.addEventListener,f.isAndroid=/android/gi.test(e),f.isIOS=/iphone|ipad|ipod/gi.test(e),f.supportsTransition=function(){var e=document.createElement("p").style,t=["ms","O","Moz","Webkit"];if(void 0!==e.transition)return!0;for(;t.length;)if(t.pop()+"Transition"in e)return!0;return!1}(),f.probablyMobile=f.isAndroid||f.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),g=c(document),f.popupsCache={}},open:function(e){if(!1===e.isObj){f.items=e.items.toArray(),f.index=0;for(var t,n=e.items,o=0;o<n.length;o++)if((t=(t=n[o]).parsed?t.el[0]:t)===e.el[0]){f.index=o;break}}else f.items=Array.isArray(e.items)?e.items:[e.items],f.index=e.index||0;if(!f.isOpen){f.types=[],h="",e.mainEl&&e.mainEl.length?f.ev=e.mainEl.eq(0):f.ev=g,e.key?(f.popupsCache[e.key]||(f.popupsCache[e.key]={}),f.currTemplate=f.popupsCache[e.key]):f.currTemplate={},f.st=c.extend(!0,{},c.magnificPopup.defaults,e),f.fixedContentPos="auto"===f.st.fixedContentPos?!f.probablyMobile:f.st.fixedContentPos,f.st.modal&&(f.st.closeOnContentClick=!1,f.st.closeOnBgClick=!1,f.st.showCloseBtn=!1,f.st.enableEscapeKey=!1),f.bgOverlay||(f.bgOverlay=u("bg").on("click"+x,function(){f.close()}),f.wrap=u("wrap").attr("tabindex",-1).on("click"+x,function(e){f._checkIfClose(e.target)&&f.close()}),f.container=u("container",f.wrap)),f.contentContainer=u("content"),f.st.preloader&&(f.preloader=u("preloader",f.container,f.st.tLoading));var i=c.magnificPopup.modules;for(o=0;o<i.length;o++){var a=(a=i[o]).charAt(0).toUpperCase()+a.slice(1);f["init"+a].call(f)}p("BeforeOpen"),f.st.showCloseBtn&&(f.st.closeBtnInside?(d(w,function(e,t,n,o){n.close_replaceWith=m(o.type)}),h+=" mfp-close-btn-in"):f.wrap.append(m())),f.st.alignTop&&(h+=" mfp-align-top"),f.fixedContentPos?f.wrap.css({overflow:f.st.overflowY,overflowX:"hidden",overflowY:f.st.overflowY}):f.wrap.css({top:P.scrollTop(),position:"absolute"}),!1!==f.st.fixedBgPos&&("auto"!==f.st.fixedBgPos||f.fixedContentPos)||f.bgOverlay.css({height:g.height(),position:"absolute"}),f.st.enableEscapeKey&&g.on("keyup"+x,function(e){27===e.keyCode&&f.close()}),P.on("resize"+x,function(){f.updateSize()}),f.st.closeOnContentClick||(h+=" mfp-auto-cursor"),h&&f.wrap.addClass(h);var r=f.wH=P.height(),s={},l=(f.fixedContentPos&&f._hasScrollBar(r)&&(l=f._getScrollbarSize())&&(s.marginRight=l),f.fixedContentPos&&(f.isIE7?c("body, html").css("overflow","hidden"):s.overflow="hidden"),f.st.mainClass);return f.isIE7&&(l+=" mfp-ie7"),l&&f._addClassToMFP(l),f.updateItemHTML(),p("BuildControls"),c("html").css(s),f.bgOverlay.add(f.wrap).prependTo(f.st.prependTo||c(document.body)),f._lastFocusedEl=document.activeElement,setTimeout(function(){f.content?(f._addClassToMFP(k),f._setFocus()):f.bgOverlay.addClass(k),g.on("focusin"+x,f._onFocusIn)},16),f.isOpen=!0,f.updateSize(r),p(b),e}f.updateItemHTML()},close:function(){f.isOpen&&(p(F),f.isOpen=!1,f.st.removalDelay&&!f.isLowIE&&f.supportsTransition?(f._addClassToMFP(N),setTimeout(function(){f._close()},f.st.removalDelay)):f._close())},_close:function(){p(C);var e=N+" "+k+" ";f.bgOverlay.detach(),f.wrap.detach(),f.container.empty(),f.st.mainClass&&(e+=f.st.mainClass+" "),f._removeClassFromMFP(e),f.fixedContentPos&&(e={marginRight:""},f.isIE7?c("body, html").css("overflow",""):e.overflow="",c("html").css(e)),g.off("keyup.mfp focusin"+x),f.ev.off(x),f.wrap.attr("class","mfp-wrap").removeAttr("style"),f.bgOverlay.attr("class","mfp-bg"),f.container.attr("class","mfp-container"),!f.st.showCloseBtn||f.st.closeBtnInside&&!0!==f.currTemplate[f.currItem.type]||f.currTemplate.closeBtn&&f.currTemplate.closeBtn.detach(),f.st.autoFocusLast&&f._lastFocusedEl&&c(f._lastFocusedEl).focus(),f.currItem=null,f.content=null,f.currTemplate=null,f.prevHeight=0,p("AfterClose")},updateSize:function(e){var t;f.isIOS?(t=document.documentElement.clientWidth/window.innerWidth,t=window.innerHeight*t,f.wrap.css("height",t),f.wH=t):f.wH=e||P.height(),f.fixedContentPos||f.wrap.css("height",f.wH),p("Resize")},updateItemHTML:function(){var e=f.items[f.index],t=(f.contentContainer.detach(),f.content&&f.content.detach(),(e=e.parsed?e:f.parseEl(f.index)).type),n=(p("BeforeChange",[f.currItem?f.currItem.type:"",t]),f.currItem=e,f.currTemplate[t]||(n=!!f.st[t]&&f.st[t].markup,p("FirstMarkupParse",n),f.currTemplate[t]=!n||c(n)),s&&s!==e.type&&f.container.removeClass("mfp-"+s+"-holder"),f["get"+t.charAt(0).toUpperCase()+t.slice(1)](e,f.currTemplate[t]));f.appendContent(n,t),e.preloaded=!0,p(j,e),s=e.type,f.container.prepend(f.contentContainer),p("AfterChange")},appendContent:function(e,t){(f.content=e)?f.st.showCloseBtn&&f.st.closeBtnInside&&!0===f.currTemplate[t]?f.content.find(".mfp-close").length||f.content.append(m()):f.content=e:f.content="",p("BeforeAppend"),f.container.addClass("mfp-"+t+"-holder"),f.contentContainer.append(f.content)},parseEl:function(e){var t,n=f.items[e];if((n=n.tagName?{el:c(n)}:(t=n.type,{data:n,src:n.src})).el){for(var o=f.types,i=0;i<o.length;i++)if(n.el.hasClass("mfp-"+o[i])){t=o[i];break}n.src=n.el.attr("data-mfp-src"),n.src||(n.src=n.el.attr("href"))}return n.type=t||f.st.type||"inline",n.index=e,n.parsed=!0,f.items[e]=n,p("ElementParse",n),f.items[e]},addGroup:function(t,n){function e(e){e.mfpEl=this,f._openClick(e,t,n)}var o="click.magnificPopup";(n=n||{}).mainEl=t,n.items?(n.isObj=!0,t.off(o).on(o,e)):(n.isObj=!1,n.delegate?t.off(o).on(o,n.delegate,e):(n.items=t).off(o).on(o,e))},_openClick:function(e,t,n){var o=(void 0!==n.midClick?n:c.magnificPopup.defaults).midClick;if(o||!(2===e.which||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey)){o=(void 0!==n.disableOn?n:c.magnificPopup.defaults).disableOn;if(o)if("function"==typeof o){if(!o.call(f))return!0}else if(P.width()<o)return!0;e.type&&(e.preventDefault(),f.isOpen&&e.stopPropagation()),n.el=c(e.mfpEl),n.delegate&&(n.items=t.find(n.delegate)),f.open(n)}},updateStatus:function(e,t){var n;f.preloader&&(o!==e&&f.container.removeClass("mfp-s-"+o),n={status:e,text:t=t||"loading"!==e?t:f.st.tLoading},p("UpdateStatus",n),e=n.status,f.preloader.html(t=n.text),f.preloader.find("a").on("click",function(e){e.stopImmediatePropagation()}),f.container.addClass("mfp-s-"+e),o=e)},_checkIfClose:function(e){if(!c(e).closest("."+T).length){var t=f.st.closeOnContentClick,n=f.st.closeOnBgClick;if(t&&n)return!0;if(!f.content||c(e).closest(".mfp-close").length||f.preloader&&e===f.preloader[0])return!0;if(e===f.content[0]||c.contains(f.content[0],e)){if(t)return!0}else if(n&&c.contains(document,e))return!0;return!1}},_addClassToMFP:function(e){f.bgOverlay.addClass(e),f.wrap.addClass(e)},_removeClassFromMFP:function(e){this.bgOverlay.removeClass(e),f.wrap.removeClass(e)},_hasScrollBar:function(e){return(f.isIE7?g.height():document.body.scrollHeight)>(e||P.height())},_setFocus:function(){(f.st.focus?f.content.find(f.st.focus).eq(0):f.wrap).focus()},_onFocusIn:function(e){if(e.target!==f.wrap[0]&&!c.contains(f.wrap[0],e.target))return f._setFocus(),!1},_parseMarkup:function(i,e,t){var a;t.data&&(e=c.extend(t.data,e)),p(w,[i,e,t]),c.each(e,function(e,t){if(void 0===t||!1===t)return!0;var n,o;1<(a=e.split("_")).length?0<(n=i.find(x+"-"+a[0])).length&&("replaceWith"===(o=a[1])?n[0]!==t[0]&&n.replaceWith(t):"img"===o?n.is("img")?n.attr("src",t):n.replaceWith(c("<img>").attr("src",t).attr("class",n.attr("class"))):n.attr(a[1],t)):i.find(x+"-"+e).html(t)})},_getScrollbarSize:function(){var e;return void 0===f.scrollbarSize&&((e=document.createElement("div")).style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e),f.scrollbarSize=e.offsetWidth-e.clientWidth,document.body.removeChild(e)),f.scrollbarSize}},modules:[],open:function(e,t){return a(),(e=e?c.extend(!0,{},e):{}).isObj=!0,e.index=t||0,this.instance.open(e)},close:function(){return c.magnificPopup.instance&&c.magnificPopup.instance.close()},registerModule:function(e,t){t.options&&(c.magnificPopup.defaults[e]=t.options),c.extend(this.proto,t.proto),this.modules.push(e)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&#215;</button>',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},c.fn.magnificPopup=function(e){a();var t,n,o,i=c(this);return"string"==typeof e?"open"===e?(t=_?i.data("magnificPopup"):i[0].magnificPopup,n=parseInt(arguments[1],10)||0,o=t.items?t.items[n]:(o=i,(o=t.delegate?o.find(t.delegate):o).eq(n)),f._openClick({mfpEl:o},i,t)):f.isOpen&&f[e].apply(f,Array.prototype.slice.call(arguments,1)):(e=c.extend(!0,{},e),_?i.data("magnificPopup",e):i[0].magnificPopup=e,f.addGroup(i,e)),i},"inline"),E=(c.magnificPopup.registerModule(S,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){f.types.push(S),d(C+"."+S,function(){r()})},getInline:function(e,t){var n,o,i;return r(),e.src?(n=f.st.inline,(o=c(e.src)).length?((i=o[0].parentNode)&&i.tagName&&(v||(l=n.hiddenClass,v=u(l),l="mfp-"+l),y=o.after(v).detach().removeClass(l)),f.updateStatus("ready")):(f.updateStatus("error",n.tNotFound),o=c("<div>")),e.inlineElement=o):(f.updateStatus("ready"),f._parseMarkup(t,{},e),t)}}}),"ajax");c.magnificPopup.registerModule(E,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){f.types.push(E),n=f.st.ajax.cursor,d(C+"."+E,t),d("BeforeChange."+E,t)},getAjax:function(o){n&&c(document.body).addClass(n),f.updateStatus("loading");var e=c.extend({url:o.src,success:function(e,t,n){e={data:e,xhr:n};p("ParseAjax",e),f.appendContent(c(e.data),E),o.finished=!0,i(),f._setFocus(),setTimeout(function(){f.wrap.addClass(k)},16),f.updateStatus("ready"),p("AjaxContentAdded")},error:function(){i(),o.finished=o.loadError=!0,f.updateStatus("error",f.st.ajax.tError.replace("%url%",o.src))}},f.st.ajax.settings);return f.req=c.ajax(e),""}}});var z;c.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var e=f.st.image,t=".image";f.types.push("image"),d(b+t,function(){"image"===f.currItem.type&&e.cursor&&c(document.body).addClass(e.cursor)}),d(C+t,function(){e.cursor&&c(document.body).removeClass(e.cursor),P.off("resize"+x)}),d("Resize"+t,f.resizeImage),f.isLowIE&&d("AfterChange",f.resizeImage)},resizeImage:function(){var e,t=f.currItem;t&&t.img&&f.st.image.verticalFit&&(e=0,f.isLowIE&&(e=parseInt(t.img.css("padding-top"),10)+parseInt(t.img.css("padding-bottom"),10)),t.img.css("max-height",f.wH-e))},_onImageHasSize:function(e){e.img&&(e.hasSize=!0,z&&clearInterval(z),e.isCheckingImgSize=!1,p("ImageHasSize",e),e.imgHidden&&(f.content&&f.content.removeClass("mfp-loading"),e.imgHidden=!1))},findImageSize:function(t){function n(e){z&&clearInterval(z),z=setInterval(function(){0<i.naturalWidth?f._onImageHasSize(t):(200<o&&clearInterval(z),3===++o?n(10):40===o?n(50):100===o&&n(500))},e)}var o=0,i=t.img[0];n(1)},getImage:function(e,t){function n(){e&&(e.img[0].complete?(e.img.off(".mfploader"),e===f.currItem&&(f._onImageHasSize(e),f.updateStatus("ready")),e.hasSize=!0,e.loaded=!0,p("ImageLoadComplete")):++a<200?setTimeout(n,100):o())}function o(){e&&(e.img.off(".mfploader"),e===f.currItem&&(f._onImageHasSize(e),f.updateStatus("error",r.tError.replace("%url%",e.src))),e.hasSize=!0,e.loaded=!0,e.loadError=!0)}var i,a=0,r=f.st.image,s=t.find(".mfp-img");return s.length&&((i=document.createElement("img")).className="mfp-img",e.el&&e.el.find("img").length&&(i.alt=e.el.find("img").attr("alt")),e.img=c(i).on("load.mfploader",n).on("error.mfploader",o),i.src=e.src,s.is("img")&&(e.img=e.img.clone()),0<(i=e.img[0]).naturalWidth?e.hasSize=!0:i.width||(e.hasSize=!1)),f._parseMarkup(t,{title:function(e){if(e.data&&void 0!==e.data.title)return e.data.title;var t=f.st.image.titleSrc;if(t){if("function"==typeof t)return t.call(f,e);if(e.el)return e.el.attr(t)||""}return""}(e),img_replaceWith:e.img},e),f.resizeImage(),e.hasSize?(z&&clearInterval(z),e.loadError?(t.addClass("mfp-loading"),f.updateStatus("error",r.tError.replace("%url%",e.src))):(t.removeClass("mfp-loading"),f.updateStatus("ready"))):(f.updateStatus("loading"),e.loading=!0,e.hasSize||(e.imgHidden=!0,t.addClass("mfp-loading"),f.findImageSize(e))),t}}});function O(e){var t;f.currTemplate[A]&&(t=f.currTemplate[A].find("iframe")).length&&(e||(t[0].src="//about:blank"),f.isIE8&&t.css("display",e?"block":"none"))}function M(e){var t=f.items.length;return t-1<e?e-t:e<0?t+e:e}function W(e,t,n){return e.replace(/%curr%/gi,t+1).replace(/%total%/gi,n)}c.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(e){return e.is("img")?e:e.find("img")}},proto:{initZoom:function(){var e,t,n,o,i,a,r=f.st.zoom,s=".zoom";r.enabled&&f.supportsTransition&&(t=r.duration,n=function(e){var e=e.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),t="all "+r.duration/1e3+"s "+r.easing,n={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},o="transition";return n["-webkit-"+o]=n["-moz-"+o]=n["-o-"+o]=n[o]=t,e.css(n),e},o=function(){f.content.css("visibility","visible")},d("BuildControls"+s,function(){f._allowZoom()&&(clearTimeout(i),f.content.css("visibility","hidden"),(e=f._getItemToZoom())?((a=n(e)).css(f._getOffset()),f.wrap.append(a),i=setTimeout(function(){a.css(f._getOffset(!0)),i=setTimeout(function(){o(),setTimeout(function(){a.remove(),e=a=null,p("ZoomAnimationEnded")},16)},t)},16)):o())}),d(F+s,function(){if(f._allowZoom()){if(clearTimeout(i),f.st.removalDelay=t,!e){if(!(e=f._getItemToZoom()))return;a=n(e)}a.css(f._getOffset(!0)),f.wrap.append(a),f.content.css("visibility","hidden"),setTimeout(function(){a.css(f._getOffset())},16)}}),d(C+s,function(){f._allowZoom()&&(o(),a&&a.remove(),e=null)}))},_allowZoom:function(){return"image"===f.currItem.type},_getItemToZoom:function(){return!!f.currItem.hasSize&&f.currItem.img},_getOffset:function(e){var e=e?f.currItem.img:f.st.zoom.opener(f.currItem.el||f.currItem),t=e.offset(),n=parseInt(e.css("padding-top"),10),o=parseInt(e.css("padding-bottom"),10),e=(t.top-=c(window).scrollTop()-n,{width:e.width(),height:(_?e.innerHeight():e[0].offsetHeight)-o-n});return(B=void 0===B?void 0!==document.createElement("p").style.MozTransform:B)?e["-moz-transform"]=e.transform="translate("+t.left+"px,"+t.top+"px)":(e.left=t.left,e.top=t.top),e}}});var B,A="iframe",L=(c.magnificPopup.registerModule(A,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com/",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},youtu_be:{index:"youtu.be",id:"/",src:"//www.youtube.com/embed/%id%?autoplay=1"},youtube_nocookie:{index:"youtube-nocookie.com",id:"/",src:"//www.youtube-nocookie.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){f.types.push(A),d("BeforeChange",function(e,t,n){t!==n&&(t===A?O():n===A&&O(!0))}),d(C+"."+A,function(){O()})},getIframe:function(e,t){var n=e.src,o=f.st.iframe,i=(c.each(o.patterns,function(){if(-1<n.indexOf(this.index))return this.id&&(n="string"==typeof this.id?n.substr(n.lastIndexOf(this.id)+this.id.length,n.length):this.id.call(this,n)),n=this.src.replace("%id%",n),!1}),{});return o.srcAction&&(i[o.srcAction]=n),f._parseMarkup(t,i,e),f.updateStatus("ready"),t}}}),c.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var a=f.st.gallery,e=".mfp-gallery";if(f.direction=!0,!a||!a.enabled)return!1;h+=" mfp-gallery",d(b+e,function(){a.navigateByImgClick&&f.wrap.on("click"+e,".mfp-img",function(){if(1<f.items.length)return f.next(),!1}),g.on("keydown"+e,function(e){37===e.keyCode?f.prev():39===e.keyCode&&f.next()})}),d("UpdateStatus"+e,function(e,t){t.text&&(t.text=W(t.text,f.currItem.index,f.items.length))}),d(w+e,function(e,t,n,o){var i=f.items.length;n.counter=1<i?W(a.tCounter,o.index,i):""}),d("BuildControls"+e,function(){var e,t;1<f.items.length&&a.arrows&&!f.arrowLeft&&(t=a.arrowMarkup,e=f.arrowLeft=c(t.replace(/%title%/gi,a.tPrev).replace(/%dir%/gi,"left")).addClass(T),t=f.arrowRight=c(t.replace(/%title%/gi,a.tNext).replace(/%dir%/gi,"right")).addClass(T),e.click(function(){f.prev()}),t.click(function(){f.next()}),f.container.append(e.add(t)))}),d(j+e,function(){f._preloadTimeout&&clearTimeout(f._preloadTimeout),f._preloadTimeout=setTimeout(function(){f.preloadNearbyImages(),f._preloadTimeout=null},16)}),d(C+e,function(){g.off(e),f.wrap.off("click"+e),f.arrowRight=f.arrowLeft=null})},next:function(){f.direction=!0,f.index=M(f.index+1),f.updateItemHTML()},prev:function(){f.direction=!1,f.index=M(f.index-1),f.updateItemHTML()},goTo:function(e){f.direction=e>=f.index,f.index=e,f.updateItemHTML()},preloadNearbyImages:function(){for(var e=f.st.gallery.preload,t=Math.min(e[0],f.items.length),n=Math.min(e[1],f.items.length),o=1;o<=(f.direction?n:t);o++)f._preloadItem(f.index+o);for(o=1;o<=(f.direction?t:n);o++)f._preloadItem(f.index-o)},_preloadItem:function(e){var t;e=M(e),f.items[e].preloaded||((t=f.items[e]).parsed||(t=f.parseEl(e)),p("LazyLoad",t),"image"===t.type&&(t.img=c('<img class="mfp-img" />').on("load.mfploader",function(){t.hasSize=!0}).on("error.mfploader",function(){t.hasSize=!0,t.loadError=!0,p("LazyLoadError",t)}).attr("src",t.src)),t.preloaded=!0)}}}),"retina");c.magnificPopup.registerModule(L,{options:{replaceSrc:function(e){return e.src.replace(/\.\w+$/,function(e){return"@2x"+e})},ratio:1},proto:{initRetina:function(){var n,o;1<window.devicePixelRatio&&(n=f.st.retina,o=n.ratio,1<(o=isNaN(o)?o():o)&&(d("ImageHasSize."+L,function(e,t){t.img.css({"max-width":t.img[0].naturalWidth/o,width:"100%"})}),d("ElementParse."+L,function(e,t){t.src=n.replaceSrc(t,o)})))}}}),a()});