lightgallery 2.3.0-beta → 2.3.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/lightgallery-bundle.css +19 -26
- package/css/lightgallery-bundle.min.css +1 -1
- package/css/lightgallery-core.css +0 -19
- package/css/lightgallery.css +19 -26
- package/lg-events.d.ts +0 -4
- package/lg-settings.d.ts +4 -7
- package/lg-utils.d.ts +10 -1
- package/lib/lg-settings.js +1 -2
- package/lib/lg-settings.js.map +1 -1
- package/lib/lg-utils.js +43 -3
- package/lib/lg-utils.js.map +1 -1
- package/lib/lgQuery.js +31 -20
- package/lib/lgQuery.js.map +1 -1
- package/lib/lightgallery.js +100 -118
- package/lib/lightgallery.js.map +1 -1
- package/lib/plugins/video/lg-video-settings.js.map +1 -1
- package/lib/plugins/video/lg-video-utils.js +24 -0
- package/lib/plugins/video/lg-video-utils.js.map +1 -0
- package/lib/plugins/video/lg-video.js +38 -30
- package/lib/plugins/video/lg-video.js.map +1 -1
- package/lib/plugins/zoom/lg-zoom.js +7 -8
- package/lib/plugins/zoom/lg-zoom.js.map +1 -1
- package/lightgallery.d.ts +18 -10
- package/lightgallery.es5.js +176 -144
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +176 -144
- package/lightgallery.umd.js.map +1 -1
- package/lit/lightgallery.esm.js +7 -7
- package/lit/lightgallery.umd.js +3 -3
- package/package.json +1 -1
- package/plugins/autoplay/lg-autoplay.es5.js +1 -1
- package/plugins/autoplay/lg-autoplay.es5.js.map +1 -1
- package/plugins/autoplay/lg-autoplay.min.js +1 -1
- package/plugins/autoplay/lg-autoplay.umd.js +1 -1
- package/plugins/autoplay/lg-autoplay.umd.js.map +1 -1
- package/plugins/comment/lg-comment.es5.js +1 -1
- package/plugins/comment/lg-comment.es5.js.map +1 -1
- package/plugins/comment/lg-comment.min.js +1 -1
- package/plugins/comment/lg-comment.umd.js +1 -1
- package/plugins/comment/lg-comment.umd.js.map +1 -1
- package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
- package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
- package/plugins/hash/lg-hash.es5.js +1 -1
- package/plugins/hash/lg-hash.es5.js.map +1 -1
- package/plugins/hash/lg-hash.min.js +1 -1
- package/plugins/hash/lg-hash.umd.js +1 -1
- package/plugins/hash/lg-hash.umd.js.map +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.es5.js.map +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
- package/plugins/mediumZoom/lg-medium-zoom.umd.js.map +1 -1
- package/plugins/pager/lg-pager.es5.js +1 -1
- package/plugins/pager/lg-pager.es5.js.map +1 -1
- package/plugins/pager/lg-pager.min.js +1 -1
- package/plugins/pager/lg-pager.umd.js +1 -1
- package/plugins/pager/lg-pager.umd.js.map +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.es5.js.map +1 -1
- package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
- package/plugins/relativeCaption/lg-relative-caption.umd.js.map +1 -1
- package/plugins/rotate/lg-rotate.es5.js +1 -1
- package/plugins/rotate/lg-rotate.es5.js.map +1 -1
- package/plugins/rotate/lg-rotate.min.js +1 -1
- package/plugins/rotate/lg-rotate.umd.js +1 -1
- package/plugins/rotate/lg-rotate.umd.js.map +1 -1
- package/plugins/share/lg-share.es5.js +1 -1
- package/plugins/share/lg-share.es5.js.map +1 -1
- package/plugins/share/lg-share.min.js +1 -1
- package/plugins/share/lg-share.umd.js +1 -1
- package/plugins/share/lg-share.umd.js.map +1 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.es5.js.map +1 -1
- package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
- package/plugins/thumbnail/lg-thumbnail.umd.js.map +1 -1
- package/plugins/video/lg-video-settings.d.ts +2 -1
- package/plugins/video/lg-video-utils.d.ts +6 -0
- package/plugins/video/lg-video.d.ts +6 -1
- package/plugins/video/lg-video.es5.js +57 -29
- package/plugins/video/lg-video.es5.js.map +1 -1
- package/plugins/video/lg-video.min.js +2 -2
- package/plugins/video/lg-video.umd.js +57 -29
- package/plugins/video/lg-video.umd.js.map +1 -1
- package/plugins/zoom/lg-zoom.es5.js +8 -9
- package/plugins/zoom/lg-zoom.es5.js.map +1 -1
- package/plugins/zoom/lg-zoom.min.js +2 -2
- package/plugins/zoom/lg-zoom.umd.js +8 -9
- package/plugins/zoom/lg-zoom.umd.js.map +1 -1
- package/react/Lightgallery.es5.js +176 -144
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +176 -144
- package/react/Lightgallery.umd.js.map +1 -1
- package/scss/_lg-theme-default.scss +17 -10
- package/scss/lightgallery-core.scss +0 -24
- package/vue/LightGalleryVue.common.js +291 -268
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +291 -268
- package/vue/LightGalleryVue.umd.js.map +1 -1
- package/vue/LightGalleryVue.umd.min.js +2 -2
- package/vue/LightGalleryVue.umd.min.js.map +1 -1
package/lightgallery.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.3.0-beta |
|
|
2
|
+
* lightgallery | 2.3.0-beta.4 | October 11th 2021
|
|
3
3
|
* http://www.lightgalleryjs.com/
|
|
4
4
|
* Copyright (c) 2020 Sachin Neravath;
|
|
5
5
|
* @license GPLv3
|
|
@@ -45,24 +45,30 @@
|
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
function initLgPolyfills() {
|
|
49
|
+
(function () {
|
|
50
|
+
if (typeof window.CustomEvent === 'function')
|
|
51
|
+
return false;
|
|
52
|
+
function CustomEvent(event, params) {
|
|
53
|
+
params = params || {
|
|
54
|
+
bubbles: false,
|
|
55
|
+
cancelable: false,
|
|
56
|
+
detail: null,
|
|
57
|
+
};
|
|
58
|
+
var evt = document.createEvent('CustomEvent');
|
|
59
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
60
|
+
return evt;
|
|
61
|
+
}
|
|
62
|
+
window.CustomEvent = CustomEvent;
|
|
63
|
+
})();
|
|
64
|
+
(function () {
|
|
65
|
+
if (!Element.prototype.matches) {
|
|
66
|
+
Element.prototype.matches =
|
|
67
|
+
Element.prototype.msMatchesSelector ||
|
|
68
|
+
Element.prototype.webkitMatchesSelector;
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
}
|
|
66
72
|
var lgQuery = /** @class */ (function () {
|
|
67
73
|
function lgQuery(selector) {
|
|
68
74
|
this.cssVenderPrefixes = [
|
|
@@ -195,7 +201,9 @@
|
|
|
195
201
|
this._each(function (el) {
|
|
196
202
|
// IE doesn't support multiple arguments
|
|
197
203
|
classNames.split(' ').forEach(function (className) {
|
|
198
|
-
|
|
204
|
+
if (className) {
|
|
205
|
+
el.classList.add(className);
|
|
206
|
+
}
|
|
199
207
|
});
|
|
200
208
|
});
|
|
201
209
|
return this;
|
|
@@ -204,7 +212,9 @@
|
|
|
204
212
|
this._each(function (el) {
|
|
205
213
|
// IE doesn't support multiple arguments
|
|
206
214
|
classNames.split(' ').forEach(function (className) {
|
|
207
|
-
|
|
215
|
+
if (className) {
|
|
216
|
+
el.classList.remove(className);
|
|
217
|
+
}
|
|
208
218
|
});
|
|
209
219
|
});
|
|
210
220
|
return this;
|
|
@@ -404,6 +414,7 @@
|
|
|
404
414
|
return lgQuery;
|
|
405
415
|
}());
|
|
406
416
|
function $LG(selector) {
|
|
417
|
+
initLgPolyfills();
|
|
407
418
|
return new lgQuery(selector);
|
|
408
419
|
}
|
|
409
420
|
|
|
@@ -448,12 +459,11 @@
|
|
|
448
459
|
/**
|
|
449
460
|
* get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
|
|
450
461
|
*/
|
|
451
|
-
|
|
452
|
-
getSize: function (el, container, spacing, isDisabled, defaultLgSize) {
|
|
462
|
+
getSize: function (el, container, spacing, defaultLgSize) {
|
|
453
463
|
if (spacing === void 0) { spacing = 0; }
|
|
454
464
|
var LGel = $LG(el);
|
|
455
465
|
var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
|
|
456
|
-
if (!lgSize
|
|
466
|
+
if (!lgSize) {
|
|
457
467
|
return;
|
|
458
468
|
}
|
|
459
469
|
var isResponsiveSizes = lgSize.split(',');
|
|
@@ -647,6 +657,47 @@
|
|
|
647
657
|
isMobile: function () {
|
|
648
658
|
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
649
659
|
},
|
|
660
|
+
/**
|
|
661
|
+
* @desc Check the given src is video
|
|
662
|
+
* @param {String} src
|
|
663
|
+
* @return {Object} video type
|
|
664
|
+
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
665
|
+
*
|
|
666
|
+
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
667
|
+
*/
|
|
668
|
+
isVideo: function (src, isHTML5VIdeo, index) {
|
|
669
|
+
if (!src) {
|
|
670
|
+
if (isHTML5VIdeo) {
|
|
671
|
+
return {
|
|
672
|
+
html5: true,
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
else {
|
|
676
|
+
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
677
|
+
(index + 1) +
|
|
678
|
+
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
683
|
+
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
|
|
684
|
+
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
685
|
+
if (youtube) {
|
|
686
|
+
return {
|
|
687
|
+
youtube: youtube,
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
else if (vimeo) {
|
|
691
|
+
return {
|
|
692
|
+
vimeo: vimeo,
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
else if (wistia) {
|
|
696
|
+
return {
|
|
697
|
+
wistia: wistia,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
},
|
|
650
701
|
};
|
|
651
702
|
|
|
652
703
|
var lightGalleryCoreSettings = {
|
|
@@ -659,7 +710,7 @@
|
|
|
659
710
|
addClass: '',
|
|
660
711
|
startClass: 'lg-start-zoom',
|
|
661
712
|
backdropDuration: 300,
|
|
662
|
-
container:
|
|
713
|
+
container: '',
|
|
663
714
|
startAnimationDuration: 400,
|
|
664
715
|
zoomFromOrigin: true,
|
|
665
716
|
hideBarsDelay: 0,
|
|
@@ -688,7 +739,6 @@
|
|
|
688
739
|
subHtmlSelectorRelative: false,
|
|
689
740
|
preload: 2,
|
|
690
741
|
numberOfSlideItemsInDom: 10,
|
|
691
|
-
showAfterLoad: true,
|
|
692
742
|
selector: '',
|
|
693
743
|
selectWithin: '',
|
|
694
744
|
nextHtml: '',
|
|
@@ -962,9 +1012,6 @@
|
|
|
962
1012
|
if (this.settings.enableDrag) {
|
|
963
1013
|
outerClassNames += 'lg-grab ';
|
|
964
1014
|
}
|
|
965
|
-
if (this.settings.showAfterLoad) {
|
|
966
|
-
outerClassNames += 'lg-show-after-load';
|
|
967
|
-
}
|
|
968
1015
|
this.outer.addClass(outerClassNames);
|
|
969
1016
|
this.$inner.css('transition-timing-function', this.settings.easing);
|
|
970
1017
|
this.$inner.css('transition-duration', this.settings.speed + 'ms');
|
|
@@ -983,10 +1030,10 @@
|
|
|
983
1030
|
LightGallery.prototype.refreshOnResize = function () {
|
|
984
1031
|
if (this.lgOpened) {
|
|
985
1032
|
var currentGalleryItem = this.galleryItems[this.index];
|
|
986
|
-
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo
|
|
1033
|
+
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
|
|
987
1034
|
this.mediaContainerPosition = this.getMediaContainerPosition();
|
|
988
1035
|
var _a = this.mediaContainerPosition, top_1 = _a.top, bottom = _a.bottom;
|
|
989
|
-
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo &&
|
|
1036
|
+
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
990
1037
|
if (__slideVideoInfo) {
|
|
991
1038
|
this.resizeVideoSlide(this.index, this.currentImageSize);
|
|
992
1039
|
}
|
|
@@ -1165,9 +1212,9 @@
|
|
|
1165
1212
|
if (!this.settings.allowMediaOverlap) {
|
|
1166
1213
|
this.setMediaContainerPosition(top, bottom);
|
|
1167
1214
|
}
|
|
1168
|
-
var
|
|
1215
|
+
var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
|
|
1169
1216
|
if (this.zoomFromOrigin && element) {
|
|
1170
|
-
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo &&
|
|
1217
|
+
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1171
1218
|
transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
|
|
1172
1219
|
}
|
|
1173
1220
|
if (!this.zoomFromOrigin || !transform) {
|
|
@@ -1421,7 +1468,7 @@
|
|
|
1421
1468
|
// displayed on top of actual image
|
|
1422
1469
|
var imgContent = '';
|
|
1423
1470
|
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1424
|
-
if (
|
|
1471
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1425
1472
|
imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
|
|
1426
1473
|
}
|
|
1427
1474
|
else {
|
|
@@ -1430,88 +1477,66 @@
|
|
|
1430
1477
|
var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
|
|
1431
1478
|
$currentSlide.prepend(imgMarkup);
|
|
1432
1479
|
};
|
|
1433
|
-
LightGallery.prototype.
|
|
1434
|
-
var
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1480
|
+
LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
|
|
1481
|
+
var mediaObject = $slide.find('.lg-object').first();
|
|
1482
|
+
if (utils.isImageLoaded(mediaObject.get()) ||
|
|
1483
|
+
isHTML5VideoWithoutPoster) {
|
|
1484
|
+
onLoad();
|
|
1485
|
+
}
|
|
1486
|
+
else {
|
|
1487
|
+
mediaObject.on('load.lg error.lg', function () {
|
|
1488
|
+
onLoad && onLoad();
|
|
1489
|
+
});
|
|
1490
|
+
mediaObject.on('error.lg', function () {
|
|
1491
|
+
onError && onError();
|
|
1440
1492
|
});
|
|
1441
1493
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1494
|
+
};
|
|
1495
|
+
/**
|
|
1496
|
+
*
|
|
1497
|
+
* @param $el Current slide item
|
|
1498
|
+
* @param index
|
|
1499
|
+
* @param delay Delay is 0 except first time
|
|
1500
|
+
* @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
|
|
1501
|
+
* @param isFirstSlide
|
|
1502
|
+
*/
|
|
1503
|
+
LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
|
|
1504
|
+
var _this = this;
|
|
1505
|
+
this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
|
|
1506
|
+
_this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
|
|
1507
|
+
}, function () {
|
|
1508
|
+
currentSlide.addClass('lg-complete lg-complete_');
|
|
1509
|
+
currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1446
1510
|
});
|
|
1447
|
-
setTimeout(function () {
|
|
1448
|
-
$el.find('.lg-object')
|
|
1449
|
-
.first()
|
|
1450
|
-
.on('error.lg', function () {
|
|
1451
|
-
$el.addClass('lg-complete lg-complete_');
|
|
1452
|
-
$el.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1453
|
-
});
|
|
1454
|
-
}, speed);
|
|
1455
1511
|
};
|
|
1456
|
-
LightGallery.prototype.
|
|
1512
|
+
LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
|
|
1457
1513
|
var _this = this;
|
|
1514
|
+
var currentGalleryItem = this.galleryItems[index];
|
|
1515
|
+
// Adding delay for video slides without poster for better performance and user experience
|
|
1516
|
+
// Videos should start playing once once the gallery is completely loaded
|
|
1517
|
+
var _speed = isFirstSlide &&
|
|
1518
|
+
this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1519
|
+
!currentGalleryItem.poster
|
|
1520
|
+
? speed
|
|
1521
|
+
: 0;
|
|
1458
1522
|
setTimeout(function () {
|
|
1459
|
-
$
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
}
|
|
1467
|
-
}, speed);
|
|
1523
|
+
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1524
|
+
_this.LGel.trigger(lGEvents.slideItemLoad, {
|
|
1525
|
+
index: index,
|
|
1526
|
+
delay: delay || 0,
|
|
1527
|
+
isFirstSlide: isFirstSlide,
|
|
1528
|
+
});
|
|
1529
|
+
}, _speed);
|
|
1468
1530
|
};
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
1474
|
-
*
|
|
1475
|
-
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
1476
|
-
*/
|
|
1477
|
-
LightGallery.prototype.isVideo = function (src, index) {
|
|
1478
|
-
if (!src) {
|
|
1479
|
-
if (this.galleryItems[index].video) {
|
|
1480
|
-
return {
|
|
1481
|
-
html5: true,
|
|
1482
|
-
};
|
|
1483
|
-
}
|
|
1484
|
-
else {
|
|
1485
|
-
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
1486
|
-
(index + 1) +
|
|
1487
|
-
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
1488
|
-
return;
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
1492
|
-
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i);
|
|
1493
|
-
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
1494
|
-
if (youtube) {
|
|
1495
|
-
return {
|
|
1496
|
-
youtube: youtube,
|
|
1497
|
-
};
|
|
1498
|
-
}
|
|
1499
|
-
else if (vimeo) {
|
|
1500
|
-
return {
|
|
1501
|
-
vimeo: vimeo,
|
|
1502
|
-
};
|
|
1503
|
-
}
|
|
1504
|
-
else if (wistia) {
|
|
1505
|
-
return {
|
|
1506
|
-
wistia: wistia,
|
|
1507
|
-
};
|
|
1508
|
-
}
|
|
1531
|
+
LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
|
|
1532
|
+
return !!(!this.lGalleryOn &&
|
|
1533
|
+
this.zoomFromOrigin &&
|
|
1534
|
+
this.currentImageSize);
|
|
1509
1535
|
};
|
|
1510
1536
|
// Add video slideInfo
|
|
1511
1537
|
LightGallery.prototype.addSlideVideoInfo = function (items) {
|
|
1512
|
-
var _this = this;
|
|
1513
1538
|
items.forEach(function (element, index) {
|
|
1514
|
-
element.__slideVideoInfo =
|
|
1539
|
+
element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
|
|
1515
1540
|
});
|
|
1516
1541
|
};
|
|
1517
1542
|
/**
|
|
@@ -1549,7 +1574,7 @@
|
|
|
1549
1574
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1550
1575
|
if (videoInfo) {
|
|
1551
1576
|
var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
|
|
1552
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom,
|
|
1577
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1553
1578
|
lgVideoStyle = this.getVideoContStyle(videoSize);
|
|
1554
1579
|
}
|
|
1555
1580
|
if (iframe) {
|
|
@@ -1584,7 +1609,6 @@
|
|
|
1584
1609
|
src: src,
|
|
1585
1610
|
html5Video: _html5Video,
|
|
1586
1611
|
hasPoster: !!poster,
|
|
1587
|
-
isFirstSlide: isFirstSlide,
|
|
1588
1612
|
});
|
|
1589
1613
|
}
|
|
1590
1614
|
this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
|
|
@@ -1600,8 +1624,8 @@
|
|
|
1600
1624
|
if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
|
|
1601
1625
|
_speed = delay;
|
|
1602
1626
|
}
|
|
1603
|
-
// Only for first slide
|
|
1604
|
-
if (
|
|
1627
|
+
// Only for first slide and zoomFromOrigin is enabled
|
|
1628
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1605
1629
|
setTimeout(function () {
|
|
1606
1630
|
$currentSlide
|
|
1607
1631
|
.removeClass('lg-start-end-progress lg-start-progress')
|
|
@@ -1609,23 +1633,24 @@
|
|
|
1609
1633
|
}, this.settings.startAnimationDuration + 100);
|
|
1610
1634
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1611
1635
|
setTimeout(function () {
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
var mediaObject = $currentSlide
|
|
1621
|
-
.find('.lg-object')
|
|
1622
|
-
.first();
|
|
1623
|
-
if (utils.isImageLoaded(mediaObject.get())) {
|
|
1624
|
-
_this.loadContentOnLoad(index, $currentSlide, _speed);
|
|
1636
|
+
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1637
|
+
$currentSlide
|
|
1638
|
+
.find('.lg-img-wrap')
|
|
1639
|
+
.append(utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
|
|
1640
|
+
if (srcset || sources) {
|
|
1641
|
+
var $img = $currentSlide.find('.lg-object');
|
|
1642
|
+
_this.initPictureFill($img);
|
|
1643
|
+
}
|
|
1625
1644
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1645
|
+
if (_this.getSlideType(currentGalleryItem) === 'image' ||
|
|
1646
|
+
(_this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1647
|
+
poster)) {
|
|
1648
|
+
_this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
|
|
1649
|
+
// load remaining slides once the slide is completely loaded
|
|
1650
|
+
_this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
|
|
1651
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1652
|
+
}, function () {
|
|
1653
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1629
1654
|
});
|
|
1630
1655
|
}
|
|
1631
1656
|
}, this.settings.startAnimationDuration + 100);
|
|
@@ -1633,10 +1658,9 @@
|
|
|
1633
1658
|
}
|
|
1634
1659
|
// SLide content has been added to dom
|
|
1635
1660
|
$currentSlide.addClass('lg-loaded');
|
|
1636
|
-
this.
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1661
|
+
if (!this.isFirstSlideWithZoomAnimation() ||
|
|
1662
|
+
(this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
|
|
1663
|
+
this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
|
|
1640
1664
|
}
|
|
1641
1665
|
// When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
|
|
1642
1666
|
if ((!this.zoomFromOrigin || !this.currentImageSize) &&
|
|
@@ -1663,7 +1687,14 @@
|
|
|
1663
1687
|
}
|
|
1664
1688
|
}
|
|
1665
1689
|
};
|
|
1666
|
-
|
|
1690
|
+
/**
|
|
1691
|
+
* @desc Remove dummy image content and load next slides
|
|
1692
|
+
* Called only for the first time if zoomFromOrigin animation is enabled
|
|
1693
|
+
* @param index
|
|
1694
|
+
* @param $currentSlide
|
|
1695
|
+
* @param speed
|
|
1696
|
+
*/
|
|
1697
|
+
LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
|
|
1667
1698
|
var _this = this;
|
|
1668
1699
|
setTimeout(function () {
|
|
1669
1700
|
$currentSlide.find('.lg-dummy-img').remove();
|
|
@@ -1834,7 +1865,7 @@
|
|
|
1834
1865
|
this.setDownloadValue(index);
|
|
1835
1866
|
if (videoInfo) {
|
|
1836
1867
|
var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
|
|
1837
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom,
|
|
1868
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1838
1869
|
this.resizeVideoSlide(index, videoSize);
|
|
1839
1870
|
}
|
|
1840
1871
|
this.LGel.trigger(lGEvents.beforeSlide, {
|
|
@@ -1894,15 +1925,15 @@
|
|
|
1894
1925
|
if (!this.lGalleryOn) {
|
|
1895
1926
|
this.loadContent(index, true);
|
|
1896
1927
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1928
|
+
else {
|
|
1929
|
+
setTimeout(function () {
|
|
1899
1930
|
_this.loadContent(index, true);
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1931
|
+
// Add title if this.settings.appendSubHtmlTo === lg-sub-html
|
|
1932
|
+
if (_this.settings.appendSubHtmlTo !== '.lg-item') {
|
|
1933
|
+
_this.addHtml(index);
|
|
1934
|
+
}
|
|
1935
|
+
}, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
|
|
1936
|
+
}
|
|
1906
1937
|
setTimeout(function () {
|
|
1907
1938
|
_this.lgBusy = false;
|
|
1908
1939
|
previousSlideItem_1.removeClass('lg-slide-progress');
|
|
@@ -2346,12 +2377,13 @@
|
|
|
2346
2377
|
return;
|
|
2347
2378
|
}
|
|
2348
2379
|
if (e.deltaY > 0) {
|
|
2349
|
-
_this.goToPrevSlide();
|
|
2350
|
-
}
|
|
2351
|
-
else {
|
|
2352
2380
|
_this.goToNextSlide();
|
|
2381
|
+
e.preventDefault();
|
|
2382
|
+
}
|
|
2383
|
+
else if (e.deltaY < 0) {
|
|
2384
|
+
_this.goToPrevSlide();
|
|
2385
|
+
e.preventDefault();
|
|
2353
2386
|
}
|
|
2354
|
-
e.preventDefault();
|
|
2355
2387
|
});
|
|
2356
2388
|
};
|
|
2357
2389
|
LightGallery.prototype.isSlideElement = function (target) {
|
|
@@ -2441,7 +2473,7 @@
|
|
|
2441
2473
|
if (this.zoomFromOrigin && currentItem) {
|
|
2442
2474
|
var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
|
|
2443
2475
|
var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
|
|
2444
|
-
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo &&
|
|
2476
|
+
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
|
|
2445
2477
|
transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
|
|
2446
2478
|
}
|
|
2447
2479
|
if (this.zoomFromOrigin && transform) {
|