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
package/lightgallery.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* lightgallery | 2.3.0
|
|
2
|
+
* lightgallery | 2.3.0 | October 28th 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(',');
|
|
@@ -528,9 +538,9 @@
|
|
|
528
538
|
', 1)';
|
|
529
539
|
return transform;
|
|
530
540
|
},
|
|
531
|
-
getIframeMarkup: function (iframeWidth, iframeHeight, src, iframeTitle) {
|
|
541
|
+
getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
|
|
532
542
|
var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
|
|
533
|
-
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>";
|
|
543
|
+
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>";
|
|
534
544
|
},
|
|
535
545
|
getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
|
|
536
546
|
var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
|
|
@@ -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,
|
|
@@ -668,6 +719,7 @@
|
|
|
668
719
|
supportLegacyBrowser: true,
|
|
669
720
|
allowMediaOverlap: false,
|
|
670
721
|
videoMaxSize: '1280-720',
|
|
722
|
+
loadYouTubePoster: true,
|
|
671
723
|
defaultCaptionHeight: 0,
|
|
672
724
|
ariaLabelledby: '',
|
|
673
725
|
ariaDescribedby: '',
|
|
@@ -688,7 +740,6 @@
|
|
|
688
740
|
subHtmlSelectorRelative: false,
|
|
689
741
|
preload: 2,
|
|
690
742
|
numberOfSlideItemsInDom: 10,
|
|
691
|
-
showAfterLoad: true,
|
|
692
743
|
selector: '',
|
|
693
744
|
selectWithin: '',
|
|
694
745
|
nextHtml: '',
|
|
@@ -696,6 +747,8 @@
|
|
|
696
747
|
index: 0,
|
|
697
748
|
iframeWidth: '100%',
|
|
698
749
|
iframeHeight: '100%',
|
|
750
|
+
iframeMaxWidth: '100%',
|
|
751
|
+
iframeMaxHeight: '100%',
|
|
699
752
|
download: true,
|
|
700
753
|
counter: true,
|
|
701
754
|
appendCounterTo: '.lg-toolbar',
|
|
@@ -962,9 +1015,6 @@
|
|
|
962
1015
|
if (this.settings.enableDrag) {
|
|
963
1016
|
outerClassNames += 'lg-grab ';
|
|
964
1017
|
}
|
|
965
|
-
if (this.settings.showAfterLoad) {
|
|
966
|
-
outerClassNames += 'lg-show-after-load';
|
|
967
|
-
}
|
|
968
1018
|
this.outer.addClass(outerClassNames);
|
|
969
1019
|
this.$inner.css('transition-timing-function', this.settings.easing);
|
|
970
1020
|
this.$inner.css('transition-duration', this.settings.speed + 'ms');
|
|
@@ -983,10 +1033,10 @@
|
|
|
983
1033
|
LightGallery.prototype.refreshOnResize = function () {
|
|
984
1034
|
if (this.lgOpened) {
|
|
985
1035
|
var currentGalleryItem = this.galleryItems[this.index];
|
|
986
|
-
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo
|
|
1036
|
+
var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
|
|
987
1037
|
this.mediaContainerPosition = this.getMediaContainerPosition();
|
|
988
1038
|
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 &&
|
|
1039
|
+
this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
990
1040
|
if (__slideVideoInfo) {
|
|
991
1041
|
this.resizeVideoSlide(this.index, this.currentImageSize);
|
|
992
1042
|
}
|
|
@@ -1165,9 +1215,9 @@
|
|
|
1165
1215
|
if (!this.settings.allowMediaOverlap) {
|
|
1166
1216
|
this.setMediaContainerPosition(top, bottom);
|
|
1167
1217
|
}
|
|
1168
|
-
var
|
|
1218
|
+
var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
|
|
1169
1219
|
if (this.zoomFromOrigin && element) {
|
|
1170
|
-
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo &&
|
|
1220
|
+
this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
|
|
1171
1221
|
transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
|
|
1172
1222
|
}
|
|
1173
1223
|
if (!this.zoomFromOrigin || !transform) {
|
|
@@ -1421,7 +1471,7 @@
|
|
|
1421
1471
|
// displayed on top of actual image
|
|
1422
1472
|
var imgContent = '';
|
|
1423
1473
|
var altAttr = alt ? 'alt="' + alt + '"' : '';
|
|
1424
|
-
if (
|
|
1474
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1425
1475
|
imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
|
|
1426
1476
|
}
|
|
1427
1477
|
else {
|
|
@@ -1430,88 +1480,73 @@
|
|
|
1430
1480
|
var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
|
|
1431
1481
|
$currentSlide.prepend(imgMarkup);
|
|
1432
1482
|
};
|
|
1433
|
-
LightGallery.prototype.
|
|
1434
|
-
var
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1483
|
+
LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
|
|
1484
|
+
var mediaObject = $slide.find('.lg-object').first();
|
|
1485
|
+
if (utils.isImageLoaded(mediaObject.get()) ||
|
|
1486
|
+
isHTML5VideoWithoutPoster) {
|
|
1487
|
+
onLoad();
|
|
1488
|
+
}
|
|
1489
|
+
else {
|
|
1490
|
+
mediaObject.on('load.lg error.lg', function () {
|
|
1491
|
+
onLoad && onLoad();
|
|
1492
|
+
});
|
|
1493
|
+
mediaObject.on('error.lg', function () {
|
|
1494
|
+
onError && onError();
|
|
1440
1495
|
});
|
|
1441
1496
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1497
|
+
};
|
|
1498
|
+
/**
|
|
1499
|
+
*
|
|
1500
|
+
* @param $el Current slide item
|
|
1501
|
+
* @param index
|
|
1502
|
+
* @param delay Delay is 0 except first time
|
|
1503
|
+
* @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
|
|
1504
|
+
* @param isFirstSlide
|
|
1505
|
+
*/
|
|
1506
|
+
LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
|
|
1507
|
+
var _this = this;
|
|
1508
|
+
this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
|
|
1509
|
+
_this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
|
|
1510
|
+
}, function () {
|
|
1511
|
+
currentSlide.addClass('lg-complete lg-complete_');
|
|
1512
|
+
currentSlide.html('<span class="lg-error-msg">Oops... Failed to load content...</span>');
|
|
1446
1513
|
});
|
|
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
1514
|
};
|
|
1456
|
-
LightGallery.prototype.
|
|
1515
|
+
LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
|
|
1457
1516
|
var _this = this;
|
|
1517
|
+
var currentGalleryItem = this.galleryItems[index];
|
|
1518
|
+
// Adding delay for video slides without poster for better performance and user experience
|
|
1519
|
+
// Videos should start playing once once the gallery is completely loaded
|
|
1520
|
+
var _speed = isFirstSlide &&
|
|
1521
|
+
this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1522
|
+
!currentGalleryItem.poster
|
|
1523
|
+
? speed
|
|
1524
|
+
: 0;
|
|
1458
1525
|
setTimeout(function () {
|
|
1459
|
-
$
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
}
|
|
1467
|
-
}, speed);
|
|
1526
|
+
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1527
|
+
_this.LGel.trigger(lGEvents.slideItemLoad, {
|
|
1528
|
+
index: index,
|
|
1529
|
+
delay: delay || 0,
|
|
1530
|
+
isFirstSlide: isFirstSlide,
|
|
1531
|
+
});
|
|
1532
|
+
}, _speed);
|
|
1468
1533
|
};
|
|
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
|
-
}
|
|
1534
|
+
LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
|
|
1535
|
+
return !!(!this.lGalleryOn &&
|
|
1536
|
+
this.zoomFromOrigin &&
|
|
1537
|
+
this.currentImageSize);
|
|
1509
1538
|
};
|
|
1510
1539
|
// Add video slideInfo
|
|
1511
1540
|
LightGallery.prototype.addSlideVideoInfo = function (items) {
|
|
1512
1541
|
var _this = this;
|
|
1513
1542
|
items.forEach(function (element, index) {
|
|
1514
|
-
element.__slideVideoInfo =
|
|
1543
|
+
element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
|
|
1544
|
+
if (element.__slideVideoInfo &&
|
|
1545
|
+
_this.settings.loadYouTubePoster &&
|
|
1546
|
+
!element.poster &&
|
|
1547
|
+
element.__slideVideoInfo.youtube) {
|
|
1548
|
+
element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/maxresdefault.jpg";
|
|
1549
|
+
}
|
|
1515
1550
|
});
|
|
1516
1551
|
};
|
|
1517
1552
|
/**
|
|
@@ -1549,11 +1584,11 @@
|
|
|
1549
1584
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1550
1585
|
if (videoInfo) {
|
|
1551
1586
|
var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
|
|
1552
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom,
|
|
1587
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1553
1588
|
lgVideoStyle = this.getVideoContStyle(videoSize);
|
|
1554
1589
|
}
|
|
1555
1590
|
if (iframe) {
|
|
1556
|
-
var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
|
|
1591
|
+
var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
|
|
1557
1592
|
$currentSlide.prepend(markup);
|
|
1558
1593
|
}
|
|
1559
1594
|
else if (poster) {
|
|
@@ -1584,7 +1619,6 @@
|
|
|
1584
1619
|
src: src,
|
|
1585
1620
|
html5Video: _html5Video,
|
|
1586
1621
|
hasPoster: !!poster,
|
|
1587
|
-
isFirstSlide: isFirstSlide,
|
|
1588
1622
|
});
|
|
1589
1623
|
}
|
|
1590
1624
|
this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
|
|
@@ -1600,8 +1634,8 @@
|
|
|
1600
1634
|
if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
|
|
1601
1635
|
_speed = delay;
|
|
1602
1636
|
}
|
|
1603
|
-
// Only for first slide
|
|
1604
|
-
if (
|
|
1637
|
+
// Only for first slide and zoomFromOrigin is enabled
|
|
1638
|
+
if (this.isFirstSlideWithZoomAnimation()) {
|
|
1605
1639
|
setTimeout(function () {
|
|
1606
1640
|
$currentSlide
|
|
1607
1641
|
.removeClass('lg-start-end-progress lg-start-progress')
|
|
@@ -1609,23 +1643,24 @@
|
|
|
1609
1643
|
}, this.settings.startAnimationDuration + 100);
|
|
1610
1644
|
if (!$currentSlide.hasClass('lg-loaded')) {
|
|
1611
1645
|
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);
|
|
1646
|
+
if (_this.getSlideType(currentGalleryItem) === 'image') {
|
|
1647
|
+
$currentSlide
|
|
1648
|
+
.find('.lg-img-wrap')
|
|
1649
|
+
.append(utils.getImgMarkup(index, src, '', srcset, sizes, currentGalleryItem.sources));
|
|
1650
|
+
if (srcset || sources) {
|
|
1651
|
+
var $img = $currentSlide.find('.lg-object');
|
|
1652
|
+
_this.initPictureFill($img);
|
|
1653
|
+
}
|
|
1625
1654
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1655
|
+
if (_this.getSlideType(currentGalleryItem) === 'image' ||
|
|
1656
|
+
(_this.getSlideType(currentGalleryItem) === 'video' &&
|
|
1657
|
+
poster)) {
|
|
1658
|
+
_this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
|
|
1659
|
+
// load remaining slides once the slide is completely loaded
|
|
1660
|
+
_this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
|
|
1661
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1662
|
+
}, function () {
|
|
1663
|
+
_this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
|
|
1629
1664
|
});
|
|
1630
1665
|
}
|
|
1631
1666
|
}, this.settings.startAnimationDuration + 100);
|
|
@@ -1633,10 +1668,9 @@
|
|
|
1633
1668
|
}
|
|
1634
1669
|
// SLide content has been added to dom
|
|
1635
1670
|
$currentSlide.addClass('lg-loaded');
|
|
1636
|
-
this.
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
$currentSlide.addClass('lg-complete lg-complete_');
|
|
1671
|
+
if (!this.isFirstSlideWithZoomAnimation() ||
|
|
1672
|
+
(this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
|
|
1673
|
+
this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
|
|
1640
1674
|
}
|
|
1641
1675
|
// When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
|
|
1642
1676
|
if ((!this.zoomFromOrigin || !this.currentImageSize) &&
|
|
@@ -1663,7 +1697,14 @@
|
|
|
1663
1697
|
}
|
|
1664
1698
|
}
|
|
1665
1699
|
};
|
|
1666
|
-
|
|
1700
|
+
/**
|
|
1701
|
+
* @desc Remove dummy image content and load next slides
|
|
1702
|
+
* Called only for the first time if zoomFromOrigin animation is enabled
|
|
1703
|
+
* @param index
|
|
1704
|
+
* @param $currentSlide
|
|
1705
|
+
* @param speed
|
|
1706
|
+
*/
|
|
1707
|
+
LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
|
|
1667
1708
|
var _this = this;
|
|
1668
1709
|
setTimeout(function () {
|
|
1669
1710
|
$currentSlide.find('.lg-dummy-img').remove();
|
|
@@ -1834,7 +1875,7 @@
|
|
|
1834
1875
|
this.setDownloadValue(index);
|
|
1835
1876
|
if (videoInfo) {
|
|
1836
1877
|
var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
|
|
1837
|
-
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom,
|
|
1878
|
+
var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
|
|
1838
1879
|
this.resizeVideoSlide(index, videoSize);
|
|
1839
1880
|
}
|
|
1840
1881
|
this.LGel.trigger(lGEvents.beforeSlide, {
|
|
@@ -1894,15 +1935,15 @@
|
|
|
1894
1935
|
if (!this.lGalleryOn) {
|
|
1895
1936
|
this.loadContent(index, true);
|
|
1896
1937
|
}
|
|
1897
|
-
|
|
1898
|
-
|
|
1938
|
+
else {
|
|
1939
|
+
setTimeout(function () {
|
|
1899
1940
|
_this.loadContent(index, true);
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1941
|
+
// Add title if this.settings.appendSubHtmlTo === lg-sub-html
|
|
1942
|
+
if (_this.settings.appendSubHtmlTo !== '.lg-item') {
|
|
1943
|
+
_this.addHtml(index);
|
|
1944
|
+
}
|
|
1945
|
+
}, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
|
|
1946
|
+
}
|
|
1906
1947
|
setTimeout(function () {
|
|
1907
1948
|
_this.lgBusy = false;
|
|
1908
1949
|
previousSlideItem_1.removeClass('lg-slide-progress');
|
|
@@ -2341,17 +2382,23 @@
|
|
|
2341
2382
|
};
|
|
2342
2383
|
LightGallery.prototype.mousewheel = function () {
|
|
2343
2384
|
var _this = this;
|
|
2344
|
-
|
|
2385
|
+
var lastCall = 0;
|
|
2386
|
+
this.outer.on('wheel.lg', function (e) {
|
|
2345
2387
|
if (!e.deltaY || _this.galleryItems.length < 2) {
|
|
2346
2388
|
return;
|
|
2347
2389
|
}
|
|
2348
|
-
|
|
2349
|
-
|
|
2390
|
+
e.preventDefault();
|
|
2391
|
+
var now = new Date().getTime();
|
|
2392
|
+
if (now - lastCall < 1000) {
|
|
2393
|
+
return;
|
|
2350
2394
|
}
|
|
2351
|
-
|
|
2395
|
+
lastCall = now;
|
|
2396
|
+
if (e.deltaY > 0) {
|
|
2352
2397
|
_this.goToNextSlide();
|
|
2353
2398
|
}
|
|
2354
|
-
e.
|
|
2399
|
+
else if (e.deltaY < 0) {
|
|
2400
|
+
_this.goToPrevSlide();
|
|
2401
|
+
}
|
|
2355
2402
|
});
|
|
2356
2403
|
};
|
|
2357
2404
|
LightGallery.prototype.isSlideElement = function (target) {
|
|
@@ -2441,7 +2488,7 @@
|
|
|
2441
2488
|
if (this.zoomFromOrigin && currentItem) {
|
|
2442
2489
|
var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
|
|
2443
2490
|
var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
|
|
2444
|
-
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo &&
|
|
2491
|
+
var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
|
|
2445
2492
|
transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
|
|
2446
2493
|
}
|
|
2447
2494
|
if (this.zoomFromOrigin && transform) {
|