aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--library/justifiedGallery/dist/css/justifiedGallery.min.css7
-rw-r--r--library/justifiedGallery/dist/js/jquery.justifiedGallery.min.js7
-rw-r--r--library/justifiedGallery/jquery.justifiedGallery.js (renamed from library/justifiedGallery/dist/js/jquery.justifiedGallery.js)151
-rw-r--r--library/justifiedGallery/justifiedGallery.css (renamed from library/justifiedGallery/dist/css/justifiedGallery.css)17
-rw-r--r--view/js/main.js2
-rw-r--r--view/php/theme_init.php4
6 files changed, 110 insertions, 78 deletions
diff --git a/library/justifiedGallery/dist/css/justifiedGallery.min.css b/library/justifiedGallery/dist/css/justifiedGallery.min.css
deleted file mode 100644
index f59d7c7c1..000000000
--- a/library/justifiedGallery/dist/css/justifiedGallery.min.css
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- * Justified Gallery - v3.2.0
- * http://miromannino.com/projects/justified-gallery/
- * Copyright (c) 2014 Miro Mannino
- * Licensed under the MIT license.
- */
-@-webkit-keyframes justified-gallery-show-caption-animation{from{opacity:0}to{opacity:.7}}@-moz-keyframes justified-gallery-show-caption-animation{from{opacity:0}to{opacity:.7}}@-o-keyframes justified-gallery-show-caption-animation{from{opacity:0}to{opacity:.7}}@keyframes justified-gallery-show-caption-animation{from{opacity:0}to{opacity:.7}}@-webkit-keyframes justified-gallery-show-entry-animation{from{opacity:0}to{opacity:1}}@-moz-keyframes justified-gallery-show-entry-animation{from{opacity:0}to{opacity:1}}@-o-keyframes justified-gallery-show-entry-animation{from{opacity:0}to{opacity:1}}@keyframes justified-gallery-show-entry-animation{from{opacity:0}to{opacity:1}}.justified-gallery{width:100%;position:relative;overflow:hidden}.justified-gallery>a,.justified-gallery>div{position:absolute;display:inline-block;overflow:hidden;opacity:0;filter:alpha(opacity=0)}.justified-gallery>a>img,.justified-gallery>div>img{position:absolute;top:50%;left:50%;margin:0;padding:0;border:0}.justified-gallery>a>.caption,.justified-gallery>div>.caption{display:none;position:absolute;bottom:0;padding:5px;background-color:#000;left:0;right:0;margin:0;color:#fff;font-size:12px;font-weight:300;font-family:sans-serif}.justified-gallery>a>.caption.caption-visible,.justified-gallery>div>.caption.caption-visible{display:initial;opacity:.7;filter:"alpha(opacity=70)";-webkit-animation:justified-gallery-show-caption-animation 500ms 0 ease;-moz-animation:justified-gallery-show-caption-animation 500ms 0 ease;-ms-animation:justified-gallery-show-caption-animation 500ms 0 ease}.justified-gallery>.entry-visible{opacity:1;filter:alpha(opacity=100);-webkit-animation:justified-gallery-show-entry-animation 300ms 0 ease;-moz-animation:justified-gallery-show-entry-animation 300ms 0 ease;-ms-animation:justified-gallery-show-entry-animation 300ms 0 ease}.justified-gallery>.spinner{position:absolute;bottom:0;margin-left:-24px;padding:10px 0;left:50%;opacity:initial;filter:initial;overflow:initial}.justified-gallery>.spinner>span{display:inline-block;opacity:0;filter:alpha(opacity=0);width:8px;height:8px;margin:0 4px;background-color:#000;border-top-left-radius:6px;border-top-right-radius:6px;border-bottom-right-radius:6px;border-bottom-left-radius:6px} \ No newline at end of file
diff --git a/library/justifiedGallery/dist/js/jquery.justifiedGallery.min.js b/library/justifiedGallery/dist/js/jquery.justifiedGallery.min.js
deleted file mode 100644
index 2b4584466..000000000
--- a/library/justifiedGallery/dist/js/jquery.justifiedGallery.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/*!
- * Justified Gallery - v3.2.0
- * http://miromannino.com/projects/justified-gallery/
- * Copyright (c) 2014 Miro Mannino
- * Licensed under the MIT license.
- */
-!function(a){a.fn.justifiedGallery=function(b){function c(a,b,c){var d;return d=a>b?a:b,100>=d?c.settings.sizeRangeSuffixes.lt100:240>=d?c.settings.sizeRangeSuffixes.lt240:320>=d?c.settings.sizeRangeSuffixes.lt320:500>=d?c.settings.sizeRangeSuffixes.lt500:640>=d?c.settings.sizeRangeSuffixes.lt640:c.settings.sizeRangeSuffixes.lt1024}function d(b){var c=a(b.currentTarget).find(".caption");b.data.settings.cssAnimation?c.addClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(b.data.settings.captionSettings.animationDuration,b.data.settings.captionSettings.visibleOpacity)}function e(b){var c=a(b.currentTarget).find(".caption");b.data.settings.cssAnimation?c.removeClass("caption-visible").removeClass("caption-hidden"):c.stop().fadeTo(b.data.settings.captionSettings.animationDuration,b.data.settings.captionSettings.nonVisibleOpacity)}function f(b,f,g,h,i,j,k){var l=b.find("img");l.css("width",h),l.css("height",i),l.css("margin-left",-h/2),l.css("margin-top",-i/2),b.width(h),b.height(j),b.css("top",g),b.css("left",f);var m=l.attr("src"),n=m.replace(k.settings.extension,"").replace(k.usedSizeRangeRegExp,"")+c(h,i,k)+m.match(k.settings.extension)[0];l.one("error",function(){l.attr("src",l.data("jg.originalSrc"))});var o=function(){m!==n&&l.attr("src",n)};k.settings.cssAnimation?(b.addClass("entry-visible"),o()):b.stop().fadeTo(k.settings.imagesAnimationDuration,1,o);var p=b.data("jg.captionMouseEvents");if(k.settings.captions===!0){var q=b.find(".caption");if(0===q.length){var r=l.attr("alt");"undefined"==typeof r&&(r=b.attr("title")),"undefined"!=typeof r&&(q=a('<div class="caption">'+r+"</div>"),b.append(q))}0!==q.length&&(k.settings.cssAnimation||q.stop().fadeTo(k.settings.imagesAnimationDuration,k.settings.captionSettings.nonVisibleOpacity),"undefined"==typeof p&&(p={mouseenter:d,mouseleave:e},b.on("mouseenter",void 0,k,p.mouseenter),b.on("mouseleave",void 0,k,p.mouseleave),b.data("jg.captionMouseEvents",p)))}else"undefined"!=typeof p&&(b.off("mouseenter",void 0,k,p.mouseenter),b.off("mouseleave",void 0,k,p.mouseleave),b.removeData("jg.captionMouseEvents"))}function g(a,b){var c,d,e,f,g,h,i=!0,j=0,k=a.galleryWidth-(a.buildingRow.entriesBuff.length-1)*a.settings.margins,l=k/a.buildingRow.aspectRatio,m=a.buildingRow.width/k>a.settings.justifyThreshold;if(b&&"hide"===a.settings.lastRow&&!m){for(c=0;c<a.buildingRow.entriesBuff.length;c++)d=a.buildingRow.entriesBuff[c],a.settings.cssAnimation?d.removeClass("entry-visible"):d.stop().fadeTo(0,0);return-1}for(b&&"nojustify"===a.settings.lastRow&&!m&&(i=!1),c=0;c<a.buildingRow.entriesBuff.length;c++)e=a.buildingRow.entriesBuff[c].find("img"),f=e.data("jg.imgw")/e.data("jg.imgh"),i?(g=l*f,h=l):(g=a.settings.rowHeight*f,h=a.settings.rowHeight),e.data("jg.imgw",Math.ceil(g)),e.data("jg.imgh",Math.ceil(h)),(0===c||j>h)&&(j=h);return a.settings.fixedHeight&&j>a.settings.rowHeight&&(j=a.settings.rowHeight),j}function h(a){a.lastAnalyzedIndex=-1,a.buildingRow.entriesBuff=[],a.buildingRow.aspectRatio=0,a.buildingRow.width=0,a.offY=0,a.firstRowFlushed=!1}function i(a,b){var c,d,e,h=0;if(e=g(a,b),b&&"hide"===a.settings.lastRow&&-1===e)return a.buildingRow.entriesBuff=[],a.buildingRow.aspectRatio=0,void(a.buildingRow.width=0);a.settings.maxRowHeight>0&&a.settings.maxRowHeight<e?e=a.settings.maxRowHeight:0===a.settings.maxRowHeight&&1.5*a.settings.rowHeight<e&&(e=1.5*a.settings.rowHeight);for(var i=0;i<a.buildingRow.entriesBuff.length;i++)c=a.buildingRow.entriesBuff[i],d=c.find("img"),f(c,h,a.offY,d.data("jg.imgw"),d.data("jg.imgh"),e,a),h+=d.data("jg.imgw")+a.settings.margins;a.$gallery.height(a.offY+e+(a.spinner.active?a.spinner.$el.innerHeight():0)),b||(a.offY+=e+a.settings.margins,a.buildingRow.entriesBuff=[],a.buildingRow.aspectRatio=0,a.buildingRow.width=0,a.firstRowFlushed=!0,a.$gallery.trigger("jg.rowflush"))}function j(a){a.checkWidthIntervalId=setInterval(function(){var b=parseInt(a.$gallery.width(),10);a.galleryWidth!==b&&(a.galleryWidth=b,h(a),n(a,!0))},a.settings.refreshTime)}function k(a){clearInterval(a.intervalId),a.intervalId=setInterval(function(){a.phase<a.$points.length?a.$points.eq(a.phase).fadeTo(a.timeslot,1):a.$points.eq(a.phase-a.$points.length).fadeTo(a.timeslot,0),a.phase=(a.phase+1)%(2*a.$points.length)},a.timeslot)}function l(a){clearInterval(a.intervalId),a.intervalId=null}function m(a){a.yield.flushed=0,null!==a.imgAnalyzerTimeout&&clearTimeout(a.imgAnalyzerTimeout)}function n(a,b){m(a),a.imgAnalyzerTimeout=setTimeout(function(){o(a,b)},.001),o(a,b)}function o(b,c){for(var d,e=b.lastAnalyzedIndex+1;e<b.entries.length;e++){var f=a(b.entries[e]),g=f.find("img");if(g.data("jg.loaded")===!0){d=b.firstRowFlushed&&e>=b.entries.length-1;var h=b.galleryWidth-(b.buildingRow.entriesBuff.length-1)*b.settings.margins,j=g.data("jg.imgw")/g.data("jg.imgh");if(h/(b.buildingRow.aspectRatio+j)<b.settings.rowHeight&&(i(b,d),++b.yield.flushed>=b.yield.every))return void n(b,c);b.buildingRow.entriesBuff.push(f),b.buildingRow.aspectRatio+=j,b.buildingRow.width+=j*b.settings.rowHeight,b.lastAnalyzedIndex=e}else if("error"!==g.data("jg.loaded"))return}b.buildingRow.entriesBuff.length>0&&i(b,b.firstRowFlushed),b.spinner.active&&(b.spinner.active=!1,b.$gallery.height(b.$gallery.height()-b.spinner.$el.innerHeight()),b.spinner.$el.detach(),l(b.spinner)),m(b),b.$gallery.trigger(c?"jg.resize":"jg.complete")}function p(a){function b(b){if("string"!=typeof a.settings.sizeRangeSuffixes[b])throw"sizeRangeSuffixes."+b+" must be a string"}function c(a,b){if("string"==typeof a[b]){if(a[b]=parseFloat(a[b],10),isNaN(a[b]))throw"invalid number for "+b}else{if("number"!=typeof a[b])throw b+" must be a number";if(isNaN(a[b]))throw"invalid number for "+b}}if("object"!=typeof a.settings.sizeRangeSuffixes)throw"sizeRangeSuffixes must be defined and must be an object";if(b("lt100"),b("lt240"),b("lt320"),b("lt500"),b("lt640"),b("lt1024"),c(a.settings,"rowHeight"),c(a.settings,"maxRowHeight"),c(a.settings,"margins"),"nojustify"!==a.settings.lastRow&&"justify"!==a.settings.lastRow&&"hide"!==a.settings.lastRow)throw'lastRow must be "nojustify", "justify" or "hide"';if(c(a.settings,"justifyThreshold"),a.settings.justifyThreshold<0||a.settings.justifyThreshold>1)throw"justifyThreshold must be in the interval [0,1]";if("boolean"!=typeof a.settings.cssAnimation)throw"cssAnimation must be a boolean";if(c(a.settings.captionSettings,"animationDuration"),c(a.settings,"imagesAnimationDuration"),c(a.settings.captionSettings,"visibleOpacity"),a.settings.captionSettings.visibleOpacity<0||a.settings.captionSettings.visibleOpacity>1)throw"captionSettings.visibleOpacity must be in the interval [0, 1]";if(c(a.settings.captionSettings,"nonVisibleOpacity"),a.settings.captionSettings.visibleOpacity<0||a.settings.captionSettings.visibleOpacity>1)throw"captionSettings.nonVisibleOpacity must be in the interval [0, 1]";if("boolean"!=typeof a.settings.fixedHeight)throw"fixedHeight must be a boolean";if("boolean"!=typeof a.settings.captions)throw"captions must be a boolean";if(c(a.settings,"refreshTime"),"boolean"!=typeof a.settings.randomize)throw"randomize must be a boolean"}var q={sizeRangeSuffixes:{lt100:"_t",lt240:"_m",lt320:"_n",lt500:"",lt640:"_z",lt1024:"_b"},rowHeight:120,maxRowHeight:0,margins:1,lastRow:"nojustify",justifyThreshold:.75,fixedHeight:!1,captions:!0,cssAnimation:!1,imagesAnimationDuration:300,captionSettings:{animationDuration:500,visibleOpacity:.7,nonVisibleOpacity:0},rel:null,target:null,extension:/\.[^.]+$/,refreshTime:250,randomize:!1};return this.each(function(c,d){var e=a(d);e.addClass("justified-gallery");var f=e.data("jg.context");if("undefined"==typeof f){if("undefined"!=typeof b&&null!==b&&"object"!=typeof b)throw"The argument must be an object";var g=a('<div class="spinner"><span></span><span></span><span></span></div>');f={settings:a.extend({},q,b),imgAnalyzerTimeout:null,entries:null,buildingRow:{entriesBuff:[],width:0,aspectRatio:0},lastAnalyzedIndex:-1,firstRowFlushed:!1,"yield":{every:2,flushed:0},offY:0,spinner:{active:!1,phase:0,timeslot:150,$el:g,$points:g.find("span"),intervalId:null},checkWidthIntervalId:null,galleryWidth:e.width(),$gallery:e},e.data("jg.context",f)}else"norewind"===b||(f.settings=a.extend({},f.settings,b),h(f));if(p(f),f.entries=e.find("> a, > div").toArray(),0!==f.entries.length){f.settings.randomize&&(f.entries.sort(function(){return 2*Math.random()-1}),a.each(f.entries,function(){a(this).appendTo(e)})),f.usedSizeRangeRegExp=new RegExp("("+f.settings.sizeRangeSuffixes.lt100+"|"+f.settings.sizeRangeSuffixes.lt240+"|"+f.settings.sizeRangeSuffixes.lt320+"|"+f.settings.sizeRangeSuffixes.lt500+"|"+f.settings.sizeRangeSuffixes.lt640+"|"+f.settings.sizeRangeSuffixes.lt1024+")$"),f.settings.maxRowHeight>0&&f.settings.maxRowHeight<f.settings.rowHeight&&(f.settings.maxRowHeight=f.settings.rowHeight);var i=!1;a.each(f.entries,function(b,c){var d=a(c),g=d.find("img");if(g.data("jg.loaded")!==!0){g.data("jg.loaded",!1),i=!0,f.spinner.active===!1&&(f.spinner.active=!0,e.append(f.spinner.$el),e.height(f.offY+f.spinner.$el.innerHeight()),k(f.spinner)),null!==f.settings.rel&&d.attr("rel",f.settings.rel),null!==f.settings.target&&d.attr("target",f.settings.target);var h="undefined"!=typeof g.data("safe-src")?g.data("safe-src"):g.attr("src");g.data("jg.originalSrc",h),g.attr("src",h);var j=new Image,l=a(j);l.one("load",function(){g.off("load error"),g.data("jg.imgw",j.width),g.data("jg.imgh",j.height),g.data("jg.loaded",!0),n(f,!1)}),l.one("error",function(){g.off("load error"),g.data("jg.loaded","error"),n(f,!1)}),j.src=h}}),i||n(f,!1),j(f)}})}}(jQuery); \ No newline at end of file
diff --git a/library/justifiedGallery/dist/js/jquery.justifiedGallery.js b/library/justifiedGallery/jquery.justifiedGallery.js
index 7754ae437..21679c96d 100644
--- a/library/justifiedGallery/dist/js/jquery.justifiedGallery.js
+++ b/library/justifiedGallery/jquery.justifiedGallery.js
@@ -1,7 +1,7 @@
-/*
- * Justified Gallery - v3.4.0
- * http://miromannino.com/projects/justified-gallery/
- * Copyright (c) 2014 Miro Mannino
+/*!
+ * Justified Gallery - v3.5.4
+ * http://miromannino.github.io/Justified-Gallery/
+ * Copyright (c) 2015 Miro Mannino
* Licensed under the MIT license.
*/
(function($) {
@@ -16,34 +16,37 @@
// Default options
var defaults = {
sizeRangeSuffixes : {
- 'lt100': '_t',
- 'lt240': '_m',
- 'lt320': '_n',
- 'lt500': '',
- 'lt640': '_z',
- 'lt1024': '_b'
+ 'lt100': '', // e.g. Flickr uses '_t'
+ 'lt240': '', // e.g. Flickr uses '_m'
+ 'lt320': '', // e.g. Flickr uses '_n'
+ 'lt500': '', // e.g. Flickr uses ''
+ 'lt640': '', // e.g. Flickr uses '_z'
+ 'lt1024': '', // e.g. Flickr uses '_b'
},
rowHeight : 120,
- maxRowHeight : 0, //negative value = no limits, 0 = 1.5 * rowHeight
+ maxRowHeight : 0, // negative value = no limits, 0 = 1.5 * rowHeight
margins : 1,
+ border: -1, // negative value = same as margins, 0 = disabled
+
lastRow : 'nojustify', // or can be 'justify' or 'hide'
justifyThreshold: 0.75, /* if row width / available space > 0.75 it will be always justified
- (i.e. lastRow setting is not considered) */
+ (i.e. lastRow setting is not considered) */
fixedHeight : false,
waitThumbnailsLoad : true,
captions : true,
cssAnimation: false,
- imagesAnimationDuration : 500, //ignored with css animations
- captionSettings : { //ignored with css animations
+ imagesAnimationDuration : 500, // ignored with css animations
+ captionSettings : { // ignored with css animations
animationDuration : 500,
visibleOpacity : 0.7,
nonVisibleOpacity : 0.0
},
- rel : null, //rewrite the rel of each analyzed links
- target : null, //rewrite the target of all links
+ rel : null, // rewrite the rel of each analyzed links
+ target : null, // rewrite the target of all links
extension : /\.[^.\\/]+$/,
refreshTime : 100,
- randomize : false
+ randomize : false,
+ ignoreElement: null // a comma seperated list of div element selectors to be ignored e.g.: '.someClass, #someId'
};
function getSuffix(width, height, context) {
@@ -136,12 +139,20 @@
}
}
+ function imgFromEntry($entry) {
+ var $img = $entry.find('> img');
+ if ($img.length === 0) $img = $entry.find('> a > img');
+ return $img;
+ }
+
function displayEntry($entry, x, y, imgWidth, imgHeight, rowHeight, context) {
- var $image = $entry.find('img');
+ var $image = imgFromEntry($entry);
$image.css('width', imgWidth);
$image.css('height', imgHeight);
- $image.css('margin-left', - imgWidth / 2);
- $image.css('margin-top', - imgHeight / 2);
+ //if ($entry.get(0) === $image.parent().get(0)) { // this creates an error in link_around_img test
+ $image.css('margin-left', - imgWidth / 2);
+ $image.css('margin-top', - imgHeight / 2);
+ //}
$entry.width(imgWidth);
$entry.height(rowHeight);
$entry.css('top', y);
@@ -165,9 +176,9 @@
}
if ($image.data('jg.loaded') === 'skipped') {
- $image.one('load', function() {
+ onImageEvent(imageSrc, function() {
showImg($entry, loadNewImage, context);
- $image.data('jg.loaded', 'loaded');
+ $image.data('jg.loaded', true);
});
} else {
showImg($entry, loadNewImage, context);
@@ -216,8 +227,8 @@
var settings = context.settings;
var i, $entry, $image, imgAspectRatio, newImgW, newImgH, justify = true;
var minHeight = 0;
- var availableWidth = context.galleryWidth - (
- (context.buildingRow.entriesBuff.length - 1) * settings.margins);
+ var availableWidth = context.galleryWidth - 2 * context.border - (
+ (context.buildingRow.entriesBuff.length - 1) * settings.margins);
var rowHeight = availableWidth / context.buildingRow.aspectRatio;
var justificable = context.buildingRow.width / availableWidth > settings.justifyThreshold;
@@ -237,11 +248,12 @@
if (isLastRow && !justificable && settings.lastRow === 'nojustify') justify = false;
for (i = 0; i < context.buildingRow.entriesBuff.length; i++) {
- $image = context.buildingRow.entriesBuff[i].find('img');
+ $image = imgFromEntry(context.buildingRow.entriesBuff[i]);
imgAspectRatio = $image.data('jg.imgw') / $image.data('jg.imgh');
if (justify) {
- newImgW = rowHeight * imgAspectRatio;
+ newImgW = (i === context.buildingRow.entriesBuff.length - 1) ? availableWidth
+ : rowHeight * imgAspectRatio;
newImgH = rowHeight;
/* With fixedHeight the newImgH must be greater than rowHeight.
@@ -252,13 +264,15 @@
newImgW = settings.rowHeight * imgAspectRatio;
newImgH = settings.rowHeight;
}*/
+
} else {
newImgW = settings.rowHeight * imgAspectRatio;
newImgH = settings.rowHeight;
}
- $image.data('jg.imgw', Math.ceil(newImgW));
- $image.data('jg.imgh', Math.ceil(newImgH));
+ availableWidth -= Math.round(newImgW);
+ $image.data('jg.jimgw', Math.round(newImgW));
+ $image.data('jg.jimgh', Math.ceil(newImgH));
if (i === 0 || minHeight > newImgH) minHeight = newImgH;
}
@@ -273,12 +287,12 @@
context.buildingRow.entriesBuff = [];
context.buildingRow.aspectRatio = 0;
context.buildingRow.width = 0;
- context.offY = 0;
+ context.offY = context.border;
}
function flushRow(context, isLastRow) {
var settings = context.settings;
- var $entry, $image, minHeight, buildingRowRes, offX = 0;
+ var $entry, $image, minHeight, buildingRowRes, offX = context.border;
//DEBUG// console.log('flush (isLastRow: ' + isLastRow + ')');
@@ -298,14 +312,14 @@
for (var i = 0; i < context.buildingRow.entriesBuff.length; i++) {
$entry = context.buildingRow.entriesBuff[i];
- $image = $entry.find('img');
- displayEntry($entry, offX, context.offY, $image.data('jg.imgw'),
- $image.data('jg.imgh'), minHeight, context);
- offX += $image.data('jg.imgw') + settings.margins;
+ $image = imgFromEntry($entry);
+ displayEntry($entry, offX, context.offY, $image.data('jg.jimgw'),
+ $image.data('jg.jimgh'), minHeight, context);
+ offX += $image.data('jg.jimgw') + settings.margins;
}
//Gallery Height
- context.$gallery.height(context.offY + minHeight +
+ context.$gallery.height(context.offY + minHeight + context.border +
(context.spinner.active ? context.spinner.$el.innerHeight() : 0)
);
@@ -375,7 +389,7 @@
console.log('images status: ');
for (var i = 0; i < context.entries.length; i++) {
var $entry = $(context.entries[i]);
- var $image = $entry.find('img');
+ var $image = imgFromEntry($entry);
console.log(i + ' (alt: ' + $image.attr('alt') + 'loaded: ' + $image.data('jg.loaded') + ')');
}*/
@@ -385,12 +399,12 @@
for (var i = context.lastAnalyzedIndex + 1; i < context.entries.length; i++) {
var $entry = $(context.entries[i]);
- var $image = $entry.find('img');
+ var $image = imgFromEntry($entry);
if ($image.data('jg.loaded') === true || $image.data('jg.loaded') === 'skipped') {
isLastRow = i >= context.entries.length - 1;
- var availableWidth = context.galleryWidth - (
+ var availableWidth = context.galleryWidth - 2 * context.border - (
(context.buildingRow.entriesBuff.length - 1) * settings.margins);
var imgAspectRatio = $image.data('jg.imgw') / $image.data('jg.imgh');
if (availableWidth / (context.buildingRow.aspectRatio + imgAspectRatio) < settings.rowHeight) {
@@ -475,6 +489,7 @@
}
checkOrConvertNumber(settings, 'margins');
+ checkOrConvertNumber(settings, 'border');
if (settings.lastRow !== 'nojustify' &&
settings.lastRow !== 'justify' &&
@@ -516,6 +531,30 @@
}
+ function onImageEvent(imageSrc, onLoad, onError) {
+ if (!onLoad && !onError) {
+ return;
+ }
+ /* Check if the image is loaded or not using another image object.
+ We cannot use the 'complete' image property, because some browsers,
+ with a 404 set complete = true */
+ var memImage = new Image();
+ var $memImage = $(memImage);
+ if (onLoad) {
+ $memImage.one('load', function () {
+ $memImage.off('load error');
+ onLoad(memImage);
+ });
+ }
+ if (onError) {
+ $memImage.one('error', function() {
+ $memImage.off('load error');
+ onError(memImage);
+ });
+ }
+ memImage.src = imageSrc;
+ }
+
return this.each(function (index, gallery) {
var $gallery = $(gallery);
@@ -529,10 +568,15 @@
// Spinner init
var $spinner = $('<div class="spinner"><span></span><span></span><span></span></div>');
+ var extendedSettings = $.extend({}, defaults, arg);
+ var border = extendedSettings.border >= 0 ? extendedSettings.border : extendedSettings.margins;
+
+ var ignoreElement = extendedSettings.ignoreElement;
+
//Context init
context = {
- settings : $.extend({}, defaults, arg),
+ settings : extendedSettings,
imgAnalyzerTimeout : null,
entries : null,
buildingRow : {
@@ -546,7 +590,8 @@
* must be greater than 1, else the analyzeImages will loop */
flushed : 0 //flushed rows without a yield
},
- offY : 0,
+ border : border,
+ offY : border,
spinner : {
active : false,
phase : 0,
@@ -556,7 +601,7 @@
intervalId : null
},
checkWidthIntervalId : null,
- galleryWidth : $gallery.width(),
+ galleryWidth : $gallery.width(),
$gallery : $gallery
};
@@ -571,12 +616,13 @@
// In this case we don't rewind, and analyze all the images
} else {
context.settings = $.extend({}, context.settings, arg);
+ context.border = context.settings.border >= 0 ? context.settings.border : context.settings.margins;
rewind(context);
}
checkSettings(context);
- context.entries = $gallery.find('> a, > div:not(.spinner, #page-end)').toArray();
+ context.entries = $gallery.find('> a, > div:not(.spinner, ' + ignoreElement + ')').toArray();
if (context.entries.length === 0) return;
// Randomize
@@ -588,9 +634,12 @@
}
var imagesToLoad = false;
+ var skippedImages = false;
$.each(context.entries, function (index, entry) {
var $entry = $(entry);
- var $image = $entry.find('img');
+ var $image = imgFromEntry($entry);
+
+ $entry.addClass('jg-entry');
if ($image.data('jg.loaded') !== true && $image.data('jg.loaded') !== 'skipped') {
@@ -612,6 +661,7 @@
$image.data('jg.imgw', width);
$image.data('jg.imgh', height);
$image.data('jg.loaded', 'skipped');
+ skippedImages = true;
startImgAnalyzer(context, false);
return true;
}
@@ -627,32 +677,23 @@
startLoadingSpinnerAnimation(context.spinner);
}
- /* Check if the image is loaded or not using another image object.
- We cannot use the 'complete' image property, because some browsers,
- with a 404 set complete = true */
- var loadImg = new Image();
- var $loadImg = $(loadImg);
- $loadImg.one('load', function imgLoaded () {
+ onImageEvent(imageSrc, function imgLoaded (loadImg) {
//DEBUG// console.log('img load (alt: ' + $image.attr('alt') + ')');
- $image.off('load error');
$image.data('jg.imgw', loadImg.width);
$image.data('jg.imgh', loadImg.height);
$image.data('jg.loaded', true);
startImgAnalyzer(context, false);
- });
- $loadImg.one('error', function imgLoadError () {
+ }, function imgLoadError () {
//DEBUG// console.log('img error (alt: ' + $image.attr('alt') + ')');
- $image.off('load error');
$image.data('jg.loaded', 'error');
startImgAnalyzer(context, false);
});
- loadImg.src = imageSrc;
}
});
- if (!imagesToLoad) startImgAnalyzer(context, false);
+ if (!imagesToLoad && !skippedImages) startImgAnalyzer(context, false);
checkWidth(context);
});
diff --git a/library/justifiedGallery/dist/css/justifiedGallery.css b/library/justifiedGallery/justifiedGallery.css
index 97585f3ed..3a0d55ad5 100644
--- a/library/justifiedGallery/dist/css/justifiedGallery.css
+++ b/library/justifiedGallery/justifiedGallery.css
@@ -1,7 +1,7 @@
/*!
- * Justified Gallery - v3.2.0
- * http://miromannino.com/projects/justified-gallery/
- * Copyright (c) 2014 Miro Mannino
+ * Justified Gallery - v3.5.4
+ * http://miromannino.github.io/Justified-Gallery/
+ * Copyright (c) 2015 Miro Mannino
* Licensed under the MIT license.
*/
@-webkit-keyframes justified-gallery-show-caption-animation {
@@ -83,7 +83,9 @@
/* IE8 or Earlier */
}
.justified-gallery > a > img,
-.justified-gallery > div > img {
+.justified-gallery > div > img,
+.justified-gallery > a > a > img,
+.justified-gallery > div > a > img {
position: absolute;
top: 50%;
left: 50%;
@@ -103,6 +105,7 @@
margin: 0;
color: white;
font-size: 12px;
+ font-weight: 300;
font-family: sans-serif;
}
.justified-gallery > a > .caption.caption-visible,
@@ -119,9 +122,9 @@
opacity: 1.0;
filter: alpha(opacity=100);
/* IE8 or Earlier */
- -webkit-animation: justified-gallery-show-entry-animation 300ms 0 ease;
- -moz-animation: justified-gallery-show-entry-animation 300ms 0 ease;
- -ms-animation: justified-gallery-show-entry-animation 300ms 0 ease;
+ -webkit-animation: justified-gallery-show-entry-animation 500ms 0 ease;
+ -moz-animation: justified-gallery-show-entry-animation 500ms 0 ease;
+ -ms-animation: justified-gallery-show-entry-animation 500ms 0 ease;
}
.justified-gallery > .spinner {
position: absolute;
diff --git a/view/js/main.js b/view/js/main.js
index 17ea42db7..7a6798f2f 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -713,6 +713,8 @@ function updateConvItems(mode,data) {
justifiedGalleryActive = true;
$('#photo-album-contents').justifiedGallery({
margins: 3,
+ border: 0,
+ ignoreElement: '#page-end',
sizeRangeSuffixes: {
'lt100': '-2',
'lt240': '-2',
diff --git a/view/php/theme_init.php b/view/php/theme_init.php
index 0009a00e2..b695bd54e 100644
--- a/view/php/theme_init.php
+++ b/view/php/theme_init.php
@@ -9,11 +9,11 @@ head_add_css('library/jRange/jquery.range.css');
head_add_css('view/css/conversation.css');
head_add_css('view/css/widgets.css');
head_add_css('view/css/colorbox.css');
-head_add_css('library/justifiedGallery/dist/css/justifiedGallery.css');
+head_add_css('library/justifiedGallery/justifiedGallery.css');
head_add_css('library/bootstrap-tagsinput/bootstrap-tagsinput.css');
head_add_js('jquery.js');
head_add_js('jquery-migrate-1.1.1.js');
-head_add_js('library/justifiedGallery/dist/js/jquery.justifiedGallery.js');
+head_add_js('library/justifiedGallery/jquery.justifiedGallery.js');
//head_add_js('jquery-compat.js');
head_add_js('spin.js');