/** * lightbox v2.7.1 * by lokesh dhakar - http://lokeshdhakar.com/projects/lightbox2/ * * @license http://creativecommons.org/licenses/by/2.5/ * - free for use in both personal and commercial projects * - attribution requires leaving author name, author link, and the license info intact */ (function(){var a=jquery,b=function(){function a(){this.fadeduration=500,this.fitimagesinviewport=!0,this.resizeduration=700,this.positionfromtop=50,this.showimagenumberlabel=!0,this.alwaysshownavontouchdevices=!1,this.wraparound=!1}return a.prototype.albumlabel=function(a,b){return"image "+a+" of "+b},a}(),c=function(){function b(a){this.options=a,this.album=[],this.currentimageindex=void 0,this.init()}return 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 b.changeimage(0===b.currentimageindex?b.album.length-1:b.currentimageindex-1),!1}),this.$lightbox.find(".lb-next").on("click",function(){return b.changeimage(b.currentimageindex===b.album.length-1?0: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(window).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").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?this.$lightbox.find(".lb-number").text(this.options.albumlabel(this.currentimageindex+1,this.album.length)).fadein("fast"):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"})},b}();a(function(){{var a=new b;new c(a)}})}).call(this); //# sourcemappingurl=lightbox.min.map