/*!
* lightbox v2.11.3
* by lokesh dhakar
*
* more info:
* http://lokeshdhakar.com/projects/lightbox2/
*
* copyright lokesh dhakar
* released under the mit license
* https://github.com/lokesh/lightbox2/blob/master/license
*
* @preserve
*/
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],b):"object"==typeof exports?module.exports=b(require("jquery")):a.lightbox=b(a.jquery)}(this,function(a){function b(b){this.album=[],this.currentimageindex=void 0,this.init(),this.options=a.extend({},this.constructor.defaults),this.option(b)}return b.defaults={albumlabel:"image %1 of %2",alwaysshownavontouchdevices:!1,fadeduration:600,fitimagesinviewport:!0,imagefadeduration:600,positionfromtop:50,resizeduration:700,showimagenumberlabel:!0,wraparound:!1,disablescrolling:!1,sanitizetitle:!1},b.prototype.option=function(b){a.extend(this.options,b)},b.prototype.imagecountlabel=function(a,b){return this.options.albumlabel.replace(/%1/g,a).replace(/%2/g,b)},b.prototype.init=function(){var b=this;a(document).ready(function(){b.enable(),b.build()})},b.prototype.enable=function(){var b=this;a("body").on("click","a[rel^=lightbox], area[rel^=lightbox], a[data-lightbox], area[data-lightbox]",function(c){return b.start(a(c.currenttarget)),!1})},b.prototype.build=function(){if(!(a("#lightbox").length>0)){var b=this;a('
').appendto(a("body")),this.$lightbox=a("#lightbox"),this.$overlay=a("#lightboxoverlay"),this.$outercontainer=this.$lightbox.find(".lb-outercontainer"),this.$container=this.$lightbox.find(".lb-container"),this.$image=this.$lightbox.find(".lb-image"),this.$nav=this.$lightbox.find(".lb-nav"),this.containerpadding={top:parseint(this.$container.css("padding-top"),10),right:parseint(this.$container.css("padding-right"),10),bottom:parseint(this.$container.css("padding-bottom"),10),left:parseint(this.$container.css("padding-left"),10)},this.imageborderwidth={top:parseint(this.$image.css("border-top-width"),10),right:parseint(this.$image.css("border-right-width"),10),bottom:parseint(this.$image.css("border-bottom-width"),10),left:parseint(this.$image.css("border-left-width"),10)},this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){"lightbox"===a(c.target).attr("id")&&b.end()}),this.$outercontainer.on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),this.$lightbox.find(".lb-prev").on("click",function(){return 0===b.currentimageindex?b.changeimage(b.album.length-1):b.changeimage(b.currentimageindex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.currentimageindex===b.album.length-1?b.changeimage(0):b.changeimage(b.currentimageindex+1),!1}),this.$nav.on("mousedown",function(a){3===a.which&&(b.$nav.css("pointer-events","none"),b.$lightbox.one("contextmenu",function(){settimeout(function(){this.$nav.css("pointer-events","auto")}.bind(b),0)}))}),this.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})}},b.prototype.start=function(b){function c(a){d.album.push({alt:a.attr("data-alt"),link:a.attr("href"),title:a.attr("data-title")||a.attr("title")})}var d=this,e=a(window);e.on("resize",a.proxy(this.sizeoverlay,this)),this.sizeoverlay(),this.album=[];var f,g=0,h=b.attr("data-lightbox");if(h){f=a(b.prop("tagname")+'[data-lightbox="'+h+'"]');for(var i=0;ik||g.height>j)&&(g.width/k>g.height/j?(i=k,h=parseint(g.height/(g.width/i),10),f.width(i),f.height(h)):(h=j,i=parseint(g.width/(g.height/h),10),f.width(i),f.height(h))),c.sizecontainer(f.width(),f.height())},g.src=this.album[b].link,this.currentimageindex=b},b.prototype.sizeoverlay=function(){var b=this;settimeout(function(){b.$overlay.width(a(document).width()).height(a(document).height())},0)},b.prototype.sizecontainer=function(a,b){function c(){d.$lightbox.find(".lb-datacontainer").width(g),d.$lightbox.find(".lb-prevlink").height(h),d.$lightbox.find(".lb-nextlink").height(h),d.$overlay.focus(),d.showimage()}var d=this,e=this.$outercontainer.outerwidth(),f=this.$outercontainer.outerheight(),g=a+this.containerpadding.left+this.containerpadding.right+this.imageborderwidth.left+this.imageborderwidth.right,h=b+this.containerpadding.top+this.containerpadding.bottom+this.imageborderwidth.top+this.imageborderwidth.bottom;e!==g||f!==h?this.$outercontainer.animate({width:g,height:h},this.options.resizeduration,"swing",function(){c()}):c()},b.prototype.showimage=function(){this.$lightbox.find(".lb-loader").stop(!0).hide(),this.$lightbox.find(".lb-image").fadein(this.options.imagefadeduration),this.updatenav(),this.updatedetails(),this.preloadneighboringimages(),this.enablekeyboardnav()},b.prototype.updatenav=function(){var a=!1;try{document.createevent("touchevent"),a=!!this.options.alwaysshownavontouchdevices}catch(a){}this.$lightbox.find(".lb-nav").show(),this.album.length>1&&(this.options.wraparound?(a&&this.$lightbox.find(".lb-prev, .lb-next").css("opacity","1"),this.$lightbox.find(".lb-prev, .lb-next").show()):(this.currentimageindex>0&&(this.$lightbox.find(".lb-prev").show(),a&&this.$lightbox.find(".lb-prev").css("opacity","1")),this.currentimageindex1&&this.options.showimagenumberlabel){var c=this.imagecountlabel(this.currentimageindex+1,this.album.length);this.$lightbox.find(".lb-number").text(c).fadein("fast")}else this.$lightbox.find(".lb-number").hide();this.$outercontainer.removeclass("animating"),this.$lightbox.find(".lb-datacontainer").fadein(this.options.resizeduration,function(){return a.sizeoverlay()})},b.prototype.preloadneighboringimages=function(){if(this.album.length>this.currentimageindex+1){(new image).src=this.album[this.currentimageindex+1].link}if(this.currentimageindex>0){(new image).src=this.album[this.currentimageindex-1].link}},b.prototype.enablekeyboardnav=function(){this.$lightbox.on("keyup.keyboard",a.proxy(this.keyboardaction,this)),this.$overlay.on("keyup.keyboard",a.proxy(this.keyboardaction,this))},b.prototype.disablekeyboardnav=function(){this.$lightbox.off(".keyboard"),this.$overlay.off(".keyboard")},b.prototype.keyboardaction=function(a){var b=a.keycode;27===b?(a.stoppropagation(),this.end()):37===b?0!==this.currentimageindex?this.changeimage(this.currentimageindex-1):this.options.wraparound&&this.album.length>1&&this.changeimage(this.album.length-1):39===b&&(this.currentimageindex!==this.album.length-1?this.changeimage(this.currentimageindex+1):this.options.wraparound&&this.album.length>1&&this.changeimage(0))},b.prototype.end=function(){this.disablekeyboardnav(),a(window).off("resize",this.sizeoverlay),this.$lightbox.fadeout(this.options.fadeduration),this.$overlay.fadeout(this.options.fadeduration),this.options.disablescrolling&&a("body").removeclass("lb-disable-scrolling")},new b});