lightgallery 2.3.0-beta.4 → 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.
Files changed (62) hide show
  1. package/lg-settings.d.ts +13 -1
  2. package/lg-utils.d.ts +15 -3
  3. package/lib/lg-settings.js +3 -0
  4. package/lib/lg-settings.js.map +1 -1
  5. package/lib/lg-utils.js +2 -2
  6. package/lib/lg-utils.js.map +1 -1
  7. package/lib/lightgallery.js +16 -4
  8. package/lib/lightgallery.js.map +1 -1
  9. package/lightgallery.es5.js +22 -7
  10. package/lightgallery.es5.js.map +1 -1
  11. package/lightgallery.min.js +2 -2
  12. package/lightgallery.umd.js +22 -7
  13. package/lightgallery.umd.js.map +1 -1
  14. package/lit/lightgallery.esm.js +7 -7
  15. package/lit/lightgallery.umd.js +2 -2
  16. package/package.json +1 -1
  17. package/plugins/autoplay/lg-autoplay.es5.js +1 -1
  18. package/plugins/autoplay/lg-autoplay.min.js +1 -1
  19. package/plugins/autoplay/lg-autoplay.umd.js +1 -1
  20. package/plugins/comment/lg-comment.es5.js +1 -1
  21. package/plugins/comment/lg-comment.min.js +1 -1
  22. package/plugins/comment/lg-comment.umd.js +1 -1
  23. package/plugins/fullscreen/lg-fullscreen.es5.js +1 -1
  24. package/plugins/fullscreen/lg-fullscreen.min.js +1 -1
  25. package/plugins/fullscreen/lg-fullscreen.umd.js +1 -1
  26. package/plugins/hash/lg-hash.es5.js +1 -1
  27. package/plugins/hash/lg-hash.min.js +1 -1
  28. package/plugins/hash/lg-hash.umd.js +1 -1
  29. package/plugins/mediumZoom/lg-medium-zoom.es5.js +1 -1
  30. package/plugins/mediumZoom/lg-medium-zoom.min.js +1 -1
  31. package/plugins/mediumZoom/lg-medium-zoom.umd.js +1 -1
  32. package/plugins/pager/lg-pager.es5.js +1 -1
  33. package/plugins/pager/lg-pager.min.js +1 -1
  34. package/plugins/pager/lg-pager.umd.js +1 -1
  35. package/plugins/relativeCaption/lg-relative-caption.es5.js +1 -1
  36. package/plugins/relativeCaption/lg-relative-caption.min.js +1 -1
  37. package/plugins/relativeCaption/lg-relative-caption.umd.js +1 -1
  38. package/plugins/rotate/lg-rotate.es5.js +1 -1
  39. package/plugins/rotate/lg-rotate.min.js +1 -1
  40. package/plugins/rotate/lg-rotate.umd.js +1 -1
  41. package/plugins/share/lg-share.es5.js +1 -1
  42. package/plugins/share/lg-share.min.js +1 -1
  43. package/plugins/share/lg-share.umd.js +1 -1
  44. package/plugins/thumbnail/lg-thumbnail.es5.js +1 -1
  45. package/plugins/thumbnail/lg-thumbnail.min.js +1 -1
  46. package/plugins/thumbnail/lg-thumbnail.umd.js +1 -1
  47. package/plugins/video/lg-video.es5.js +1 -1
  48. package/plugins/video/lg-video.min.js +1 -1
  49. package/plugins/video/lg-video.umd.js +1 -1
  50. package/plugins/zoom/lg-zoom.es5.js +1 -1
  51. package/plugins/zoom/lg-zoom.min.js +1 -1
  52. package/plugins/zoom/lg-zoom.umd.js +1 -1
  53. package/react/Lightgallery.es5.js +22 -7
  54. package/react/Lightgallery.es5.js.map +1 -1
  55. package/react/Lightgallery.umd.js +22 -7
  56. package/react/Lightgallery.umd.js.map +1 -1
  57. package/vue/LightGalleryVue.common.js +154 -139
  58. package/vue/LightGalleryVue.common.js.map +1 -1
  59. package/vue/LightGalleryVue.umd.js +154 -139
  60. package/vue/LightGalleryVue.umd.js.map +1 -1
  61. package/vue/LightGalleryVue.umd.min.js +2 -2
  62. 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.4 | October 11th 2021
