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
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/*!
|
|
35
|
-
* lightgallery | 2.3.0-beta |
|
|
35
|
+
* lightgallery | 2.3.0-beta.4 | October 11th 2021
|
|
36
36
|
* http://www.lightgalleryjs.com/
|
|
37
37
|
* Copyright (c) 2020 Sachin Neravath;
|
|
38
38
|
* @license GPLv3
|
|
@@ -72,24 +72,30 @@
|
|
|
72
72
|
return r;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
function initLgPolyfills() {
|
|
76
|
+
(function () {
|
|
77
|
+
if (typeof window.CustomEvent === 'function')
|
|
78
|
+
return false;
|
|
79
|
+
function CustomEvent(event, params) {
|
|
80
|
+
params = params || {
|
|
81
|
+
bubbles: false,
|
|
82
|
+
cancelable: false,
|
|
83
|
+
detail: null,
|
|
84
|
+
};
|
|
85
|
+
var evt = document.createEvent('CustomEvent');
|
|
86
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
87
|
+
return evt;
|
|
88
|
+
}
|
|
89
|
+
window.CustomEvent = CustomEvent;
|
|
90
|
+
})();
|
|
91
|
+
(function () {
|
|
92
|
+
if (!Element.prototype.matches) {
|
|
93
|
+
Element.prototype.matches =
|
|
94
|
+
Element.prototype.msMatchesSelector ||
|
|
95
|
+
Element.prototype.webkitMatchesSelector;
|
|
96
|
+
}
|
|
97
|
+
})();
|
|
98
|
+
}
|
|
93
99
|
var lgQuery = /** @class */ (function () {
|
|
94
100
|
function lgQuery(selector) {
|
|
95
101
|
this.cssVenderPrefixes = [
|
|
@@ -222,7 +228,9 @@
|
|
|
222
228
|
this._each(function (el) {
|
|
223
229
|
// IE doesn't support multiple arguments
|
|
224
230
|
classNames.split(' ').forEach(function (className) {
|
|
225
|
-
|
|
231
|
+
if (className) {
|
|
232
|
+
el.classList.add(className);
|
|
233
|
+
}
|
|
226
234
|
});
|
|
227
235
|
});
|
|
228
236
|
return this;
|
|
@@ -231,7 +239,9 @@
|
|
|
231
239
|
this._each(function (el) {
|
|
232
240
|
// IE doesn't support multiple arguments
|
|
233
241
|
classNames.split(' ').forEach(function (className) {
|
|
234
|
-
|
|
242
|
+
if (className) {
|
|
243
|
+
el.classList.remove(className);
|
|
244
|
+
}
|
|
235
245
|
});
|
|
236
246
|
});
|
|
237
247
|
return this;
|
|
@@ -431,6 +441,7 @@
|
|
|
431
441
|
return lgQuery;
|
|
432
442
|
}());
|
|
433
443
|
function $LG(selector) {
|
|
444
|
+
initLgPolyfills();
|
|
434
445
|
return new lgQuery(selector);
|
|
435
446
|
}
|
|
436
447
|
|
|
@@ -475,12 +486,11 @@
|
|
|
475
486
|
/**
|
|
476
487
|
* get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
|
|
477
488
|
*/
|
|
478
|
-
|
|
479
|
-
getSize: function (el, container, spacing, isDisabled, defaultLgSize) {
|
|
489
|
+
getSize: function (el, container, spacing, defaultLgSize) {
|
|
480
490
|
if (spacing === void 0) { spacing = 0; }
|
|
481
491
|
var LGel = $LG(el);
|
|
482
492
|
var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
|
|
483
|
-
if (!lgSize
|
|
493
|
+
if (!lgSize) {
|
|
484
494
|
return;
|
|
485
495
|
}
|
|
486
496
|
var isResponsiveSizes = lgSize.split(',');
|
|
@@ -674,6 +684,47 @@
|
|
|
674
684
|
isMobile: function () {
|
|
675
685
|
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
676
686
|
},
|
|
687
|
+
/**
|
|
688
|
+
* @desc Check the given src is video
|
|
689
|
+
* @param {String} src
|
|
690
|
+
* @return {Object} video type
|
|
691
|
+
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
692
|
+
*
|
|
693
|
+
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
694
|
+
*/
|
|
695
|
+
isVideo: function (src, isHTML5VIdeo, index) {
|
|
696
|
+
if (!src) {
|
|
697
|
+
if (isHTML5VIdeo) {
|
|
698
|
+
return {
|
|
699
|
+
html5: true,
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
704
|
+
(index + 1) +
|
|
705
|
+
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
710
|
+
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
|
|
711
|
+
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
712
|
+
if (youtube) {
|
|
713
|
+
return {
|
|
714
|
+
youtube: youtube,
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
else if (vimeo) {
|
|
718
|
+
return {
|
|
719
|
+
vimeo: vimeo,
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
else if (wistia) {
|
|
723
|
+
return {
|
|
724
|
+
wistia: wistia,
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
},
|
|
677
728
|
};
|
|
678
729
|
|
|
679
730
|
var lightGalleryCoreSettings = {
|
|
@@ -686,7 +737,7 @@
|
|
|
686
737
|
addClass: '',
|
|
687
738
|
startClass: 'lg-start-zoom',
|
|
688
739
|
backdropDuration: 300,
|
|
689
|
-
container:
|
|
740
|
+
container: '',
|
|
690
741
|
startAnimationDuration: 400,
|
|
691
742
|
zoomFromOrigin: true,
|
|
692
743
|
hideBarsDelay: 0,
|
|
@@ -715,7 +766,6 @@
|
|
|
715
766
|
subHtmlSelectorRelative: false,
|
|
716
767
|
preload: 2,
|
|
717
768
|
numberOfSlideItemsInDom: 10,
|
|
718
|
-
showAfterLoad: true,
|
|
719
769
|
selector: '',
|
|
720
770
|
selectWithin: '',
|
|
721
771
|
nextHtml: '',
|
|
@@ -989,9 +1039,6 @@
|
|
|
989
1039
|
if (this.settings.enableDrag) {
|
|
990
1040
|
outerClassNames += 'lg-grab ';
|
|
991
1041
|
}
|
|
992
|
-
if (this.settings.showAfterLoad) {
|
|
993
|
-
outerClassNames += 'lg-show-after-load';
|
|
994
|
-
}
|
|
995
1042
|
this.outer.addClass(outerClassNames);
|
|
996
1043
|
this.$inner.css('transition-timing-function', this.settings.easing);
|
|
997
1044
|
this.$inner.css('transition-duration', this.settings.speed + 'ms');
|
|
@@ -1010,10 +1057,10 @@
|
|
|
1010
1057
|
LightGallery.prototype.refreshOnResize = function () {
|
|
1011
1058
|
if (this.lgOpened) {
|
|
1012
1059
|
var currentGalleryItem = this.galleryItems[this.index];
|
|
1013
|
-
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo
|
|
1060
|
+
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
|
|
1014
1061
|
this.mediaContainerPosition = this.getMediaContainerPosition();
|
|
1015
1062
|
var _a = this.mediaContainerPosition, top_1 = _a.top, bottom = _a.bottom;
|
|
1016
|
-
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo &&
|
|
1063
|
+
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1017
1064
|
if (__slideVideoInfo) {
|
|
1018
1065
|
this.resizeVideoSlide(this.index, this.currentImageSize);
|
|
1019
1066
|
}
|
|
@@ -1192,9 +1239,9 @@
|
|
|
1192
1239
|
if (!this.settings.allowMediaOverlap) {
|
|
1193
1240
|
this.setMediaContainerPosition(top, bottom);
|
|
1194
1241
|
}
|
|
1195
|
-
var
|
|
1242
|
+
var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
|
|
1196
1243
|
if (this.zoomFromOrigin && element) {
|
|
1197
|
-
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo &&
|
|
1244
|
+
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1198
1245
|
transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
|
|
1199
1246
|
}
|
|
1200
1247
|
if (!this.zoomFromOrigin || !transform) {
|
|
@@ -1448,7 +1495,7 @@
|
|
|
1448
1495
|
// displayed on top of actual image
|
|
1449
1496
|
var imgContent = '';
|
|
1450
1497
|
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1451
|
-
if (
|
|
1498
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1452
1499
|
imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
|
|
1453
1500
|
}
|
|
1454
1501
|
else {
|
|
@@ -1457,88 +1504,66 @@
|
|
|
1457
1504
|
var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
|
|
1458
1505
|
$currentSlide.prepend(imgMarkup);
|
|
1459
1506
|
};
|
|
1460
|
-
LightGallery.prototype.
|
|
1461
|
-
var
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1507
|
+
LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
|
|
1508
|
+
var mediaObject = $slide.find('.lg-object').first();
|
|
1509
|
+
if (utils.isImageLoaded(mediaObject.get()) ||
|
|
1510
|
+
isHTML5VideoWithoutPoster) {
|
|
1511
|
+
onLoad();
|
|
1512
|
+
}
|
|
1513
|
+
else {
|
|
1514
|
+
mediaObject.on('load.lg error.lg', function () {
|
|
1515
|
+
onLoad && onLoad();
|
|
1516
|
+
});
|
|
1517
|
+
mediaObject.on('error.lg', function () {
|
|
1518
|
+
onError && onError();
|
|
1467
1519
|
});
|
|
1468
1520
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1521
|
+
};
|
|
1522
|
+
/**
|
|
1523
|
+
*
|
|
1524
|
+
* @param $el Current slide item
|
|
1525
|
+
* @param index
|
|
1526
|
+
* @param delay Delay is 0 except first time
|
|
1527
|
+
* @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
|
|
1528
|
+
* @param isFirstSlide
|
|
1529
|
+
*/
|
|
1530
|
+
LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
|
|
1531
|
+
var _this = this;
|
|
1532
|
+
this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
|
|
1533
|
+
_this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
|
|
1534
|
+
}, function () {
|
|
1535
|
+
currentSlide.addClass('lg-complete lg-complete_');
|
|
1536
|
+
currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1473
1537
|
});
|
|
1474
|
-
setTimeout(function () {
|
|
1475
|
-
$el.find('.lg-object')
|
|
1476
|
-
.first()
|
|
1477
|
-
.on('error.lg', function () {
|
|
1478
|
-
$el.addClass('lg-complete lg-complete_');
|
|
1479
|
-
$el.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1480
|
-
});
|
|
1481
|
-
}, speed);
|
|
1482
1538
|
};
|
|
1483
|
-
LightGallery.prototype.
|
|
1539
|
+
LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
|
|
1484
1540
|
var _this = this;
|
|
1541
|
+
var currentGalleryItem = this.galleryItems[index];
|
|
1542
|
+
// Adding delay for video slides without poster for better performance and user experience
|
|
1543
|
+
// Videos should start playing once once the gallery is completely loaded
|
|
1544
|
+
var _speed = isFirstSlide &&
|
|
1545
|
+
this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1546
|
+
!currentGalleryItem.poster
|
|
1547
|
+
? speed
|
|
1548
|
+
: 0;
|
|
1485
1549
|
setTimeout(function () {
|
|
1486
|
-
$
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1494
|
-
}, speed);
|
|
1550
|
+
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1551
|
+
_this.LGel.trigger(lGEvents.slideItemLoad, {
|
|
1552
|
+
index: index,
|
|
1553
|
+
delay: delay || 0,
|
|
1554
|
+
isFirstSlide: isFirstSlide,
|
|
1555
|
+
});
|
|
1556
|
+
}, _speed);
|
|
1495
1557
|
};
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
1501
|
-
*
|
|
1502
|
-
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
1503
|
-
*/
|
|
1504
|
-
LightGallery.prototype.isVideo = function (src, index) {
|
|
1505
|
-
if (!src) {
|
|
1506
|
-
if (this.galleryItems[index].video) {
|
|
1507
|
-
return {
|
|
1508
|
-
html5: true,
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
else {
|
|
1512
|
-
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
1513
|
-
(index + 1) +
|
|
1514
|
-
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
1519
|
-
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i);
|
|
1520
|
-
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
1521
|
-
if (youtube) {
|
|
1522
|
-
return {
|
|
1523
|
-
youtube: youtube,
|
|
1524
|
-
};
|
|
1525
|
-
}
|
|
1526
|
-
else if (vimeo) {
|
|
1527
|
-
return {
|
|
1528
|
-
vimeo: vimeo,
|
|
1529
|
-
};
|
|
1530
|
-
}
|
|
1531
|
-
else if (wistia) {
|
|
1532
|
-
return {
|
|
1533
|
-
wistia: wistia,
|
|
1534
|
-
};
|
|
1535
|
-
}
|
|
1558
|
+
LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
|
|
1559
|
+
return !!(!this.lGalleryOn &&
|
|
1560
|
+
this.zoomFromOrigin &&
|
|
1561
|
+
this.currentImageSize);
|
|
1536
1562
|
};
|
|
1537
1563
|
// Add video slideInfo
|
|
1538
1564
|
LightGallery.prototype.addSlideVideoInfo = function (items) {
|
|
1539
|
-
var _this = this;
|
|
1540
1565
|
items.forEach(function (element, index) {
|
|
1541
|
-
element.__slideVideoInfo =
|
|
1566
|
+
element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
|
|
1542
1567
|
});
|
|
1543
1568
|
};
|
|
1544
1569
|
/**
|
|
@@ -1576,7 +1601,7 @@
|
|
|
1576
1601
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1577
1602
|
if (videoInfo) {
|
|
1578
1603
|
var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
|
|
1579
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom,
|
|
1604
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1580
1605
|
lgVideoStyle = this.getVideoContStyle(videoSize);
|
|
1581
1606
|
}
|
|
1582
1607
|
if (iframe) {
|
|
@@ -1611,7 +1636,6 @@
|
|
|
1611
1636
|
src: src,
|
|
1612
1637
|
html5Video: _html5Video,
|
|
1613
1638
|
hasPoster: !!poster,
|
|
1614
|
-
isFirstSlide: isFirstSlide,
|
|
1615
1639
|
});
|
|
1616
1640
|
}
|
|
1617
1641
|
this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
|
|
@@ -1627,8 +1651,8 @@
|
|
|
1627
1651
|
if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
|
|
1628
1652
|
_speed = delay;
|
|
1629
1653
|
}
|
|
1630
|
-
// Only for first slide
|
|
1631
|
-
if (
|
|
1654
|
+
// Only for first slide and zoomFromOrigin is enabled
|
|
1655
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1632
1656
|
setTimeout(function () {
|
|
1633
1657
|
$currentSlide
|
|
1634
1658
|
.removeClass('lg-start-end-progress lg-start-progress')
|
|
@@ -1636,23 +1660,24 @@
|
|
|
1636
1660
|
}, this.settings.startAnimationDuration + 100);
|
|
1637
1661
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1638
1662
|
setTimeout(function () {
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
var mediaObject = $currentSlide
|
|
1648
|
-
.find('.lg-object')
|
|
1649
|
-
.first();
|
|
1650
|
-
if (utils.isImageLoaded(mediaObject.get())) {
|
|
1651
|
-
_this.loadContentOnLoad(index, $currentSlide, _speed);
|
|
1663
|
+
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1664
|
+
$currentSlide
|
|
1665
|
+
.find('.lg-img-wrap')
|
|
1666
|
+
.append(utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
|
|
1667
|
+
if (srcset || sources) {
|
|
1668
|
+
var $img = $currentSlide.find('.lg-object');
|
|
1669
|
+
_this.initPictureFill($img);
|
|
1670
|
+
}
|
|
1652
1671
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1672
|
+
if (_this.getSlideType(currentGalleryItem) === 'image' ||
|
|
1673
|
+
(_this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1674
|
+
poster)) {
|
|
1675
|
+
_this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
|
|
1676
|
+
// load remaining slides once the slide is completely loaded
|
|
1677
|
+
_this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
|
|
1678
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1679
|
+
}, function () {
|
|
1680
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1656
1681
|
});
|
|
1657
1682
|
}
|
|
1658
1683
|
}, this.settings.startAnimationDuration + 100);
|
|
@@ -1660,10 +1685,9 @@
|
|
|
1660
1685
|
}
|
|
1661
1686
|
// SLide content has been added to dom
|
|
1662
1687
|
$currentSlide.addClass('lg-loaded');
|
|
1663
|
-
this.
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1688
|
+
if (!this.isFirstSlideWithZoomAnimation() ||
|
|
1689
|
+
(this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
|
|
1690
|
+
this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
|
|
1667
1691
|
}
|
|
1668
1692
|
// When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
|
|
1669
1693
|
if ((!this.zoomFromOrigin || !this.currentImageSize) &&
|
|
@@ -1690,7 +1714,14 @@
|
|
|
1690
1714
|
}
|
|
1691
1715
|
}
|
|
1692
1716
|
};
|
|
1693
|
-
|
|
1717
|
+
/**
|
|
1718
|
+
* @desc Remove dummy image content and load next slides
|
|
1719
|
+
* Called only for the first time if zoomFromOrigin animation is enabled
|
|
1720
|
+
* @param index
|
|
1721
|
+
* @param $currentSlide
|
|
1722
|
+
* @param speed
|
|
1723
|
+
*/
|
|
1724
|
+
LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
|
|
1694
1725
|
var _this = this;
|
|
1695
1726
|
setTimeout(function () {
|
|
1696
1727
|
$currentSlide.find('.lg-dummy-img').remove();
|
|
@@ -1861,7 +1892,7 @@
|
|
|
1861
1892
|
this.setDownloadValue(index);
|
|
1862
1893
|
if (videoInfo) {
|
|
1863
1894
|
var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
|
|
1864
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom,
|
|
1895
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1865
1896
|
this.resizeVideoSlide(index, videoSize);
|
|
1866
1897
|
}
|
|
1867
1898
|
this.LGel.trigger(lGEvents.beforeSlide, {
|
|
@@ -1921,15 +1952,15 @@
|
|
|
1921
1952
|
if (!this.lGalleryOn) {
|
|
1922
1953
|
this.loadContent(index, true);
|
|
1923
1954
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1955
|
+
else {
|
|
1956
|
+
setTimeout(function () {
|
|
1926
1957
|
_this.loadContent(index, true);
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1958
|
+
// Add title if this.settings.appendSubHtmlTo === lg-sub-html
|
|
1959
|
+
if (_this.settings.appendSubHtmlTo !== '.lg-item') {
|
|
1960
|
+
_this.addHtml(index);
|
|
1961
|
+
}
|
|
1962
|
+
}, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
|
|
1963
|
+
}
|
|
1933
1964
|
setTimeout(function () {
|
|
1934
1965
|
_this.lgBusy = false;
|
|
1935
1966
|
previousSlideItem_1.removeClass('lg-slide-progress');
|
|
@@ -2373,12 +2404,13 @@
|
|
|
2373
2404
|
return;
|
|
2374
2405
|
}
|
|
2375
2406
|
if (e.deltaY > 0) {
|
|
2376
|
-
_this.goToPrevSlide();
|
|
2377
|
-
}
|
|
2378
|
-
else {
|
|
2379
2407
|
_this.goToNextSlide();
|
|
2408
|
+
e.preventDefault();
|
|
2409
|
+
}
|
|
2410
|
+
else if (e.deltaY < 0) {
|
|
2411
|
+
_this.goToPrevSlide();
|
|
2412
|
+
e.preventDefault();
|
|
2380
2413
|
}
|
|
2381
|
-
e.preventDefault();
|
|
2382
2414
|
});
|
|
2383
2415
|
};
|
|
2384
2416
|
LightGallery.prototype.isSlideElement = function (target) {
|
|
@@ -2468,7 +2500,7 @@
|
|
|
2468
2500
|
if (this.zoomFromOrigin && currentItem) {
|
|
2469
2501
|
var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
|
|
2470
2502
|
var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
|
|
2471
|
-
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo &&
|
|
2503
|
+
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
|
|
2472
2504
|
transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
|
|
2473
2505
|
}
|
|
2474
2506
|
if (this.zoomFromOrigin && transform) {
|