PageSourceSearch

https://www.henryusa.com/wp-content/themes/henry/min/js/justifiedGallery.min.js?ver=1.0

js henryusa.com collected 2026-09-24 18:52:48 UTC 18,226 bytes, 1 lines download raw bytes

1(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(l){function n(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:l('<div class="spinner"><span></span><span></span><span></span></div>'),intervalId:null},this.scrollBarOn=!1,this.checkWidthIntervalId=null,this.galleryWidth=t.width(),this.$gallery=t}n.prototype.getSuffix=function(t,i){for(var e=i<t?t:i,s=0;s<this.suffixRanges.length;s++)if(e<=this.suffixRanges[s])return this.settings.sizeRangeSuffixes[this.suffixRanges[s]];return this.settings.sizeRangeSuffixes[this.suffixRanges[s-1]]},n.prototype.removeSuffix=function(t,i){return t.substring(0,t.length-i.length)},n.prototype.endsWith=function(t,i){return-1!==t.indexOf(i,t.length-i.length)},n.prototype.getUsedSuffix=function(t){for(var i in this.settings.sizeRangeSuffixes)if(this.settings.sizeRangeSuffixes.hasOwnProperty(i)&&0!==this.settings.sizeRangeSuffixes[i].length&&this.endsWith(t,this.settings.sizeRangeSuffixes[i]))return this.settings.sizeRangeSuffixes[i];return""},n.prototype.newSrc=function(t,i,e,s){var n;return this.settings.thumbnailPath?n=this.settings.thumbnailPath(t,i,e,s):(s=null!==(s=t.match(this.settings.extension))?s[0]:"",n=t.replace(this.settings.extension,""),n=this.removeSuffix(n,this.getUsedSuffix(n)),n+=this.getSuffix(i,e)+s),n},n.prototype.showImg=function(t,i){this.settings.cssAnimation?(t.addClass("entry-visible"),i&&i()):(t.stop().fadeTo(this.settings.imagesAnimationDuration,1,i),t.find(this.settings.imgSelector).stop().fadeTo(this.settings.imagesAnimationDuration,1,i))},n.prototype.extractImgSrcFromImage=function(t){var i=void 0!==t.data("safe-src")?t.data("safe-src"):t.attr("src");return t.data("jg.originalSrc",i),i},n.prototype.imgFromEntry=function(t){t=t.find(this.settings.imgSelector);return 0===t.length?null:t},n.prototype.captionFromEntry=function(t){t=t.find("> .caption");return 0===t.length?null:t},n.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,a,h,g=this.imgFromEntry(t);null!==g?(g.css("width",s),g.css("height",n),g.css("margin-left",-s/2),g.css("margin-top",-n/2),o=g.attr("src"),a=this.newSrc(o,s,n,g[0]),g.one("error",function(){g.attr("src",g.data("jg.originalSrc"))}),h=function(){o!==a&&g.attr("src",a)},"skipped"===t.data("jg.loaded")?this.onImageEvent(o,l.proxy(function(){this.showImg(t,h),t.data("jg.loaded",!0)},this)):this.showImg(t,h)):this.showImg(t),this.displayEntryCaption(t)},n.prototype.displayEntryCaption=function(t){var i,e=this.imgFromEntry(t);null!==e&&this.settings.captions?(null===(i=this.captionFromEntry(t))&&(e=e.attr("alt"),this.isValidCaption(e)||(e=t.attr("title")),this.isValidCaption(e))&&(i=l('<div class="caption">'+e+"</div>"),t.append(i),t.data("jg.createdCaption",!0)),null!==i&&(this.settings.cssAnimation||i.stop().fadeTo(0,this.settings.captionSettings.nonVisibleOpacity),this.addCaptionEventsHandlers(t))):this.removeCaptionEventsHandlers(t)},n.prototype.isValidCaption=function(t){return void 0!==t&&0<t.length},n.prototype.onEntryMouseEnterForCaption=function(t){t=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?t.addClass("caption-visible").removeClass("caption-hidden"):t.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.visibleOpacity)},n.prototype.onEntryMouseLeaveForCaption=function(t){t=this.captionFromEntry(l(t.currentTarget));this.settings.cssAnimation?t.removeClass("caption-visible").removeClass("caption-hidden"):t.stop().fadeTo(this.settings.captionSettings.animationDuration,this.settings.captionSettings.nonVisibleOpacity)},n.prototype.addCaptionEventsHandlers=function(t){var i;void 0===t.data("jg.captionMouseEvents")&&(i={mouseenter:l.proxy(this.onEntryMouseEnterForCaption,this),mouseleave:l.proxy(this.onEntryMouseLeaveForCaption,this)},t.on("mouseenter",void 0,void 0,i.mouseenter),t.on("mouseleave",void 0,void 0,i.mouseleave),t.data("jg.captionMouseEvents",i))},n.prototype.removeCaptionEventsHandlers=function(t){var i=t.data("jg.captionMouseEvents");void 0!==i&&(t.off("mouseenter",void 0,i.mouseenter),t.off("mouseleave",void 0,i.mouseleave),t.removeData("jg.captionMouseEvents"))},n.prototype.clearBuildingRow=function(){this.buildingRow.entriesBuff=[],this.buildingRow.aspectRatio=0,this.buildingRow.width=0},n.prototype.prepareBuildingRow=function(t){var i,e,s,n,r=!0,o=0,a=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,h=a/this.buildingRow.aspectRatio,g=this.settings.rowHeight,l=this.buildingRow.width/a>this.settings.justifyThreshold;if(t&&"hide"===this.settings.lastRow&&!l){for(i=0;i<this.buildingRow.entriesBuff.length;i++)e=this.buildingRow.entriesBuff[i],this.settings.cssAnimation?e.removeClass("entry-visible"):(e.stop().fadeTo(0,.1),e.find("> img, > a > img").fadeTo(0,0));return-1}for(t&&!l&&"justify"!==this.settings.lastRow&&"hide"!==this.settings.lastRow&&(r=!1,0<this.rows)&&(r=(g=(this.offY-this.border-this.settings.margins*this.rows)/this.rows)*this.buildingRow.aspectRatio/a>this.settings.justifyThreshold),i=0;i<this.buildingRow.entriesBuff.length;i++)n=(e=this.buildingRow.entriesBuff[i]).data("jg.width")/e.data("jg.height"),n=r?(s=i===this.buildingRow.entriesBuff.length-1?a:h*n,h):(s=g*n,g),a-=Math.round(s),e.data("jg.jwidth",Math.round(s)),e.data("jg.jheight",Math.
1ceil(n)),(0===i||n<o)&&(o=n);return this.buildingRow.height=o,r},n.prototype.flushRow=function(t){var i,e=this.settings,s=this.border,n=this.prepareBuildingRow(t);if(t&&"hide"===e.lastRow&&-1===n)this.clearBuildingRow();else{if(this.maxRowHeight&&this.maxRowHeight<this.buildingRow.height&&(this.buildingRow.height=this.maxRowHeight),t&&("center"===e.lastRow||"right"===e.lastRow)){for(var r=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*e.margins,o=0;o<this.buildingRow.entriesBuff.length;o++)r-=(i=this.buildingRow.entriesBuff[o]).data("jg.jwidth");"center"===e.lastRow?s+=r/2:"right"===e.lastRow&&(s+=r)}var a=this.buildingRow.entriesBuff.length-1;for(o=0;o<=a;o++)i=this.buildingRow.entriesBuff[this.settings.rtl?a-o:o],this.displayEntry(i,s,this.offY,i.data("jg.jwidth"),i.data("jg.jheight"),this.buildingRow.height),s+=i.data("jg.jwidth")+e.margins;this.galleryHeightToSet=this.offY+this.buildingRow.height+this.border,this.setGalleryTempHeight(this.galleryHeightToSet+this.getSpinnerHeight()),(!t||this.buildingRow.height<=e.rowHeight&&n)&&(this.offY+=this.buildingRow.height+e.margins,this.rows+=1,this.clearBuildingRow(),this.settings.triggerEvent.call(this,"jg.rowflush"))}};var i=0;function e(){return l("body").height()>l(window).height()}n.prototype.rememberGalleryHeight=function(){i=this.$gallery.height(),this.$gallery.height(i)},n.prototype.setGalleryTempHeight=function(t){i=Math.max(t,i),this.$gallery.height(i)},n.prototype.setGalleryFinalHeight=function(t){i=t,this.$gallery.height(t)},n.prototype.checkWidth=function(){this.checkWidthIntervalId=setInterval(l.proxy(function(){var t;this.$gallery.is(":visible")&&(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)},n.prototype.isSpinnerActive=function(){return null!==this.spinner.intervalId},n.prototype.getSpinnerHeight=function(){return this.spinner.$el.innerHeight()},n.prototype.stopLoadingSpinnerAnimation=function(){clearInterval(this.spinner.intervalId),this.spinner.intervalId=null,this.setGalleryTempHeight(this.$gallery.height()-this.getSpinnerHeight()),this.spinner.$el.detach()},n.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<i.length?i.eq(t.phase).fadeTo(t.timeSlot,1):i.eq(t.phase-i.length).fadeTo(t.timeSlot,0),t.phase=(t.phase+1)%(2*i.length)},t.timeSlot)},n.prototype.rewind=function(){this.lastFetchedEntry=null,this.lastAnalyzedIndex=-1,this.offY=this.border,this.rows=0,this.clearBuildingRow()},n.prototype.updateEntries=function(t){t=(t&&null!=this.lastFetchedEntry?l(this.lastFetchedEntry).nextAll(this.settings.selector):(this.entries=[],this.$gallery.children(this.settings.selector))).toArray();return 0<t.length&&(l.isFunction(this.settings.sort)?t=this.sortArray(t):this.settings.randomize&&(t=this.shuffleArray(t)),this.lastFetchedEntry=t[t.length-1],this.settings.filter?t=this.filterArray(t):this.resetFilters(t)),this.entries=this.entries.concat(t),!0},n.prototype.insertToGallery=function(t){var i=this;l.each(t,function(){l(this).appendTo(i.$gallery)})},n.prototype.shuffleArray=function(t){for(var i,e,s=t.length-1;0<s;s--)i=Math.floor(Math.random()*(s+1)),e=t[s],t[s]=t[i],t[i]=e;return this.insertToGallery(t),t},n.prototype.sortArray=function(t){return t.sort(this.settings.sort),this.insertToGallery(t),t},n.prototype.resetFilters=function(t){for(var i=0;i<t.length;i++)l(t[i]).removeClass("jg-filtered")},n.prototype.filterArray=function(t){var i=this.settings;if("string"===l.type(i.filter))return t.filter(function(t){t=l(t);return t.is(i.filter)?(t.removeClass("jg-filtered"),!0):(t.addClass("jg-filtered").removeClass("jg-visible"),!1)});if(l.isFunction(i.filter)){for(var e=t.filter(i.filter),s=0;s<t.length;s++)-1===e.indexOf(t[s])?l(t[s]).addClass("jg-filtered").removeClass("jg-visible"):l(t[s]).removeClass("jg-filtered");return e}},n.prototype.destroy=function(){clearInterval(this.checkWidthIntervalId),l.each(this.entries,l.proxy(function(t,i){var i=l(i),e=(i.css("width",""),i.css("height",""),i.css("top",""),i.css("left",""),i.data("jg.loaded",void 0),i.removeClass("jg-entry"),this.imgFromEntry(i)),e=(e.css("width",""),e.css("height",""),e.css("margin-left",""),e.css("margin-top",""),e.attr("src",e.data("jg.originalSrc")),e.data("jg.originalSrc",void 0),this.removeCaptionEventsHandlers(i),this.captionFromEntry(i));i.data("jg.createdCaption")?(i.data("jg.createdCaption",void 0),null!==e&&e.remove()):null!==e&&e.fadeTo(0,1)},this)),this.$gallery.css("height",""),this.$gallery.removeClass("justified-gallery"),this.$gallery.data("jg.controller",void 0)}
1,n.prototype.analyzeImages=function(t){for(var i=this.lastAnalyzedIndex+1;i<this.entries.length;i++){var e=l(this.entries[i]);if(!0===e.data("jg.loaded")||"skipped"===e.data("jg.loaded")){var s=this.galleryWidth-2*this.border-(this.buildingRow.entriesBuff.length-1)*this.settings.margins,n=e.data("jg.width")/e.data("jg.height");if(s/(this.buildingRow.aspectRatio+n)<this.settings.rowHeight&&(this.flushRow(!1),++this.yield.flushed>=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<this.buildingRow.entriesBuff.length&&this.flushRow(!0),this.isSpinnerActive()&&this.stopLoadingSpinnerAnimation(),this.stopImgAnalyzerStarter(),this.settings.triggerEvent.call(this,t?"jg.resize":"jg.complete"),this.setGalleryFinalHeight(this.galleryHeightToSet)},n.prototype.stopImgAnalyzerStarter=function(){this.yield.flushed=0,null!==this.imgAnalyzerTimeout&&(clearTimeout(this.imgAnalyzerTimeout),this.imgAnalyzerTimeout=null)},n.prototype.startImgAnalyzer=function(t){var i=this;this.stopImgAnalyzerStarter(),this.imgAnalyzerTimeout=setTimeout(function(){i.analyzeImages(t)},.001)},n.prototype.onImageEvent=function(t,i,e){var s,n;(i||e)&&(s=new Image,n=l(s),i&&n.one("load",function(){n.off("load error"),i(s)}),e&&n.one("error",function(){n.off("load error"),e(s)}),s.src=t)},n.prototype.init=function(){var r=!1,o=!1,a=this;l.each(this.entries,function(t,i){var e=l(i),i=a.imgFromEntry(e);if(e.addClass("jg-entry"),!0!==e.data("jg.loaded")&&"skipped"!==e.data("jg.loaded"))if(null!==a.settings.rel&&e.attr("rel",a.settings.rel),null!==a.settings.target&&e.attr("target",a.settings.target),null!==i){var s=a.extractImgSrcFromImage(i);if(i.attr("src",s),!1===a.settings.waitThumbnailsLoad){var n=parseFloat(i.prop("width")),i=parseFloat(i.prop("height"));if(!isNaN(n)&&!isNaN(i))return e.data("jg.width",n),e.data("jg.height",i),e.data("jg.loaded","skipped"),o=!0,a.startImgAnalyzer(!1),!0}e.data("jg.loaded",!1),r=!0,a.isSpinnerActive()||a.startLoadingSpinnerAnimation(),a.onImageEvent(s,function(t){e.data("jg.width",t.width),e.data("jg.height",t.height),e.data("jg.loaded",!0),a.startImgAnalyzer(!1)},function(){e.data("jg.loaded","error"),a.startImgAnalyzer(!1)})}else e.data("jg.loaded",!0),e.data("jg.width",e.width()|parseFloat(e.css("width"))|1),e.data("jg.height",e.height()|parseFloat(e.css("height"))|1)}),r||o||this.startImgAnalyzer(!1),this.checkWidth()},n.prototype.checkOrConvertNumber=function(t,i){if("string"===l.type(t[i])&&(t[i]=parseFloat(t[i])),"number"!==l.type(t[i]))throw i+" must be a number";if(isNaN(t[i]))throw"invalid number for "+i},n.prototype.checkSizeRangesSuffixes=function(){if("object"!==l.type(this.settings.sizeRangeSuffixes))throw"sizeRangeSuffixes must be defined and must be an object";var t,i=[];for(t in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(t)&&i.push(t);for(var e={0:""},s=0;s<i.length;s++)if("string"===l.type(i[s]))try{e[parseInt(i[s].replace(/^[a-z]+/,""),10)]=this.settings.sizeRangeSuffixes[i[s]]}catch(t){throw"sizeRangeSuffixes keys must contains correct numbers ("+t+")"}else e[i[s]]=this.settings.sizeRangeSuffixes[i[s]];this.settings.sizeRangeSuffixes=e},n.prototype.retrieveMaxRowHeight=function(){var t=null,i=this.settings.rowHeight;if("string"===l.type(this.settings.maxRowHeight))t=this.settings.maxRowHeight.match(/^[0-9]+%$/)?i*parseFloat(this.settings.maxRowHeight.match(/^([0-9]+)%$/)[1])/100:parseFloat(this.settings.maxRowHeight);else{if("number"!==l.type(this.settings.maxRowHeight)){if(!1===this.settings.maxRowHeight||null==this.settings.maxRowHeight)return null;throw"maxRowHeight must be a number or a percentage"}t=this.settings.maxRowHeight}if(isNaN(t))throw"invalid number for maxRowHeight";return t=t<i?i:t},n.prototype.checkSettings=function(){this.checkSizeRangesSuffixes(),this.checkOrConvertNumber(this.settings,"rowHeight"),this.checkOrConvertNumber(this.settings,"margins"),this.checkOrConvertNumber(this.settings,"border");var t=["justify","nojustify","left","center","right","hide"];if(-1===t.indexOf(this.settings.lastRow))throw"lastRow must be one of: "+t.join(", ");
vendor: 3,055 bytes, line 1
1if(this.checkOrConvertNumber(this.settings,"justifyThreshold"),this.settings.justifyThreshold<0||1<this.settings.justifyThreshold)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!==l.type(this.settings.cssAnimation))throw"cssAnimation must be a boolean";if("boolean"!==l.type(this.settings.captions))throw"captions must be a boolean";if(this.checkOrConvertNumber(this.settings.captionSettings,"animationDuration"),this.checkOrConvertNumber(this.settings.captionSettings,"visibleOpacity"),this.settings.captionSettings.visibleOpacity<0||1<this.settings.captionSettings.visibleOpacity)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings.captionSettings,"nonVisibleOpacity"),this.settings.captionSettings.nonVisibleOpacity<0||1<this.settings.captionSettings.nonVisibleOpacity)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if(this.checkOrConvertNumber(this.settings,"imagesAnimationDuration"),this.checkOrConvertNumber(this.settings,"refreshTime"),this.checkOrConvertNumber(this.settings,"refreshSensitivity"),"boolean"!==l.type(this.settings.randomize))throw"randomize must be a boolean";if("string"!==l.type(this.settings.selector))throw"selector must be a string";if(!1!==this.settings.sort&&!l.isFunction(this.settings.sort))throw"sort must be false or a comparison function";if(!1!==this.settings.filter&&!l.isFunction(this.settings.filter)&&"string"!==l.type(this.settings.filter))throw"filter must be false, a string or a filter function"},n.prototype.retrieveSuffixRanges=function(){var t,i=[];for(t in this.settings.sizeRangeSuffixes)this.settings.sizeRangeSuffixes.hasOwnProperty(t)&&i.push(parseInt(t,10));return i.sort(function(t,i){return i<t?1:t<i?-1:0}),i},n.prototype.updateSettings=function(t){this.settings=l.extend({},this.settings,t),this.checkSettings(),this.border=0<=this.settings.border?this.settings.border:this.settings.margins,this.maxRowHeight=this.retrieveMaxRowHeight(),this.suffixRanges=this.retrieveSuffixRanges()},n.prototype.defaults={sizeRangeSuffixes:{},thumbnailPath:void 0,rowHeight:120,maxRowHeight:!1,margins:1,border:-1,lastRow:"nojustify",justifyThreshold:.9,waitThumbnailsLoad:!0,captions:!0,cssAnimation:!0,imagesAnimationDuration:500,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.\\/]+$/,refreshTime:200,refreshSensitivity:0,randomize:!1,rtl:!1,sort:!1,filter:!1,selector:"a, div:not(.spinner)",imgSelector:"> img, > a > img",triggerEvent:function(t){this.$gallery.trigger(t)}},l.fn.justifiedGallery=function(s){return this.each(function(t,i){var i=l(i),e=(i.addClass("justified-gallery"),i.data("jg.controller"));if(void 0===e){if(null!=s&&"object"!==l.type(s)){if("destroy"===s)return;throw"The argument must be an object"}e=new n(i,l.extend({},n.prototype.defaults,s)),i.data("jg.controller",e)}else if("norewind"!==s){if("destroy"===s)return void e.destroy();e.updateSettings(s),e.rewind()}e.updateEntries("norewind"===s)&&e.init()})}});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.