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