芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/portpulselogistics.com/public/themes/html/assets/js/libraries/justifiedGallery.js
/**! justifiedGallery */ ;(function(e){e.fn.justifiedGallery=function(t){function n(e,t,n){var r;r=e>t?e:t;if(r<=100){return n.settings.sizeRangeSuffixes.lt100}else if(r<=240){return n.settings.sizeRangeSuffixes.lt240}else if(r<=320){return n.settings.sizeRangeSuffixes.lt320}else if(r<=500){return n.settings.sizeRangeSuffixes.lt500}else if(r<=640){return n.settings.sizeRangeSuffixes.lt640}else{return n.settings.sizeRangeSuffixes.lt1024}}function r(t){e(t.currentTarget).find(".caption").slideDown("fast")}function i(t){e(t.currentTarget).find(".caption").slideUp("fast")}function s(t,s,o,u,a,f,l){var c=t.find("img");c.css("width",u);c.css("height",a);c.css("margin-left",-u/2);c.css("margin-top",-a/2);t.width(u);t.height(f);t.css("top",o);t.css("left",s);var h=c.attr("src");var p=h.replace(l.settings.extension,"").replace(l.usedSizeRangeRegExp,"")+n(u,a,l)+h.match(l.settings.extension)[0];c.one("error",function(){c.attr("src",c.data("jg.originalSrc"))});t.stop().fadeTo(300,1,function(){if(h!==p){c.attr("src",p)}});var d=t.data("jg.captionMouseEvents");if(l.settings.captions===true){var v=t.find(".caption");if(v.length===0){var m=c.attr("alt");if(typeof m==="undefined")m=t.attr("title");if(typeof m!=="undefined"){v=e('
'+m+"
");t.append(v);v.hide()}}if(v.length!==0&&typeof d==="undefined"){d={mouseenter:r,mouseleave:i};t.on("mouseenter",d.mouseenter);t.on("mouseleave",d.mouseleave);t.data("jg.captionMouseEvents",d)}}else{if(typeof d!=="undefined"){t.off("mouseenter",d.mouseenter);t.off("mouseleave",d.mouseleave);t.removeData("jg.captionMouseEvents")}}}function o(e,t){var n,r,i,s,o,u,a=true;var f=0;var l=e.galleryWidth;var c=l-e.buildingRow.width-(e.buildingRow.entriesBuff.length-1)*e.settings.margins;if(t&&e.settings.lastRow==="hide"&&c/l>.35){for(n=0;n
.35)a=false;for(n=0;n
u)f=u}if(e.settings.fixedHeight)f=e.settings.rowHeight;return f}function u(e){e.lastAnalyzedIndex=-1;e.buildingRow.entriesBuff=[];e.buildingRow.width=0;e.offY=0;e.firstRowFlushed=false}function a(e,t){var n,r,i,u=0;i=o(e,t);if(t&&e.settings.lastRow==="hide"&&i===-1){e.buildingRow.entriesBuff=[];e.buildingRow.width=0;return}if(e.settings.maxRowHeight>0&&e.settings.maxRowHeight
=t.entries.length-1;if(t.buildingRow.width+(t.settings.fixedHeight?u:u/2)+(t.buildingRow.entriesBuff.length-1)*t.settings.margins>t.galleryWidth){a(t,r);if(++t.yield.flushed>=t.yield.every){p(t,n);return}}t.buildingRow.entriesBuff.push(s);t.buildingRow.width+=u;t.lastAnalyzedIndex=i}else if(o.data("jg.loaded")!=="error"){return}}if(t.buildingRow.entriesBuff.length>0)a(t,r);if(t.spinner.active){t.spinner.active=false;t.$gallery.height(t.$gallery.height()-t.spinner.$el.innerHeight());t.spinner.$el.detach();c(t.spinner)}h(t);if(!n)t.$gallery.trigger("jg.complete");else t.$gallery.trigger("jg.resize")}function v(e){function t(t){if(typeof e.settings.sizeRangeSuffixes[t]!=="string")throw"sizeRangeSuffixes."+t+" must be a string"}function n(t){if(typeof e.settings[t]==="string"){e.settings[t]=parseInt(e.settings[t],10);if(isNaN(e.settings[t]))throw"invalid number for "+t}else if(typeof e.settings[t]==="number"){if(isNaN(e.settings[t]))throw"invalid number for "+t}else{throw t+" must be a number"}}if(typeof e.settings.sizeRangeSuffixes!=="object")throw"sizeRangeSuffixes must be defined and must be an object";t("lt100");t("lt240");t("lt320");t("lt500");t("lt640");t("lt1024");n("rowHeight");n("maxRowHeight");n("margins");if(e.settings.lastRow!=="nojustify"&&e.settings.lastRow!=="justify"&&e.settings.lastRow!=="hide"){throw'lastRow must be "nojustify", "justify" or "hide"'}if(typeof e.settings.fixedHeight!=="boolean"){throw"fixedHeight must be a boolean"}if(typeof e.settings.captions!=="boolean"){throw"captions must be a boolean"}n("refreshTime");if(typeof e.settings.randomize!=="boolean"){throw"randomize must be a boolean"}}var m={sizeRangeSuffixes:{lt100:"",lt240:"",lt320:"",lt500:"",lt640:"",lt1024:""},rowHeight:120,maxRowHeight:0,margins:1,lastRow:"nojustify",fixedHeight:false,captions:true,rel:null,target:null,extension:/\.[^.]+$/,refreshTime:250,randomize:false};return this.each(function(n,r){var i=e(r);i.addClass("justified-gallery");var s=i.data("jg.context");if(typeof s==="undefined"){if(typeof t!=="undefined"&&t!==null&&typeof t!=="object")throw"The argument must be an object";var o=e('
');s={settings:e.extend({},m,t),imgAnalyzerTimeout:null,entries:null,buildingRow:{entriesBuff:[],width:0},lastAnalyzedIndex:-1,firstRowFlushed:false,yield:{every:2,flushed:0},offY:0,spinner:{active:false,phase:0,timeslot:150,$el:o,$points:o.find("span"),intervalId:null},checkWidthIntervalId:null,galleryWidth:i.width(),$gallery:i};i.data("jg.context",s)}else if(t==="norewind"){}else{s.settings=e.extend({},s.settings,t);u(s)}v(s);s.entries=i.find("a").toArray();if(s.entries.length===0)return;if(s.settings.randomize){s.entries.sort(function(){return Math.random()*2-1});e.each(s.entries,function(){e(this).appendTo(i)})}s.usedSizeRangeRegExp=new RegExp("("+s.settings.sizeRangeSuffixes.lt100+"|"+s.settings.sizeRangeSuffixes.lt240+"|"+s.settings.sizeRangeSuffixes.lt320+"|"+s.settings.sizeRangeSuffixes.lt500+"|"+s.settings.sizeRangeSuffixes.lt640+"|"+s.settings.sizeRangeSuffixes.lt1024+")$");if(s.settings.maxRowHeight>0&&s.settings.maxRowHeight