lightgallery 2.3.0-beta.1 → 2.3.0
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 +17 -8
- package/lg-utils.d.ts +25 -4
- package/lib/lg-settings.js +4 -2
- package/lib/lg-settings.js.map +1 -1
- package/lib/lg-utils.js +45 -5
- 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 +113 -119
- 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 +37 -31
- 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 +194 -147
- package/lightgallery.es5.js.map +1 -1
- package/lightgallery.min.js +2 -2
- package/lightgallery.umd.js +194 -147
- 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 +56 -30
- 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 +56 -30
- 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 +194 -147
- package/react/Lightgallery.es5.js.map +1 -1
- package/react/Lightgallery.umd.js +194 -147
- 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 +188 -150
- package/vue/LightGalleryVue.common.js.map +1 -1
- package/vue/LightGalleryVue.umd.js +188 -150
- 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
|
|
35
|
+
* lightgallery | 2.3.0 | October 28th 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(',');
|
|
@@ -555,9 +565,9 @@
|
|
|
555
565
|
', 1)';
|
|
556
566
|
return transform;
|
|
557
567
|
},
|
|
558
|
-
getIframeMarkup: function (iframeWidth, iframeHeight, src, iframeTitle) {
|
|
568
|
+
getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
|
|
559
569
|
var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
|
|
560
|
-
return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:" + iframeWidth + "; height: " + iframeHeight + "\">\n <iframe class=\"lg-object\" frameborder=\"0\" " + title + " src=\"" + src + "\" allowfullscreen=\"true\"></iframe>\n </div>";
|
|
570
|
+
return "<div class=\"lg-video-cont lg-has-iframe\" style=\"width:" + iframeWidth + "; max-width:" + iframeMaxWidth + "; height: " + iframeHeight + "; max-height:" + iframeMaxHeight + "\">\n <iframe class=\"lg-object\" frameborder=\"0\" " + title + " src=\"" + src + "\" allowfullscreen=\"true\"></iframe>\n </div>";
|
|
561
571
|
},
|
|
562
572
|
getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
|
|
563
573
|
var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
|
|
@@ -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,
|
|
@@ -695,6 +746,7 @@
|
|
|
695
746
|
supportLegacyBrowser: true,
|
|
696
747
|
allowMediaOverlap: false,
|
|
697
748
|
videoMaxSize: '1280-720',
|
|
749
|
+
loadYouTubePoster: true,
|
|
698
750
|
defaultCaptionHeight: 0,
|
|
699
751
|
ariaLabelledby: '',
|
|
700
752
|
ariaDescribedby: '',
|
|
@@ -715,7 +767,6 @@
|
|
|
715
767
|
subHtmlSelectorRelative: false,
|
|
716
768
|
preload: 2,
|
|
717
769
|
numberOfSlideItemsInDom: 10,
|
|
718
|
-
showAfterLoad: true,
|
|
719
770
|
selector: '',
|
|
720
771
|
selectWithin: '',
|
|
721
772
|
nextHtml: '',
|
|
@@ -723,6 +774,8 @@
|
|
|
723
774
|
index: 0,
|
|
724
775
|
iframeWidth: '100%',
|
|
725
776
|
iframeHeight: '100%',
|
|
777
|
+
iframeMaxWidth: '100%',
|
|
778
|
+
iframeMaxHeight: '100%',
|
|
726
779
|
download: true,
|
|
727
780
|
counter: true,
|
|
728
781
|
appendCounterTo: '.lg-toolbar',
|
|
@@ -989,9 +1042,6 @@
|
|
|
989
1042
|
if (this.settings.enableDrag) {
|
|
990
1043
|
outerClassNames += 'lg-grab ';
|
|
991
1044
|
}
|
|
992
|
-
if (this.settings.showAfterLoad) {
|
|
993
|
-
outerClassNames += 'lg-show-after-load';
|
|
994
|
-
}
|
|
995
1045
|
this.outer.addClass(outerClassNames);
|
|
996
1046
|
this.$inner.css('transition-timing-function', this.settings.easing);
|
|
997
1047
|
this.$inner.css('transition-duration', this.settings.speed + 'ms');
|
|
@@ -1010,10 +1060,10 @@
|
|
|
1010
1060
|
LightGallery.prototype.refreshOnResize = function () {
|
|
1011
1061
|
if (this.lgOpened) {
|
|
1012
1062
|
var currentGalleryItem = this.galleryItems[this.index];
|
|
1013
|
-
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo
|
|
1063
|
+
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
|
|
1014
1064
|
this.mediaContainerPosition = this.getMediaContainerPosition();
|
|
1015
1065
|
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 &&
|
|
1066
|
+
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1017
1067
|
if (__slideVideoInfo) {
|
|
1018
1068
|
this.resizeVideoSlide(this.index, this.currentImageSize);
|
|
1019
1069
|
}
|
|
@@ -1192,9 +1242,9 @@
|
|
|
1192
1242
|
if (!this.settings.allowMediaOverlap) {
|
|
1193
1243
|
this.setMediaContainerPosition(top, bottom);
|
|
1194
1244
|
}
|
|
1195
|
-
var
|
|
1245
|
+
var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
|
|
1196
1246
|
if (this.zoomFromOrigin && element) {
|
|
1197
|
-
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo &&
|
|
1247
|
+
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1198
1248
|
transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
|
|
1199
1249
|
}
|
|
1200
1250
|
if (!this.zoomFromOrigin || !transform) {
|
|
@@ -1448,7 +1498,7 @@
|
|
|
1448
1498
|
// displayed on top of actual image
|
|
1449
1499
|
var imgContent = '';
|
|
1450
1500
|
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1451
|
-
if (
|
|
1501
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1452
1502
|
imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
|
|
1453
1503
|
}
|
|
1454
1504
|
else {
|
|
@@ -1457,88 +1507,73 @@
|
|
|
1457
1507
|
var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
|
|
1458
1508
|
$currentSlide.prepend(imgMarkup);
|
|
1459
1509
|
};
|
|
1460
|
-
LightGallery.prototype.
|
|
1461
|
-
var
|
|
1462
|
-
if (
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1510
|
+
LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
|
|
1511
|
+
var mediaObject = $slide.find('.lg-object').first();
|
|
1512
|
+
if (utils.isImageLoaded(mediaObject.get()) ||
|
|
1513
|
+
isHTML5VideoWithoutPoster) {
|
|
1514
|
+
onLoad();
|
|
1515
|
+
}
|
|
1516
|
+
else {
|
|
1517
|
+
mediaObject.on('load.lg error.lg', function () {
|
|
1518
|
+
onLoad && onLoad();
|
|
1519
|
+
});
|
|
1520
|
+
mediaObject.on('error.lg', function () {
|
|
1521
|
+
onError && onError();
|
|
1467
1522
|
});
|
|
1468
1523
|
}
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1524
|
+
};
|
|
1525
|
+
/**
|
|
1526
|
+
*
|
|
1527
|
+
* @param $el Current slide item
|
|
1528
|
+
* @param index
|
|
1529
|
+
* @param delay Delay is 0 except first time
|
|
1530
|
+
* @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
|
|
1531
|
+
* @param isFirstSlide
|
|
1532
|
+
*/
|
|
1533
|
+
LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
|
|
1534
|
+
var _this = this;
|
|
1535
|
+
this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
|
|
1536
|
+
_this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
|
|
1537
|
+
}, function () {
|
|
1538
|
+
currentSlide.addClass('lg-complete lg-complete_');
|
|
1539
|
+
currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1473
1540
|
});
|
|
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
1541
|
};
|
|
1483
|
-
LightGallery.prototype.
|
|
1542
|
+
LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
|
|
1484
1543
|
var _this = this;
|
|
1544
|
+
var currentGalleryItem = this.galleryItems[index];
|
|
1545
|
+
// Adding delay for video slides without poster for better performance and user experience
|
|
1546
|
+
// Videos should start playing once once the gallery is completely loaded
|
|
1547
|
+
var _speed = isFirstSlide &&
|
|
1548
|
+
this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1549
|
+
!currentGalleryItem.poster
|
|
1550
|
+
? speed
|
|
1551
|
+
: 0;
|
|
1485
1552
|
setTimeout(function () {
|
|
1486
|
-
$
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1494
|
-
}, speed);
|
|
1553
|
+
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1554
|
+
_this.LGel.trigger(lGEvents.slideItemLoad, {
|
|
1555
|
+
index: index,
|
|
1556
|
+
delay: delay || 0,
|
|
1557
|
+
isFirstSlide: isFirstSlide,
|
|
1558
|
+
});
|
|
1559
|
+
}, _speed);
|
|
1495
1560
|
};
|
|
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
|
-
}
|
|
1561
|
+
LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
|
|
1562
|
+
return !!(!this.lGalleryOn &&
|
|
1563
|
+
this.zoomFromOrigin &&
|
|
1564
|
+
this.currentImageSize);
|
|
1536
1565
|
};
|
|
1537
1566
|
// Add video slideInfo
|
|
1538
1567
|
LightGallery.prototype.addSlideVideoInfo = function (items) {
|
|
1539
1568
|
var _this = this;
|
|
1540
1569
|
items.forEach(function (element, index) {
|
|
1541
|
-
element.__slideVideoInfo =
|
|
1570
|
+
element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
|
|
1571
|
+
if (element.__slideVideoInfo &&
|
|
1572
|
+
_this.settings.loadYouTubePoster &&
|
|
1573
|
+
!element.poster &&
|
|
1574
|
+
element.__slideVideoInfo.youtube) {
|
|
1575
|
+
element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/maxresdefault.jpg";
|
|
1576
|
+
}
|
|
1542
1577
|
});
|
|
1543
1578
|
};
|
|
1544
1579
|
/**
|
|
@@ -1576,11 +1611,11 @@
|
|
|
1576
1611
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1577
1612
|
if (videoInfo) {
|
|
1578
1613
|
var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
|
|
1579
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom,
|
|
1614
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1580
1615
|
lgVideoStyle = this.getVideoContStyle(videoSize);
|
|
1581
1616
|
}
|
|
1582
1617
|
if (iframe) {
|
|
1583
|
-
var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
|
|
1618
|
+
var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
|
|
1584
1619
|
$currentSlide.prepend(markup);
|
|
1585
1620
|
}
|
|
1586
1621
|
else if (poster) {
|
|
@@ -1611,7 +1646,6 @@
|
|
|
1611
1646
|
src: src,
|
|
1612
1647
|
html5Video: _html5Video,
|
|
1613
1648
|
hasPoster: !!poster,
|
|
1614
|
-
isFirstSlide: isFirstSlide,
|
|
1615
1649
|
});
|
|
1616
1650
|
}
|
|
1617
1651
|
this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
|
|
@@ -1627,8 +1661,8 @@
|
|
|
1627
1661
|
if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
|
|
1628
1662
|
_speed = delay;
|
|
1629
1663
|
}
|
|
1630
|
-
// Only for first slide
|
|
1631
|
-
if (
|
|
1664
|
+
// Only for first slide and zoomFromOrigin is enabled
|
|
1665
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1632
1666
|
setTimeout(function () {
|
|
1633
1667
|
$currentSlide
|
|
1634
1668
|
.removeClass('lg-start-end-progress lg-start-progress')
|
|
@@ -1636,23 +1670,24 @@
|
|
|
1636
1670
|
}, this.settings.startAnimationDuration + 100);
|
|
1637
1671
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1638
1672
|
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);
|
|
1673
|
+
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1674
|
+
$currentSlide
|
|
1675
|
+
.find('.lg-img-wrap')
|
|
1676
|
+
.append(utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
|
|
1677
|
+
if (srcset || sources) {
|
|
1678
|
+
var $img = $currentSlide.find('.lg-object');
|
|
1679
|
+
_this.initPictureFill($img);
|
|
1680
|
+
}
|
|
1652
1681
|
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1682
|
+
if (_this.getSlideType(currentGalleryItem) === 'image' ||
|
|
1683
|
+
(_this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1684
|
+
poster)) {
|
|
1685
|
+
_this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
|
|
1686
|
+
// load remaining slides once the slide is completely loaded
|
|
1687
|
+
_this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
|
|
1688
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1689
|
+
}, function () {
|
|
1690
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1656
1691
|
});
|
|
1657
1692
|
}
|
|
1658
1693
|
}, this.settings.startAnimationDuration + 100);
|
|
@@ -1660,10 +1695,9 @@
|
|
|
1660
1695
|
}
|
|
1661
1696
|
// SLide content has been added to dom
|
|
1662
1697
|
$currentSlide.addClass('lg-loaded');
|
|
1663
|
-
this.
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1698
|
+
if (!this.isFirstSlideWithZoomAnimation() ||
|
|
1699
|
+
(this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
|
|
1700
|
+
this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
|
|
1667
1701
|
}
|
|
1668
1702
|
// When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
|
|
1669
1703
|
if ((!this.zoomFromOrigin || !this.currentImageSize) &&
|
|
@@ -1690,7 +1724,14 @@
|
|
|
1690
1724
|
}
|
|
1691
1725
|
}
|
|
1692
1726
|
};
|
|
1693
|
-
|
|
1727
|
+
/**
|
|
1728
|
+
* @desc Remove dummy image content and load next slides
|
|
1729
|
+
* Called only for the first time if zoomFromOrigin animation is enabled
|
|
1730
|
+
* @param index
|
|
1731
|
+
* @param $currentSlide
|
|
1732
|
+
* @param speed
|
|
1733
|
+
*/
|
|
1734
|
+
LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
|
|
1694
1735
|
var _this = this;
|
|
1695
1736
|
setTimeout(function () {
|
|
1696
1737
|
$currentSlide.find('.lg-dummy-img').remove();
|
|
@@ -1861,7 +1902,7 @@
|
|
|
1861
1902
|
this.setDownloadValue(index);
|
|
1862
1903
|
if (videoInfo) {
|
|
1863
1904
|
var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
|
|
1864
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom,
|
|
1905
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1865
1906
|
this.resizeVideoSlide(index, videoSize);
|
|
1866
1907
|
}
|
|
1867
1908
|
this.LGel.trigger(lGEvents.beforeSlide, {
|
|
@@ -1921,15 +1962,15 @@
|
|
|
1921
1962
|
if (!this.lGalleryOn) {
|
|
1922
1963
|
this.loadContent(index, true);
|
|
1923
1964
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
1965
|
+
else {
|
|
1966
|
+
setTimeout(function () {
|
|
1926
1967
|
_this.loadContent(index, true);
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1968
|
+
// Add title if this.settings.appendSubHtmlTo === lg-sub-html
|
|
1969
|
+
if (_this.settings.appendSubHtmlTo !== '.lg-item') {
|
|
1970
|
+
_this.addHtml(index);
|
|
1971
|
+
}
|
|
1972
|
+
}, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
|
|
1973
|
+
}
|
|
1933
1974
|
setTimeout(function () {
|
|
1934
1975
|
_this.lgBusy = false;
|
|
1935
1976
|
previousSlideItem_1.removeClass('lg-slide-progress');
|
|
@@ -2368,17 +2409,23 @@
|
|
|
2368
2409
|
};
|
|
2369
2410
|
LightGallery.prototype.mousewheel = function () {
|
|
2370
2411
|
var _this = this;
|
|
2371
|
-
|
|
2412
|
+
var lastCall = 0;
|
|
2413
|
+
this.outer.on('wheel.lg', function (e) {
|
|
2372
2414
|
if (!e.deltaY || _this.galleryItems.length < 2) {
|
|
2373
2415
|
return;
|
|
2374
2416
|
}
|
|
2375
|
-
|
|
2376
|
-
|
|
2417
|
+
e.preventDefault();
|
|
2418
|
+
var now = new Date().getTime();
|
|
2419
|
+
if (now - lastCall < 1000) {
|
|
2420
|
+
return;
|
|
2377
2421
|
}
|
|
2378
|
-
|
|
2422
|
+
lastCall = now;
|
|
2423
|
+
if (e.deltaY > 0) {
|
|
2379
2424
|
_this.goToNextSlide();
|
|
2380
2425
|
}
|
|
2381
|
-
e.
|
|
2426
|
+
else if (e.deltaY < 0) {
|
|
2427
|
+
_this.goToPrevSlide();
|
|
2428
|
+
}
|
|
2382
2429
|
});
|
|
2383
2430
|
};
|
|
2384
2431
|
LightGallery.prototype.isSlideElement = function (target) {
|
|
@@ -2468,7 +2515,7 @@
|
|
|
2468
2515
|
if (this.zoomFromOrigin && currentItem) {
|
|
2469
2516
|
var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
|
|
2470
2517
|
var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
|
|
2471
|
-
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo &&
|
|
2518
|
+
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
|
|
2472
2519
|
transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
|
|
2473
2520
|
}
|
|
2474
2521
|
if (this.zoomFromOrigin && transform) {
|