Skip to content

Commit

Permalink
Build update
Browse files Browse the repository at this point in the history
  • Loading branch information
feimosi committed Sep 16, 2017
1 parent 05a3861 commit 880ba65
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
5 changes: 3 additions & 2 deletions dist/baguetteBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
max-height: 100%;
max-width: 100%;
vertical-align: middle;
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); }
-webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
-moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); }
#baguetteBox-overlay .full-image figcaption {
display: block;
position: absolute;
Expand Down
42 changes: 24 additions & 18 deletions dist/baguetteBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@
var options = {},
defaults = {
captions: true,
buttons: 'auto',
fullScreen: false,
noScrollbars: false,
bodyClass: 'baguetteBox-open',
titleTag: false,
buttons: 'auto',
async: false,
preload: 2,
animation: 'slideIn',
afterShow: null,
afterHide: null,
// callback when image changes with `currentIndex` and `imagesElements.length` as parameters
onChange: null,
overlayBackgroundColor: 'rgba(0,0,0,.8)'
};
Expand Down Expand Up @@ -77,15 +77,15 @@
}
};
var previousButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
showPreviousImage();
};
var nextButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
showNextImage();
};
var closeButtonClickHandler = function(event) {
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // jshint ignore:line
event.stopPropagation ? event.stopPropagation() : event.cancelBubble = true; // eslint-disable-line no-unused-expressions
hideOverlay();
};
var touchstartHandler = function(event) {
Expand All @@ -102,7 +102,7 @@
if (touchFlag || touch.multitouch) {
return;
}
event.preventDefault ? event.preventDefault() : event.returnValue = false; // jshint ignore:line
event.preventDefault ? event.preventDefault() : event.returnValue = false; // eslint-disable-line no-unused-expressions
var touchEvent = event.touches[0] || event.changedTouches[0];
// Move at least 40 pixels to trigger the action
if (touchEvent.pageX - touch.startX > 40) {
Expand Down Expand Up @@ -133,7 +133,7 @@

// forEach polyfill for IE8
// http://stackoverflow.com/a/14827443/1077846
/* jshint ignore:start */
/* eslint-disable */
if (![].forEach) {
Array.prototype.forEach = function(callback, thisArg) {
for (var i = 0; i < this.length; i++) {
Expand All @@ -153,7 +153,7 @@
return d;
};
}
/* jshint ignore:end */
/* eslint-enable */

// Script entry point
function run(selector, userOptions) {
Expand Down Expand Up @@ -190,7 +190,9 @@

// Filter 'a' elements from those not linking to images
tagsNodeList = [].filter.call(tagsNodeList, function(element) {
return regex.test(element.href);
if (element.className.indexOf(userOptions && userOptions.ignoreClass) === -1) {
return regex.test(element.href);
}
});
if (tagsNodeList.length === 0) {
return;
Expand All @@ -199,7 +201,7 @@
var gallery = [];
[].forEach.call(tagsNodeList, function(imageElement, imageIndex) {
var imageElementClickHandler = function(event) {
event.preventDefault ? event.preventDefault() : event.returnValue = false; // jshint ignore:line
event.preventDefault ? event.preventDefault() : event.returnValue = false; // eslint-disable-line no-unused-expressions
prepareOverlay(gallery, userOptions);
showOverlay(imageIndex);
};
Expand Down Expand Up @@ -411,6 +413,9 @@
// Fade in overlay
setTimeout(function() {
overlay.className = 'visible';
if (options.bodyClass && document.body.classList) {
document.body.classList.add(options.bodyClass);
}
if (options.afterShow) {
options.afterShow();
}
Expand Down Expand Up @@ -465,11 +470,14 @@
setTimeout(function() {
overlay.style.display = 'none';
exitFullscreen();
if (options.bodyClass && document.body.classList) {
document.body.classList.remove(options.bodyClass);
}
if (options.afterHide) {
options.afterHide();
}
}, 500);
documentLastFocus.focus();
documentLastFocus && documentLastFocus.focus();
}

function loadImage(index, callback) {
Expand All @@ -478,7 +486,7 @@

// Return if the index exceeds prepared images in the overlay
// or if the current gallery has been changed / closed
if (imageContainer === undefined || galleryItem === undefined) {
if (typeof imageContainer === 'undefined' || typeof galleryItem === 'undefined') {
return;
}

Expand All @@ -494,8 +502,8 @@
var imageElement = galleryItem.imageElement;
var thumbnailElement = imageElement.getElementsByTagName('img')[0];
var imageCaption = typeof options.captions === 'function' ?
options.captions.call(currentGallery, imageElement) :
imageElement.getAttribute('data-caption') || imageElement.title;
options.captions.call(currentGallery, imageElement) :
imageElement.getAttribute('data-caption') || imageElement.title;
var imageSrc = getImageSrc(imageElement);

// Prepare figure element
Expand Down Expand Up @@ -615,14 +623,12 @@
if (options.animation === 'fadeIn') {
slider.style.opacity = 0;
setTimeout(function() {
/* jshint -W030 */
supports.transforms ?
slider.style.transform = slider.style.webkitTransform = 'translate3d(' + offset + ',0,0)'
: slider.style.left = offset;
slider.style.opacity = 1;
}, 400);
} else {
/* jshint -W030 */
supports.transforms ?
slider.style.transform = slider.style.webkitTransform = 'translate3d(' + offset + ',0,0)'
: slider.style.left = offset;
Expand Down Expand Up @@ -703,8 +709,8 @@

return {
run: run,
destroy: destroyPlugin,
showNext: showNextImage,
showPrevious: showPreviousImage
showPrevious: showPreviousImage,
destroy: destroyPlugin
};
}));
2 changes: 1 addition & 1 deletion dist/baguetteBox.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 880ba65

Please sign in to comment.