31
+ * lightgallery | 2.3.0 | October 28th 2021
32
32
  * http://www.lightgalleryjs.com/
33
33
  * Copyright (c) 2020 Sachin Neravath;
34
34
  * @license GPLv3
@@ -561,9 +561,9 @@ var utils = {
561
561
  ', 1)';
562
562
  return transform;
563
563
  },
564
- getIframeMarkup: function (iframeWidth, iframeHeight, src, iframeTitle) {
564
+ getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
565
565
  var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
566
- 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>";
566
+ 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>";
567
567
  },
568
568
  getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
569
569
  var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
@@ -742,6 +742,7 @@ var lightGalleryCoreSettings = {
742
742
  supportLegacyBrowser: true,
743
743
  allowMediaOverlap: false,
744
744
  videoMaxSize: '1280-720',
745
+ loadYouTubePoster: true,
745
746
  defaultCaptionHeight: 0,
746
747
  ariaLabelledby: '',
747
748
  ariaDescribedby: '',
@@ -769,6 +770,8 @@ var lightGalleryCoreSettings = {
769
770
  index: 0,
770
771
  iframeWidth: '100%',
771
772
  iframeHeight: '100%',
773
+ iframeMaxWidth: '100%',
774
+ iframeMaxHeight: '100%',
772
775
  download: true,
773
776
  counter: true,
774
777
  appendCounterTo: '.lg-toolbar',
@@ -1558,8 +1561,15 @@ var LightGallery = /** @class */ (function () {
1558
1561
  };
1559
1562
  // Add video slideInfo
1560
1563
  LightGallery.prototype.addSlideVideoInfo = function (items) {
1564
+ var _this = this;
1561
1565
  items.forEach(function (element, index) {
1562
1566
  element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
1567
+ if (element.__slideVideoInfo &&
1568
+ _this.settings.loadYouTubePoster &&
1569
+ !element.poster &&
1570
+ element.__slideVideoInfo.youtube) {
1571
+ element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/maxresdefault.jpg";
1572
+ }
1563
1573
  });
1564
1574
  };
1565
1575
  /**
@@ -1601,7 +1611,7 @@ var LightGallery = /** @class */ (function () {
1601
1611
  lgVideoStyle = this.getVideoContStyle(videoSize);
1602
1612
  }
1603
1613
  if (iframe) {
1604
- var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, src, currentGalleryItem.iframeTitle);
1614
+ var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
1605
1615
  $currentSlide.prepend(markup);
1606
1616
  }
1607
1617
  else if (poster) {
@@ -2395,17 +2405,22 @@ var LightGallery = /** @class */ (function () {
2395
2405
  };
2396
2406
  LightGallery.prototype.mousewheel = function () {
2397
2407
  var _this = this;
2398
- this.outer.on('mousewheel.lg', function (e) {
2408
+ var lastCall = 0;
2409
+ this.outer.on('wheel.lg', function (e) {
2399
2410
  if (!e.deltaY || _this.galleryItems.length < 2) {
2400
2411
  return;
2401
2412
  }
2413
+ e.preventDefault();
2414
+ var now = new Date().getTime();
2415
+ if (now - lastCall < 1000) {
2416
+ return;
2417
+ }
2418
+ lastCall = now;
2402
2419
  if (e.deltaY > 0) {
2403
2420
  _this.goToNextSlide();
2404
- e.preventDefault();
2405
2421
  }
2406
2422
  else if (e.deltaY < 0) {
2407
2423
  _this.goToPrevSlide();
2408
- e.preventDefault();
2409
2424
  }
2410
2425
  });
2411
2426
  };