/*!
* lightbox v2.8.2
* by lokesh dhakar
*
* more info:
* http://lokeshdhakar.com/projects/lightbox2/
*
* copyright 2007, 2015 lokesh dhakar
* released under the mit license
* https://github.com/lokesh/lightbox2/blob/master/license
*/
!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:500,fitimagesinviewport:!0,resizeduration:700,showimagenumberlabel:!0,wraparound:!1,disablescrolling:!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(){this.enable(),this.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(){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.containertoppadding=parseint(this.$container.css("padding-top"),10),this.containerrightpadding=parseint(this.$container.css("padding-right"),10),this.containerbottompadding=parseint(this.$container.css("padding-bottom"),10),this.containerleftpadding=parseint(this.$container.css("padding-left"),10),this.$overlay.hide().on("click",function(){return b.end(),!1}),this.$lightbox.hide().on("click",function(c){return"lightbox"===a(c.target).attr("id")&&b.end(),!1}),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.$lightbox.find(".lb-loader, .lb-close").on("click",function(){return b.end(),!1})},b.prototype.start=function(b){function c(a){d.album.push({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)),a("select, object, embed").css({visibility:"hidden"}),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;ij||e.height>i)&&(e.width/j>e.height/i?(h=j,g=parseint(e.height/(e.width/h),10),d.width(h),d.height(g)):(g=i,h=parseint(e.width/(e.height/g),10),d.width(h),d.height(g)))),c.sizecontainer(d.width(),d.height())},e.src=this.album[b].link,this.currentimageindex=b},b.prototype.sizeoverlay=function(){this.$overlay.width(a(document).width()).height(a(document).height())},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.showimage()}var d=this,e=this.$outercontainer.outerwidth(),f=this.$outercontainer.outerheight(),g=a+this.containerleftpadding+this.containerrightpadding,h=b+this.containertoppadding+this.containerbottompadding;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("slow"),this.updatenav(),this.updatedetails(),this.preloadneighboringimages(),this.enablekeyboardnav()},b.prototype.updatenav=function(){var a=!1;try{document.createevent("touchevent"),a=this.options.alwaysshownavontouchdevices?!0:!1}catch(b){}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 b.sizeoverlay()})},b.prototype.preloadneighboringimages=function(){if(this.album.length>this.currentimageindex+1){var a=new image;a.src=this.album[this.currentimageindex+1].link}if(this.currentimageindex>0){var b=new image;b.src=this.album[this.currentimageindex-1].link}},b.prototype.enablekeyboardnav=function(){a(document).on("keyup.keyboard",a.proxy(this.keyboardaction,this))},b.prototype.disablekeyboardnav=function(){a(document).off(".keyboard")},b.prototype.keyboardaction=function(a){var b=27,c=37,d=39,e=a.keycode,f=string.fromcharcode(e).tolowercase();e===b||f.match(/x|o|c/)?this.end():"p"===f||e===c?0!==this.currentimageindex?this.changeimage(this.currentimageindex-1):this.options.wraparound&&this.album.length>1&&this.changeimage(this.album.length-1):("n"===f||e===d)&&(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),a("select, object, embed").css({visibility:"visible"}),this.options.disablescrolling&&a("body").removeclass("lb-disable-scrolling")},new b});
//# sourcemappingurl=lightbox.min.map