/*! * justifiedgallery - v3.7.0 * http://miromannino.github.io/justified-gallery/ * copyright (c) 2018 miro mannino * licensed under the mit license. */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,i){return void 0===i&&(i="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(i),i}:e(jquery)}(function(g){var r=function(t,i){this.settings=i,this.checksettings(),this.imganalyzertimeout=null,this.entries=null,this.buildingrow={entriesbuff:[],width:0,height:0,aspectratio:0},this.lastfetchedentry=null,this.lastanalyzedindex=-1,this.yield={every:2,flushed:0},this.border=0<=i.border?i.border:i.margins,this.maxrowheight=this.retrievemaxrowheight(),this.suffixranges=this.retrievesuffixranges(),this.offy=this.border,this.rows=0,this.spinner={phase:0,timeslot:150,$el:g('
'),intervalid:null},this.scrollbaron=!1,this.checkwidthintervalid=null,this.gallerywidth=t.width(),this.$gallery=t};r.prototype.getsuffix=function(t,i){var e,s;for(e=i .caption");return 0===i.length?null:i},r.prototype.displayentry=function(t,i,e,s,n,r){t.width(s),t.height(r),t.css("top",e),t.css("left",i);var o=this.imgfromentry(t);if(null!==o){o.css("width",s),o.css("height",n),o.css("margin-left",-s/2),o.css("margin-top",-n/2);var a=o.attr("src"),h=this.newsrc(a,s,n,o[0]);o.one("error",function(){o.attr("src",o.data("jg.originalsrc"))});var l=function(){a!==h&&o.attr("src",h)};"skipped"===t.data("jg.loaded")?this.onimageevent(a,g.proxy(function(){this.showimg(t,l),t.data("jg.loaded",!0)},this)):this.showimg(t,l)}else this.showimg(t);this.displayentrycaption(t)},r.prototype.displayentrycaption=function(t){var i=this.imgfromentry(t);if(null!==i&&this.settings.captions){var e=this.captionfromentry(t);if(null===e){var s=i.attr("alt");this.isvalidcaption(s)||(s=t.attr("title")),this.isvalidcaption(s)&&(e=g('
'+s+"
"),t.append(e),t.data("jg.createdcaption",!0))}null!==e&&(this.settings.cssanimation||e.stop().fadeto(0,this.settings.captionsettings.nonvisibleopacity),this.addcaptioneventshandlers(t))}else this.removecaptioneventshandlers(t)},r.prototype.isvalidcaption=function(t){return void 0!==t&&0this.settings.justifythreshold;if(t&&"hide"===this.settings.lastrow&&!u){for(i=0;i img, > a > img").fadeto(0,0));return-1}for(t&&!u&&"justify"!==this.settings.lastrow&&"hide"!==this.settings.lastrow&&(o=!1,0this.settings.justifythreshold)),i=0;ig(window).height()}r.prototype.remembergalleryheight=function(){i=this.$gallery.height(),this.$gallery.height(i)},r.prototype.setgallerytempheight=function(t){i=math.max(t,i),this.$gallery.height(i)},r.prototype.setgalleryfinalheight=function(t){i=t,this.$gallery.height(t)},r.prototype.checkwidth=function(){this.checkwidthintervalid=setinterval(g.proxy(function(){if(this.$gallery.is(":visible")){var t=parsefloat(this.$gallery.width());e()===this.scrollbaron?math.abs(t-this.gallerywidth)>this.settings.refreshsensitivity&&(this.gallerywidth=t,this.rewind(),this.remembergalleryheight(),this.startimganalyzer(!0)):(this.scrollbaron=e(),this.gallerywidth=t)}},this),this.settings.refreshtime)},r.prototype.isspinneractive=function(){return null!==this.spinner.intervalid},r.prototype.getspinnerheight=function(){return this.spinner.$el.innerheight()},r.prototype.stoploadingspinneranimation=function(){clearinterval(this.spinner.intervalid),this.spinner.intervalid=null,this.setgallerytempheight(this.$gallery.height()-this.getspinnerheight()),this.spinner.$el.detach()},r.prototype.startloadingspinneranimation=function(){var t=this.spinner,i=t.$el.find("span");clearinterval(t.intervalid),this.$gallery.append(t.$el),this.setgallerytempheight(this.offy+this.buildingrow.height+this.getspinnerheight()),t.intervalid=setinterval(function(){t.phase=this.yield.every))return void this.startimganalyzer(t);this.buildingrow.entriesbuff.push(e),this.buildingrow.aspectratio+=n,this.buildingrow.width+=n*this.settings.rowheight,this.lastanalyzedindex=i}else if("error"!==e.data("jg.loaded"))return}0 img, > a > img",triggerevent:function(t){this.$gallery.trigger(t)}},g.fn.justifiedgallery=function(n){return this.each(function(t,i){var e=g(i);e.addclass("justified-gallery");var s=e.data("jg.controller");if(void 0===s){if(null!=n&&"object"!==g.type(n)){if("destroy"===n)return;throw"the argument must be an object"}s=new r(e,g.extend({},r.prototype.defaults,n)),e.data("jg.controller",s)}else if("norewind"===n);else{if("destroy"===n)return void s.destroy();s.updatesettings(n),s.rewind()}s.updateentries("norewind"===n)&&s.init()})}});