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
|
@@ -28,7 +28,7 @@ function __rest(s, e) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/*!
|
|
31
|
-
* lightgallery | 2.3.0-beta |
|
|
31
|
+
* lightgallery | 2.3.0-beta.4 | October 11th 2021
|
|
32
32
|
* http://www.lightgalleryjs.com/
|
|
33
33
|
* Copyright (c) 2020 Sachin Neravath;
|
|
34
34
|
* @license GPLv3
|
|
@@ -68,24 +68,30 @@ function __spreadArrays() {
|
|
|
68
68
|
return r;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
71
|
+
function initLgPolyfills() {
|
|
72
|
+
(function () {
|
|
73
|
+
if (typeof window.CustomEvent === 'function')
|
|
74
|
+
return false;
|
|
75
|
+
function CustomEvent(event, params) {
|
|
76
|
+
params = params || {
|
|
77
|
+
bubbles: false,
|
|
78
|
+
cancelable: false,
|
|
79
|
+
detail: null,
|
|
80
|
+
};
|
|
81
|
+
var evt = document.createEvent('CustomEvent');
|
|
82
|
+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
83
|
+
return evt;
|
|
84
|
+
}
|
|
85
|
+
window.CustomEvent = CustomEvent;
|
|
86
|
+
})();
|
|
87
|
+
(function () {
|
|
88
|
+
if (!Element.prototype.matches) {
|
|
89
|
+
Element.prototype.matches =
|
|
90
|
+
Element.prototype.msMatchesSelector ||
|
|
91
|
+
Element.prototype.webkitMatchesSelector;
|
|
92
|
+
}
|
|
93
|
+
})();
|
|
94
|
+
}
|
|
89
95
|
var lgQuery = /** @class */ (function () {
|
|
90
96
|
function lgQuery(selector) {
|
|
91
97
|
this.cssVenderPrefixes = [
|
|
@@ -218,7 +224,9 @@ var lgQuery = /** @class */ (function () {
|
|
|
218
224
|
this._each(function (el) {
|
|
219
225
|
// IE doesn't support multiple arguments
|
|
220
226
|
classNames.split(' ').forEach(function (className) {
|
|
221
|
-
|
|
227
|
+
if (className) {
|
|
228
|
+
el.classList.add(className);
|
|
229
|
+
}
|
|
222
230
|
});
|
|
223
231
|
});
|
|
224
232
|
return this;
|
|
@@ -227,7 +235,9 @@ var lgQuery = /** @class */ (function () {
|
|
|
227
235
|
this._each(function (el) {
|
|
228
236
|
// IE doesn't support multiple arguments
|
|
229
237
|
classNames.split(' ').forEach(function (className) {
|
|
230
|
-
|
|
238
|
+
if (className) {
|
|
239
|
+
el.classList.remove(className);
|
|
240
|
+
}
|
|
231
241
|
});
|
|
232
242
|
});
|
|
233
243
|
return this;
|
|
@@ -427,6 +437,7 @@ var lgQuery = /** @class */ (function () {
|
|
|
427
437
|
return lgQuery;
|
|
428
438
|
}());
|
|
429
439
|
function $LG(selector) {
|
|
440
|
+
initLgPolyfills();
|
|
430
441
|
return new lgQuery(selector);
|
|
431
442
|
}
|
|
432
443
|
|
|
@@ -471,12 +482,11 @@ var utils = {
|
|
|
471
482
|
/**
|
|
472
483
|
* get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
|
|
473
484
|
*/
|
|
474
|
-
|
|
475
|
-
getSize: function (el, container, spacing, isDisabled, defaultLgSize) {
|
|
485
|
+
getSize: function (el, container, spacing, defaultLgSize) {
|
|
476
486
|
if (spacing === void 0) { spacing = 0; }
|
|
477
487
|
var LGel = $LG(el);
|
|
478
488
|
var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
|
|
479
|
-
if (!lgSize
|
|
489
|
+
if (!lgSize) {
|
|
480
490
|
return;
|
|
481
491
|
}
|
|
482
492
|
var isResponsiveSizes = lgSize.split(',');
|
|
@@ -670,6 +680,47 @@ var utils = {
|
|
|
670
680
|
isMobile: function () {
|
|
671
681
|
return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
|
|
672
682
|
},
|
|
683
|
+
/**
|
|
684
|
+
* @desc Check the given src is video
|
|
685
|
+
* @param {String} src
|
|
686
|
+
* @return {Object} video type
|
|
687
|
+
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
688
|
+
*
|
|
689
|
+
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
690
|
+
*/
|
|
691
|
+
isVideo: function (src, isHTML5VIdeo, index) {
|
|
692
|
+
if (!src) {
|
|
693
|
+
if (isHTML5VIdeo) {
|
|
694
|
+
return {
|
|
695
|
+
html5: true,
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
700
|
+
(index + 1) +
|
|
701
|
+
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
706
|
+
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
|
|
707
|
+
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
708
|
+
if (youtube) {
|
|
709
|
+
return {
|
|
710
|
+
youtube: youtube,
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
else if (vimeo) {
|
|
714
|
+
return {
|
|
715
|
+
vimeo: vimeo,
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
else if (wistia) {
|
|
719
|
+
return {
|
|
720
|
+
wistia: wistia,
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
},
|
|
673
724
|
};
|
|
674
725
|
|
|
675
726
|
var lightGalleryCoreSettings = {
|
|
@@ -682,7 +733,7 @@ var lightGalleryCoreSettings = {
|
|
|
682
733
|
addClass: '',
|
|
683
734
|
startClass: 'lg-start-zoom',
|
|
684
735
|
backdropDuration: 300,
|
|
685
|
-
container:
|
|
736
|
+
container: '',
|
|
686
737
|
startAnimationDuration: 400,
|
|
687
738
|
zoomFromOrigin: true,
|
|
688
739
|
hideBarsDelay: 0,
|
|
@@ -711,7 +762,6 @@ var lightGalleryCoreSettings = {
|
|
|
711
762
|
subHtmlSelectorRelative: false,
|
|
712
763
|
preload: 2,
|
|
713
764
|
numberOfSlideItemsInDom: 10,
|
|
714
|
-
showAfterLoad: true,
|
|
715
765
|
selector: '',
|
|
716
766
|
selectWithin: '',
|
|
717
767
|
nextHtml: '',
|
|
@@ -985,9 +1035,6 @@ var LightGallery = /** @class */ (function () {
|
|
|
985
1035
|
if (this.settings.enableDrag) {
|
|
986
1036
|
outerClassNames += 'lg-grab ';
|
|
987
1037
|
}
|
|
988
|
-
if (this.settings.showAfterLoad) {
|
|
989
|
-
outerClassNames += 'lg-show-after-load';
|
|
990
|
-
}
|
|
991
1038
|
this.outer.addClass(outerClassNames);
|
|
992
1039
|
this.$inner.css('transition-timing-function', this.settings.easing);
|
|
993
1040
|
this.$inner.css('transition-duration', this.settings.speed + 'ms');
|
|
@@ -1006,10 +1053,10 @@ var LightGallery = /** @class */ (function () {
|
|
|
1006
1053
|
LightGallery.prototype.refreshOnResize = function () {
|
|
1007
1054
|
if (this.lgOpened) {
|
|
1008
1055
|
var currentGalleryItem = this.galleryItems[this.index];
|
|
1009
|
-
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo
|
|
1056
|
+
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
|
|
1010
1057
|
this.mediaContainerPosition = this.getMediaContainerPosition();
|
|
1011
1058
|
var _a = this.mediaContainerPosition, top_1 = _a.top, bottom = _a.bottom;
|
|
1012
|
-
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo &&
|
|
1059
|
+
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1013
1060
|
if (__slideVideoInfo) {
|
|
1014
1061
|
this.resizeVideoSlide(this.index, this.currentImageSize);
|
|
1015
1062
|
}
|
|
@@ -1188,9 +1235,9 @@ var LightGallery = /** @class */ (function () {
|
|
|
1188
1235
|
if (!this.settings.allowMediaOverlap) {
|
|
1189
1236
|
this.setMediaContainerPosition(top, bottom);
|
|
1190
1237
|
}
|
|
1191
|
-
var
|
|
1238
|
+
var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
|
|
1192
1239
|
if (this.zoomFromOrigin && element) {
|
|
1193
|
-
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo &&
|
|
1240
|
+
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1194
1241
|
transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
|
|
1195
1242
|
}
|
|
1196
1243
|
if (!this.zoomFromOrigin || !transform) {
|
|
@@ -1444,7 +1491,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
1444
1491
|
// displayed on top of actual image
|
|
1445
1492
|
var imgContent = '';
|
|
1446
1493
|
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1447
|
-
if (
|
|
1494
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1448
1495
|
imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
|
|
1449
1496
|
}
|
|
1450
1497
|
else {
|
|
@@ -1453,88 +1500,66 @@ var LightGallery = /** @class */ (function () {
|
|
|
1453
1500
|
var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
|
|
1454
1501
|
$currentSlide.prepend(imgMarkup);
|
|
1455
1502
|
};
|
|
1456
|
-
LightGallery.prototype.
|
|
1457
|
-
var
|
|
1458
|
-
if (
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1503
|
+
LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
|
|
1504
|
+
var mediaObject = $slide.find('.lg-object').first();
|
|
1505
|
+
if (utils.isImageLoaded(mediaObject.get()) ||
|
|
1506
|
+
isHTML5VideoWithoutPoster) {
|
|
1507
|
+
onLoad();
|
|
1508
|
+
}
|
|
1509
|
+
else {
|
|
1510
|
+
mediaObject.on('load.lg error.lg', function () {
|
|
1511
|
+
onLoad && onLoad();
|
|
1512
|
+
});
|
|
1513
|
+
mediaObject.on('error.lg', function () {
|
|
1514
|
+
onError && onError();
|
|
1463
1515
|
});
|
|
1464
1516
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1517
|
+
};
|
|
1518
|
+
/**
|
|
1519
|
+
*
|
|
1520
|
+
* @param $el Current slide item
|
|
1521
|
+
* @param index
|
|
1522
|
+
* @param delay Delay is 0 except first time
|
|
1523
|
+
* @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
|
|
1524
|
+
* @param isFirstSlide
|
|
1525
|
+
*/
|
|
1526
|
+
LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
|
|
1527
|
+
var _this = this;
|
|
1528
|
+
this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
|
|
1529
|
+
_this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
|
|
1530
|
+
}, function () {
|
|
1531
|
+
currentSlide.addClass('lg-complete lg-complete_');
|
|
1532
|
+
currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1469
1533
|
});
|
|
1470
|
-
setTimeout(function () {
|
|
1471
|
-
$el.find('.lg-object')
|
|
1472
|
-
.first()
|
|
1473
|
-
.on('error.lg', function () {
|
|
1474
|
-
$el.addClass('lg-complete lg-complete_');
|
|
1475
|
-
$el.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1476
|
-
});
|
|
1477
|
-
}, speed);
|
|
1478
1534
|
};
|
|
1479
|
-
LightGallery.prototype.
|
|
1535
|
+
LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
|
|
1480
1536
|
var _this = this;
|
|
1537
|
+
var currentGalleryItem = this.galleryItems[index];
|
|
1538
|
+
// Adding delay for video slides without poster for better performance and user experience
|
|
1539
|
+
// Videos should start playing once once the gallery is completely loaded
|
|
1540
|
+
var _speed = isFirstSlide &&
|
|
1541
|
+
this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1542
|
+
!currentGalleryItem.poster
|
|
1543
|
+
? speed
|
|
1544
|
+
: 0;
|
|
1481
1545
|
setTimeout(function () {
|
|
1482
|
-
$
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
}
|
|
1490
|
-
}, speed);
|
|
1546
|
+
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1547
|
+
_this.LGel.trigger(lGEvents.slideItemLoad, {
|
|
1548
|
+
index: index,
|
|
1549
|
+
delay: delay || 0,
|
|
1550
|
+
isFirstSlide: isFirstSlide,
|
|
1551
|
+
});
|
|
1552
|
+
}, _speed);
|
|
1491
1553
|
};
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
* Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
|
|
1497
|
-
*
|
|
1498
|
-
* @todo - this information can be moved to dynamicEl to avoid frequent calls
|
|
1499
|
-
*/
|
|
1500
|
-
LightGallery.prototype.isVideo = function (src, index) {
|
|
1501
|
-
if (!src) {
|
|
1502
|
-
if (this.galleryItems[index].video) {
|
|
1503
|
-
return {
|
|
1504
|
-
html5: true,
|
|
1505
|
-
};
|
|
1506
|
-
}
|
|
1507
|
-
else {
|
|
1508
|
-
console.error('lightGallery :- data-src is not provided on slide item ' +
|
|
1509
|
-
(index + 1) +
|
|
1510
|
-
'. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
|
|
1511
|
-
return;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
|
|
1515
|
-
var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)/i);
|
|
1516
|
-
var wistia = src.match(/https?:\/\/(.+)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
|
|
1517
|
-
if (youtube) {
|
|
1518
|
-
return {
|
|
1519
|
-
youtube: youtube,
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
|
-
else if (vimeo) {
|
|
1523
|
-
return {
|
|
1524
|
-
vimeo: vimeo,
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
else if (wistia) {
|
|
1528
|
-
return {
|
|
1529
|
-
wistia: wistia,
|
|
1530
|
-
};
|
|
1531
|
-
}
|
|
1554
|
+
LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
|
|
1555
|
+
return !!(!this.lGalleryOn &&
|
|
1556
|
+
this.zoomFromOrigin &&
|
|
1557
|
+
this.currentImageSize);
|
|
1532
1558
|
};
|
|
1533
1559
|
// Add video slideInfo
|
|
1534
1560
|
LightGallery.prototype.addSlideVideoInfo = function (items) {
|
|
1535
|
-
var _this = this;
|
|
1536
1561
|
items.forEach(function (element, index) {
|
|
1537
|
-
element.__slideVideoInfo =
|
|
1562
|
+
element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
|
|
1538
1563
|
});
|
|
1539
1564
|
};
|
|
1540
1565
|
/**
|
|
@@ -1572,7 +1597,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
1572
1597
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1573
1598
|
if (videoInfo) {
|
|
1574
1599
|
var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
|
|
1575
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom,
|
|
1600
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1576
1601
|
lgVideoStyle = this.getVideoContStyle(videoSize);
|
|
1577
1602
|
}
|
|
1578
1603
|
if (iframe) {
|
|
@@ -1607,7 +1632,6 @@ var LightGallery = /** @class */ (function () {
|
|
|
1607
1632
|
src: src,
|
|
1608
1633
|
html5Video: _html5Video,
|
|
1609
1634
|
hasPoster: !!poster,
|
|
1610
|
-
isFirstSlide: isFirstSlide,
|
|
1611
1635
|
});
|
|
1612
1636
|
}
|
|
1613
1637
|
this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
|
|
@@ -1623,8 +1647,8 @@ var LightGallery = /** @class */ (function () {
|
|
|
1623
1647
|
if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
|
|
1624
1648
|
_speed = delay;
|
|
1625
1649
|
}
|
|
1626
|
-
// Only for first slide
|
|
1627
|
-
if (
|
|
1650
|
+
// Only for first slide and zoomFromOrigin is enabled
|
|
1651
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1628
1652
|
setTimeout(function () {
|
|
1629
1653
|
$currentSlide
|
|
1630
1654
|
.removeClass('lg-start-end-progress lg-start-progress')
|
|
@@ -1632,23 +1656,24 @@ var LightGallery = /** @class */ (function () {
|
|
|
1632
1656
|
}, this.settings.startAnimationDuration + 100);
|
|
1633
1657
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1634
1658
|
setTimeout(function () {
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
var mediaObject = $currentSlide
|
|
1644
|
-
.find('.lg-object')
|
|
1645
|
-
.first();
|
|
1646
|
-
if (utils.isImageLoaded(mediaObject.get())) {
|
|
1647
|
-
_this.loadContentOnLoad(index, $currentSlide, _speed);
|
|
1659
|
+
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1660
|
+
$currentSlide
|
|
1661
|
+
.find('.lg-img-wrap')
|
|
1662
|
+
.append(utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
|
|
1663
|
+
if (srcset || sources) {
|
|
1664
|
+
var $img = $currentSlide.find('.lg-object');
|
|
1665
|
+
_this.initPictureFill($img);
|
|
1666
|
+
}
|
|
1648
1667
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1668
|
+
if (_this.getSlideType(currentGalleryItem) === 'image' ||
|
|
1669
|
+
(_this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1670
|
+
poster)) {
|
|
1671
|
+
_this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
|
|
1672
|
+
// load remaining slides once the slide is completely loaded
|
|
1673
|
+
_this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
|
|
1674
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1675
|
+
}, function () {
|
|
1676
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1652
1677
|
});
|
|
1653
1678
|
}
|
|
1654
1679
|
}, this.settings.startAnimationDuration + 100);
|
|
@@ -1656,10 +1681,9 @@ var LightGallery = /** @class */ (function () {
|
|
|
1656
1681
|
}
|
|
1657
1682
|
// SLide content has been added to dom
|
|
1658
1683
|
$currentSlide.addClass('lg-loaded');
|
|
1659
|
-
this.
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1684
|
+
if (!this.isFirstSlideWithZoomAnimation() ||
|
|
1685
|
+
(this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
|
|
1686
|
+
this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
|
|
1663
1687
|
}
|
|
1664
1688
|
// When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
|
|
1665
1689
|
if ((!this.zoomFromOrigin || !this.currentImageSize) &&
|
|
@@ -1686,7 +1710,14 @@ var LightGallery = /** @class */ (function () {
|
|
|
1686
1710
|
}
|
|
1687
1711
|
}
|
|
1688
1712
|
};
|
|
1689
|
-
|
|
1713
|
+
/**
|
|
1714
|
+
* @desc Remove dummy image content and load next slides
|
|
1715
|
+
* Called only for the first time if zoomFromOrigin animation is enabled
|
|
1716
|
+
* @param index
|
|
1717
|
+
* @param $currentSlide
|
|
1718
|
+
* @param speed
|
|
1719
|
+
*/
|
|
1720
|
+
LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
|
|
1690
1721
|
var _this = this;
|
|
1691
1722
|
setTimeout(function () {
|
|
1692
1723
|
$currentSlide.find('.lg-dummy-img').remove();
|
|
@@ -1857,7 +1888,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
1857
1888
|
this.setDownloadValue(index);
|
|
1858
1889
|
if (videoInfo) {
|
|
1859
1890
|
var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
|
|
1860
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom,
|
|
1891
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1861
1892
|
this.resizeVideoSlide(index, videoSize);
|
|
1862
1893
|
}
|
|
1863
1894
|
this.LGel.trigger(lGEvents.beforeSlide, {
|
|
@@ -1917,15 +1948,15 @@ var LightGallery = /** @class */ (function () {
|
|
|
1917
1948
|
if (!this.lGalleryOn) {
|
|
1918
1949
|
this.loadContent(index, true);
|
|
1919
1950
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1951
|
+
else {
|
|
1952
|
+
setTimeout(function () {
|
|
1922
1953
|
_this.loadContent(index, true);
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1954
|
+
// Add title if this.settings.appendSubHtmlTo === lg-sub-html
|
|
1955
|
+
if (_this.settings.appendSubHtmlTo !== '.lg-item') {
|
|
1956
|
+
_this.addHtml(index);
|
|
1957
|
+
}
|
|
1958
|
+
}, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
|
|
1959
|
+
}
|
|
1929
1960
|
setTimeout(function () {
|
|
1930
1961
|
_this.lgBusy = false;
|
|
1931
1962
|
previousSlideItem_1.removeClass('lg-slide-progress');
|
|
@@ -2369,12 +2400,13 @@ var LightGallery = /** @class */ (function () {
|
|
|
2369
2400
|
return;
|
|
2370
2401
|
}
|
|
2371
2402
|
if (e.deltaY > 0) {
|
|
2372
|
-
_this.goToPrevSlide();
|
|
2373
|
-
}
|
|
2374
|
-
else {
|
|
2375
2403
|
_this.goToNextSlide();
|
|
2404
|
+
e.preventDefault();
|
|
2405
|
+
}
|
|
2406
|
+
else if (e.deltaY < 0) {
|
|
2407
|
+
_this.goToPrevSlide();
|
|
2408
|
+
e.preventDefault();
|
|
2376
2409
|
}
|
|
2377
|
-
e.preventDefault();
|
|
2378
2410
|
});
|
|
2379
2411
|
};
|
|
2380
2412
|
LightGallery.prototype.isSlideElement = function (target) {
|
|
@@ -2464,7 +2496,7 @@ var LightGallery = /** @class */ (function () {
|
|
|
2464
2496
|
if (this.zoomFromOrigin && currentItem) {
|
|
2465
2497
|
var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
|
|
2466
2498
|
var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
|
|
2467
|
-
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo &&
|
|
2499
|
+
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
|
|
2468
2500
|
transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
|
|
2469
2501
|
}
|
|
2470
2502
|
if (this.zoomFromOrigin && transform) {
|