j1-template 2024.3.22 → 2024.3.23

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 (287) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/{galeries.html → gallery_app.html} +4 -4
  3. data/assets/theme/bla +0 -0
  4. data/assets/theme/j1/adapter/js/amplitude.js +144 -52
  5. data/assets/theme/j1/adapter/js/gallery.js +1 -1
  6. data/assets/theme/j1/adapter/js/themes.js +41 -69
  7. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +19 -52
  8. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  9. data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +466 -396
  10. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lg-transitions.css +984 -0
  11. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lg-transitions.min.css +26 -0
  12. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lightgallery-bundle.css +1627 -0
  13. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lightgallery-bundle.min.css +25 -0
  14. data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/uno.css +1 -1
  15. data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/uno.min.css +1 -1
  16. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.svg +54 -0
  17. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.ttf +0 -0
  18. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.woff +0 -0
  19. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.woff2 +0 -0
  20. data/assets/theme/j1/modules/lightGallery/!v2.7.2/images/loading.gif +0 -0
  21. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/loading.gif +0 -0
  22. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/video-play.png +0 -0
  23. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/vimeo-play.png +0 -0
  24. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/youtube-play.png +0 -0
  25. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/lightgallery.js +2782 -0
  26. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/lightgallery.min.js +26 -0
  27. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/LICENSE.md +44 -0
  28. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/README.md +37 -0
  29. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/parser.js +890 -0
  30. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/parser.min.js +8 -0
  31. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/j1/lg-video.1.js +585 -0
  32. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-autoplay.js +275 -0
  33. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-autoplay.min.js +26 -0
  34. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-comment.js +230 -0
  35. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-comment.min.js +26 -0
  36. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-fullscreen.js +160 -0
  37. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-fullscreen.min.js +26 -0
  38. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-hash.js +223 -0
  39. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-hash.min.js +27 -0
  40. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-medium-zoom.js +157 -0
  41. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-medium-zoom.min.js +26 -0
  42. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-pager.js +164 -0
  43. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-pager.min.js +26 -0
  44. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-rotate.js +299 -0
  45. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-rotate.min.js +26 -0
  46. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-share.js +244 -0
  47. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-share.min.js +27 -0
  48. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-thumbnail.js +509 -0
  49. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-thumbnail.min.js +26 -0
  50. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-video.js +909 -0
  51. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-video.min.js +26 -0
  52. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-vimeo-thumbnail.js +207 -0
  53. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-vimeo-thumbnail.min.js +26 -0
  54. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-zoom.js +999 -0
  55. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-zoom.min.js +26 -0
  56. data/assets/theme/j1/modules/lightGallery/css/lg-transitions.css +3 -126
  57. data/assets/theme/j1/modules/lightGallery/css/lg-transitions.min.css +3 -10
  58. data/assets/theme/j1/modules/lightGallery/css/lightgallery-bundle.css +70 -237
  59. data/assets/theme/j1/modules/lightGallery/css/lightgallery-bundle.min.css +4 -10
  60. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/animation-w.png +0 -0
  61. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/customize-w.png +0 -0
  62. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/dynamic-w.png +0 -0
  63. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/facebook-icon.svg +10 -0
  64. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/googleplus-icon.svg +30 -0
  65. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/html5-w.png +0 -0
  66. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/linked-in.png +0 -0
  67. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/module-w.png +0 -0
  68. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/play-button-hover.svg +94 -0
  69. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/play-button.png +0 -0
  70. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/play-button.svg +93 -0
  71. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/responsive-w.png +0 -0
  72. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/thumb-w.png +0 -0
  73. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/touch-w.png +0 -0
  74. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/twitter-icon.svg +15 -0
  75. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/twitter.png +0 -0
  76. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/video1-w.png +0 -0
  77. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/zoom-w.png +0 -0
  78. data/assets/theme/j1/modules/lightGallery/css/theme/uno/icons/zoom.png +0 -0
  79. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.css +276 -0
  80. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.min.css +17 -0
  81. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +163 -120
  82. data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +6 -6
  83. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-thumbnail.0.js +495 -0
  84. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-thumbnail.1.js +513 -0
  85. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.0.js +553 -0
  86. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.1.js +1 -1
  87. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.2.js +914 -0
  88. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-autoplay.js +4 -4
  89. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-autoplay.min.js +5 -5
  90. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-comment.js +5 -5
  91. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-comment.min.js +6 -6
  92. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-fullscreen.js +4 -4
  93. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-fullscreen.min.js +5 -5
  94. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-hash.js +4 -4
  95. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-hash.min.js +5 -6
  96. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-medium-zoom.js +5 -5
  97. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-medium-zoom.min.js +6 -6
  98. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-pager.js +4 -4
  99. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-pager.min.js +5 -5
  100. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-relative-caption.js +179 -0
  101. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-relative-caption.min.js +32 -0
  102. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-rotate.js +4 -4
  103. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-rotate.min.js +6 -6
  104. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-share.js +4 -4
  105. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-share.min.js +6 -7
  106. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-thumbnail.js +27 -20
  107. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-thumbnail.min.js +5 -5
  108. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +77 -125
  109. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +6 -6
  110. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-vimeo-thumbnail.js +4 -4
  111. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-vimeo-thumbnail.min.js +5 -5
  112. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-zoom.js +11 -5
  113. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-zoom.min.js +5 -5
  114. data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +13 -12
  115. data/assets/theme/j1/modules/videoPlayer/tiktoc/README.md +1 -0
  116. data/assets/theme/j1/modules/videojs/!v8.12.0/css/font/README.md +151 -0
  117. data/assets/theme/j1/modules/videojs/!v8.12.0/css/font/VideoJS.svg +150 -0
  118. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/city.css +147 -0
  119. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/city.min.css +5 -0
  120. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/fantasy.css +113 -0
  121. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/fantasy.min.css +5 -0
  122. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/forest.css +166 -0
  123. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/forest.min.css +5 -0
  124. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/sea.css +72 -0
  125. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/sea.min.css +5 -0
  126. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/uno.css +311 -0
  127. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/uno.min.css +19 -0
  128. data/assets/theme/j1/modules/videojs/!v8.12.0/css/videojs.css +1686 -0
  129. data/assets/theme/j1/modules/videojs/!v8.12.0/css/videojs.min.css +13 -0
  130. data/assets/theme/j1/modules/videojs/!v8.12.0/js/video.js +65226 -0
  131. data/assets/theme/j1/modules/videojs/!v8.12.0/js/video.min.js +55 -0
  132. data/assets/theme/j1/modules/videojs/assets/README.md +1 -0
  133. data/assets/theme/j1/modules/videojs/assets/icons/speedometer-medium.svg +35 -0
  134. data/assets/theme/j1/modules/videojs/css/font/VideoJS.ttf +0 -0
  135. data/assets/theme/j1/modules/videojs/css/font/VideoJS.woff +0 -0
  136. data/assets/theme/j1/modules/videojs/css/themes/uno.css +157 -22
  137. data/assets/theme/j1/modules/videojs/css/themes/uno.min.css +1 -1
  138. data/assets/theme/j1/modules/videojs/css/videojs.css +674 -316
  139. data/assets/theme/j1/modules/videojs/css/videojs.min.css +4 -3
  140. data/assets/theme/j1/modules/videojs/js/video.js +15893 -12288
  141. data/assets/theme/j1/modules/videojs/js/video.min.js +22 -23
  142. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/!examples/index.html +31 -0
  143. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/LICENSE +19 -0
  144. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/README.md +69 -0
  145. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/css/aspect-ratio-panel.css +2 -0
  146. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/css/aspect-ratio-panel.min.css +2 -0
  147. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/js/aspect-ratio-panel.js +339 -0
  148. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/js/aspect-ratio-panel.min.js +2 -0
  149. data/assets/theme/j1/modules/videojs/{js/plugins/controls/autocaption → plugins/controls/autocaption/js}/autocaption.js +0 -5
  150. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/!examples/index.html +29 -0
  151. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/LICENSE +19 -0
  152. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/README.md +90 -0
  153. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/js/videojs-persist.js +120 -0
  154. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/js/videojs-persist.min.js +2 -0
  155. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/!examples/index.html +37 -0
  156. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/LICENSE +19 -0
  157. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/README.md +61 -0
  158. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/js/playbackrate-adjuster.js +94 -0
  159. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/js/playbackrate-adjuster.min.js +20 -0
  160. data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/skipbuttons/README.md +25 -11
  161. data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/zoom/css}/zoom.css +7 -6
  162. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.min.css +22 -0
  163. data/assets/theme/j1/modules/videojs/{js/plugins/players/dm → plugins/players/dm/js}/dailymotion.js +1 -1
  164. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.0.js +521 -0
  165. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.1.js +605 -0
  166. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.3.js +643 -0
  167. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.4.js +583 -0
  168. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.5.js +665 -0
  169. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.6.js +642 -0
  170. data/assets/theme/j1/modules/videojs/plugins/players/vm/!unused/vimeo.7.js +673 -0
  171. data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api → plugins/players/vm/api/js}/vimeo.js +1 -1
  172. data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api → plugins/players/vm/api/js}/vimeo.min.js +1 -1
  173. data/assets/theme/j1/modules/videojs/{js/plugins/players/vm → plugins/players/vm/js}/vimeo.js +4 -5
  174. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.min.js +28 -0
  175. data/assets/theme/j1/modules/videojs/plugins/players/wt/!unused/wistia.0.js +395 -0
  176. data/assets/theme/j1/modules/videojs/plugins/players/wt/!unused/wistia.1.js +401 -0
  177. data/lib/j1/version.rb +1 -1
  178. data/lib/starter_web/README.md +5 -5
  179. data/lib/starter_web/_config.yml +1 -1
  180. data/lib/starter_web/_data/modules/amplitude_playlists.yml +16 -1
  181. data/lib/starter_web/_data/modules/defaults/gallery.yml +3 -3
  182. data/lib/starter_web/_data/modules/gallery.yml +83 -87
  183. data/lib/starter_web/_data/modules/navigator_menu.yml +3 -3
  184. data/lib/starter_web/_data/resources.yml +16 -12
  185. data/lib/starter_web/_data/templates/feed.xml +1 -1
  186. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +50 -30
  187. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +37 -23
  188. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  189. data/lib/starter_web/assets/video/poster/vimeo/fall_2011.jpg +0 -0
  190. data/lib/starter_web/package.json +1 -1
  191. data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +282 -0
  192. data/lib/starter_web/pages/public/tour/video_data.adoc +1 -0
  193. metadata +221 -106
  194. data/assets/data/swiper_app.2.html +0 -757
  195. data/assets/data/swiper_app.4.html +0 -769
  196. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.0.css +0 -32
  197. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.1.css +0 -31
  198. data/assets/theme/j1/modules/videojs/css/plugins/controls/zoom.min.css +0 -21
  199. data/assets/theme/j1/modules/videojs/js/plugins/players/vm/vimeo.min.js +0 -16
  200. data/assets/theme/j1/modules/videojs/js/plugins/players/wt/api/src/WistiaPlayer.ts +0 -1617
  201. data/lib/starter_web/assets/video/poster/vimeo/stay_colorful.jpg +0 -0
  202. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/animation-w.png +0 -0
  203. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/customize-w.png +0 -0
  204. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/dynamic-w.png +0 -0
  205. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/facebook-icon.svg +0 -0
  206. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/googleplus-icon.svg +0 -0
  207. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/html5-w.png +0 -0
  208. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/linked-in.png +0 -0
  209. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/module-w.png +0 -0
  210. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/play-button-hover.svg +0 -0
  211. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/play-button.png +0 -0
  212. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/play-button.svg +0 -0
  213. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/responsive-w.png +0 -0
  214. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/thumb-w.png +0 -0
  215. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/touch-w.png +0 -0
  216. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/twitter-icon.svg +0 -0
  217. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/twitter.png +0 -0
  218. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/video1-w.png +0 -0
  219. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/zoom-w.png +0 -0
  220. /data/assets/theme/j1/modules/lightGallery/{css → !v2.7.2/css}/themes/uno/icons/zoom.png +0 -0
  221. /data/assets/theme/j1/modules/lightGallery/{js → !v2.7.2/js}/plugins/j1/j1-video.js +0 -0
  222. /data/assets/theme/j1/modules/lightGallery/{js → !v2.7.2/js}/plugins/j1/j1-video.min.js +0 -0
  223. /data/assets/theme/j1/modules/videoPlayer/dailymotion/js/{!readme → README.md} +0 -0
  224. /data/assets/theme/j1/modules/videoPlayer/tiktoc/{js/player.min.js → player.min.js} +0 -0
  225. /data/assets/theme/j1/modules/videoPlayer/vimeo/js/{!readme → README.md} +0 -0
  226. /data/assets/theme/j1/modules/videoPlayer/wistia/js/{!readme → README.md} +0 -0
  227. /data/assets/theme/j1/modules/videojs/{css → !v8.12.0/css}/font/video-js-cdn.css +0 -0
  228. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/autocaption/LICENSE +0 -0
  229. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/autocaption/README.md +0 -0
  230. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/autocaption → plugins/controls/autocaption/js}/autocaption.min.js +0 -0
  231. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys/examples → plugins/controls/hotkeys/!examples}/example.html +0 -0
  232. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/hotkeys/LICENSE.md +0 -0
  233. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/hotkeys/README.md +0 -0
  234. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys → plugins/controls/hotkeys/js}/hotkeys.js +0 -0
  235. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/hotkeys → plugins/controls/hotkeys/js}/hotkeys.min.js +0 -0
  236. /data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/skipbuttons/css}/skipbuttons.css +0 -0
  237. /data/assets/theme/j1/modules/videojs/{css/plugins/controls → plugins/controls/skipbuttons/css}/skipbuttons.min.css +0 -0
  238. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/skipbuttons → plugins/controls/skipbuttons/js}/skipbuttons.js +0 -0
  239. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/skipbuttons → plugins/controls/skipbuttons/js}/skipbuttons.min.js +0 -0
  240. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/index.html +0 -0
  241. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/index.js +0 -0
  242. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom/examples → plugins/controls/zoom/!examples}/styles.css +0 -0
  243. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/zoom/LICENSE.md +0 -0
  244. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/controls/zoom/README.md +0 -0
  245. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom → plugins/controls/zoom/js}/zoom.js +0 -0
  246. /data/assets/theme/j1/modules/videojs/{js/plugins/controls/zoom → plugins/controls/zoom/js}/zoom.min.js +0 -0
  247. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-controls.html +0 -0
  248. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-javascript.html +0 -0
  249. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/dailymotion-playlist.html +0 -0
  250. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/global-parameters.html +0 -0
  251. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/simple.html +0 -0
  252. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/examples → plugins/players/dm/!examples}/switch.html +0 -0
  253. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/LICENSE +0 -0
  254. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/doc → plugins/players/dm}/README.md +0 -0
  255. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/api/LICENSE +0 -0
  256. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api/doc → plugins/players/dm/api}/README.md +0 -0
  257. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api → plugins/players/dm/api/js}/dailymotion.sdk.js +0 -0
  258. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm/api → plugins/players/dm/api/js}/dailymotion.sdk.min.js +0 -0
  259. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/dm/icon/scalable/dailymotion.svg +0 -0
  260. /data/assets/theme/j1/modules/videojs/{js/plugins/players/dm → plugins/players/dm/js}/dailymotion.min.js +0 -0
  261. /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/examples → plugins/players/vm/!examples}/index.html +0 -0
  262. /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/examples → plugins/players/vm/!examples}/player/index.html +0 -0
  263. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/LICENSE +0 -0
  264. /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/doc → plugins/players/vm}/README.md +0 -0
  265. /data/assets/theme/j1/modules/videojs/{js/plugins/players/vm/api/doc → plugins/players/vm/api}/README.md +0 -0
  266. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/embed.player.css +0 -0
  267. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/embed.player.uno.css +0 -0
  268. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/vm/api/css/player.css +0 -0
  269. /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/doc → plugins/players/wt}/README.md +0 -0
  270. /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/api/doc/Readme.txt → plugins/players/wt/api/README.md} +0 -0
  271. /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt/api → plugins/players/wt/api/js}/wistia.min.js +0 -0
  272. /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt → plugins/players/wt/js}/wistia.js +0 -0
  273. /data/assets/theme/j1/modules/videojs/{js/plugins/players/wt → plugins/players/wt/js}/wistia.min.js +0 -0
  274. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/global-parameters.html +0 -0
  275. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/simple.html +0 -0
  276. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/switch.html +0 -0
  277. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-controls.html +0 -0
  278. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-javascript.html +0 -0
  279. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-list.html +0 -0
  280. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/examples → plugins/players/yt/!examples}/youtube-playlist.html +0 -0
  281. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/v3.0.0 → plugins/players/yt/!v3.0.0}/youtube.js +0 -0
  282. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/v3.0.0 → plugins/players/yt/!v3.0.0}/youtube.min.js +0 -0
  283. /data/assets/theme/j1/modules/videojs/{js/plugins → plugins}/players/yt/LICENSE +0 -0
  284. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/doc → plugins/players/yt}/README.md +0 -0
  285. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt/api → plugins/players/yt/api/js}/youtube.min.js +0 -0
  286. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt → plugins/players/yt/js}/youtube.js +0 -0
  287. /data/assets/theme/j1/modules/videojs/{js/plugins/players/yt → plugins/players/yt/js}/youtube.min.js +0 -0
@@ -0,0 +1,2782 @@
1
+ /*
2
+ # -----------------------------------------------------------------------------
3
+ # ~/assets/theme/j1/modules/lightGallery/js/core/lightgallery.js
4
+ # Provides the lightGallery Main JS module
5
+ #
6
+ # Product/Info:
7
+ # https://jekyll.one
8
+ #
9
+ # Copyright (C) 2025 Sachin Neravath
10
+ # Copyright (C) 2023-2025 Juergen Adams
11
+ #
12
+ # J1 Template is licensed under the MIT License.
13
+ # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
14
+ # lightGallery is licensed under the GPLv3 license
15
+ # See: https://github.com/sachinchoolur/lightGallery/blob/master/LICENSE
16
+ # -----------------------------------------------------------------------------
17
+ */
18
+
19
+ /*!
20
+ * lightgallery | 2.7.2 | September 20th 2023
21
+ * http://www.lightgalleryjs.com/
22
+ * Copyright (c) 2020 Sachin Neravath;
23
+ * @license GPLv3
24
+ */
25
+
26
+ (function (global, factory) {
27
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
28
+ typeof define === 'function' && define.amd ? define(factory) :
29
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lightGallery = factory());
30
+ }(this, (function () { 'use strict';
31
+
32
+ /*! *****************************************************************************
33
+ Copyright (c) Microsoft Corporation.
34
+
35
+ Permission to use, copy, modify, and/or distribute this software for any
36
+ purpose with or without fee is hereby granted.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
+ PERFORMANCE OF THIS SOFTWARE.
45
+ ***************************************************************************** */
46
+
47
+ var __assign = function() {
48
+ __assign = Object.assign || function __assign(t) {
49
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
50
+ s = arguments[i];
51
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
52
+ }
53
+ return t;
54
+ };
55
+ return __assign.apply(this, arguments);
56
+ };
57
+
58
+ function __spreadArrays() {
59
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
60
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
61
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
62
+ r[k] = a[j];
63
+ return r;
64
+ }
65
+
66
+ /**
67
+ * List of lightGallery events
68
+ * All events should be documented here
69
+ * Below interfaces are used to build the website documentations
70
+ * */
71
+ var lGEvents = {
72
+ afterAppendSlide: 'lgAfterAppendSlide',
73
+ init: 'lgInit',
74
+ hasVideo: 'lgHasVideo',
75
+ containerResize: 'lgContainerResize',
76
+ updateSlides: 'lgUpdateSlides',
77
+ afterAppendSubHtml: 'lgAfterAppendSubHtml',
78
+ beforeOpen: 'lgBeforeOpen',
79
+ afterOpen: 'lgAfterOpen',
80
+ slideItemLoad: 'lgSlideItemLoad',
81
+ beforeSlide: 'lgBeforeSlide',
82
+ afterSlide: 'lgAfterSlide',
83
+ posterClick: 'lgPosterClick',
84
+ dragStart: 'lgDragStart',
85
+ dragMove: 'lgDragMove',
86
+ dragEnd: 'lgDragEnd',
87
+ beforeNextSlide: 'lgBeforeNextSlide',
88
+ beforePrevSlide: 'lgBeforePrevSlide',
89
+ beforeClose: 'lgBeforeClose',
90
+ afterClose: 'lgAfterClose',
91
+ rotateLeft: 'lgRotateLeft',
92
+ rotateRight: 'lgRotateRight',
93
+ flipHorizontal: 'lgFlipHorizontal',
94
+ flipVertical: 'lgFlipVertical',
95
+ autoplay: 'lgAutoplay',
96
+ autoplayStart: 'lgAutoplayStart',
97
+ autoplayStop: 'lgAutoplayStop',
98
+ };
99
+
100
+ var lightGalleryCoreSettings = {
101
+ mode: 'lg-slide',
102
+ easing: 'ease',
103
+ speed: 400,
104
+ licenseKey: '0000-0000-000-0000',
105
+ height: '100%',
106
+ width: '100%',
107
+ addClass: '',
108
+ startClass: 'lg-start-zoom',
109
+ backdropDuration: 300,
110
+ container: '',
111
+ startAnimationDuration: 400,
112
+ zoomFromOrigin: true,
113
+ hideBarsDelay: 0,
114
+ showBarsAfter: 10000,
115
+ slideDelay: 0,
116
+ supportLegacyBrowser: true,
117
+ allowMediaOverlap: false,
118
+ videoMaxSize: '1280-720',
119
+ loadYouTubePoster: true,
120
+ defaultCaptionHeight: 0,
121
+ ariaLabelledby: '',
122
+ ariaDescribedby: '',
123
+ resetScrollPosition: true,
124
+ hideScrollbar: false,
125
+ closable: true,
126
+ swipeToClose: true,
127
+ closeOnTap: true,
128
+ showCloseIcon: true,
129
+ showMaximizeIcon: false,
130
+ loop: true,
131
+ escKey: true,
132
+ keyPress: true,
133
+ trapFocus: true,
134
+ controls: true,
135
+ slideEndAnimation: true,
136
+ hideControlOnEnd: false,
137
+ mousewheel: false,
138
+ getCaptionFromTitleOrAlt: true,
139
+ appendSubHtmlTo: '.lg-sub-html',
140
+ subHtmlSelectorRelative: false,
141
+ preload: 2,
142
+ numberOfSlideItemsInDom: 10,
143
+ selector: '',
144
+ selectWithin: '',
145
+ nextHtml: '',
146
+ prevHtml: '',
147
+ index: 0,
148
+ iframeWidth: '100%',
149
+ iframeHeight: '100%',
150
+ iframeMaxWidth: '100%',
151
+ iframeMaxHeight: '100%',
152
+ download: true,
153
+ counter: true,
154
+ appendCounterTo: '.lg-toolbar',
155
+ swipeThreshold: 50,
156
+ enableSwipe: true,
157
+ enableDrag: true,
158
+ dynamic: false,
159
+ dynamicEl: [],
160
+ extraProps: [],
161
+ exThumbImage: '',
162
+ isMobile: undefined,
163
+ mobileSettings: {
164
+ controls: false,
165
+ showCloseIcon: false,
166
+ download: false,
167
+ },
168
+ plugins: [],
169
+ strings: {
170
+ closeGallery: 'Close gallery',
171
+ toggleMaximize: 'Toggle maximize',
172
+ previousSlide: 'Previous slide',
173
+ nextSlide: 'Next slide',
174
+ download: 'Download',
175
+ playVideo: 'Play video',
176
+ mediaLoadingFailed: 'Oops... Failed to load content...',
177
+ },
178
+ };
179
+
180
+ function initLgPolyfills() {
181
+ (function () {
182
+ if (typeof window.CustomEvent === 'function')
183
+ return false;
184
+ function CustomEvent(event, params) {
185
+ params = params || {
186
+ bubbles: false,
187
+ cancelable: false,
188
+ detail: null,
189
+ };
190
+ var evt = document.createEvent('CustomEvent');
191
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
192
+ return evt;
193
+ }
194
+ window.CustomEvent = CustomEvent;
195
+ })();
196
+ (function () {
197
+ if (!Element.prototype.matches) {
198
+ Element.prototype.matches =
199
+ Element.prototype.msMatchesSelector ||
200
+ Element.prototype.webkitMatchesSelector;
201
+ }
202
+ })();
203
+ }
204
+ var lgQuery = /** @class */ (function () {
205
+ function lgQuery(selector) {
206
+ this.cssVenderPrefixes = [
207
+ 'TransitionDuration',
208
+ 'TransitionTimingFunction',
209
+ 'Transform',
210
+ 'Transition',
211
+ ];
212
+ this.selector = this._getSelector(selector);
213
+ this.firstElement = this._getFirstEl();
214
+ return this;
215
+ }
216
+ lgQuery.generateUUID = function () {
217
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
218
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
219
+ return v.toString(16);
220
+ });
221
+ };
222
+ lgQuery.prototype._getSelector = function (selector, context) {
223
+ if (context === void 0) { context = document; }
224
+ if (typeof selector !== 'string') {
225
+ return selector;
226
+ }
227
+ context = context || document;
228
+ var fl = selector.substring(0, 1);
229
+ if (fl === '#') {
230
+ return context.querySelector(selector);
231
+ }
232
+ else {
233
+ return context.querySelectorAll(selector);
234
+ }
235
+ };
236
+ lgQuery.prototype._each = function (func) {
237
+ if (!this.selector) {
238
+ return this;
239
+ }
240
+ if (this.selector.length !== undefined) {
241
+ [].forEach.call(this.selector, func);
242
+ }
243
+ else {
244
+ func(this.selector, 0);
245
+ }
246
+ return this;
247
+ };
248
+ lgQuery.prototype._setCssVendorPrefix = function (el, cssProperty, value) {
249
+ // prettier-ignore
250
+ var property = cssProperty.replace(/-([a-z])/gi, function (s, group1) {
251
+ return group1.toUpperCase();
252
+ });
253
+ if (this.cssVenderPrefixes.indexOf(property) !== -1) {
254
+ el.style[property.charAt(0).toLowerCase() + property.slice(1)] = value;
255
+ el.style['webkit' + property] = value;
256
+ el.style['moz' + property] = value;
257
+ el.style['ms' + property] = value;
258
+ el.style['o' + property] = value;
259
+ }
260
+ else {
261
+ el.style[property] = value;
262
+ }
263
+ };
264
+ lgQuery.prototype._getFirstEl = function () {
265
+ if (this.selector && this.selector.length !== undefined) {
266
+ return this.selector[0];
267
+ }
268
+ else {
269
+ return this.selector;
270
+ }
271
+ };
272
+ lgQuery.prototype.isEventMatched = function (event, eventName) {
273
+ var eventNamespace = eventName.split('.');
274
+ return event
275
+ .split('.')
276
+ .filter(function (e) { return e; })
277
+ .every(function (e) {
278
+ return eventNamespace.indexOf(e) !== -1;
279
+ });
280
+ };
281
+ lgQuery.prototype.attr = function (attr, value) {
282
+ if (value === undefined) {
283
+ if (!this.firstElement) {
284
+ return '';
285
+ }
286
+ return this.firstElement.getAttribute(attr);
287
+ }
288
+ this._each(function (el) {
289
+ el.setAttribute(attr, value);
290
+ });
291
+ return this;
292
+ };
293
+ lgQuery.prototype.find = function (selector) {
294
+ return $LG(this._getSelector(selector, this.selector));
295
+ };
296
+ lgQuery.prototype.first = function () {
297
+ if (this.selector && this.selector.length !== undefined) {
298
+ return $LG(this.selector[0]);
299
+ }
300
+ else {
301
+ return $LG(this.selector);
302
+ }
303
+ };
304
+ lgQuery.prototype.eq = function (index) {
305
+ return $LG(this.selector[index]);
306
+ };
307
+ lgQuery.prototype.parent = function () {
308
+ return $LG(this.selector.parentElement);
309
+ };
310
+ lgQuery.prototype.get = function () {
311
+ return this._getFirstEl();
312
+ };
313
+ lgQuery.prototype.removeAttr = function (attributes) {
314
+ var attrs = attributes.split(' ');
315
+ this._each(function (el) {
316
+ attrs.forEach(function (attr) { return el.removeAttribute(attr); });
317
+ });
318
+ return this;
319
+ };
320
+ lgQuery.prototype.wrap = function (className) {
321
+ if (!this.firstElement) {
322
+ return this;
323
+ }
324
+ var wrapper = document.createElement('div');
325
+ wrapper.className = className;
326
+ this.firstElement.parentNode.insertBefore(wrapper, this.firstElement);
327
+ this.firstElement.parentNode.removeChild(this.firstElement);
328
+ wrapper.appendChild(this.firstElement);
329
+ return this;
330
+ };
331
+ lgQuery.prototype.addClass = function (classNames) {
332
+ if (classNames === void 0) { classNames = ''; }
333
+ this._each(function (el) {
334
+ // IE doesn't support multiple arguments
335
+ classNames.split(' ').forEach(function (className) {
336
+ if (className) {
337
+ el.classList.add(className);
338
+ }
339
+ });
340
+ });
341
+ return this;
342
+ };
343
+ lgQuery.prototype.removeClass = function (classNames) {
344
+ this._each(function (el) {
345
+ // IE doesn't support multiple arguments
346
+ classNames.split(' ').forEach(function (className) {
347
+ if (className) {
348
+ el.classList.remove(className);
349
+ }
350
+ });
351
+ });
352
+ return this;
353
+ };
354
+ lgQuery.prototype.hasClass = function (className) {
355
+ if (!this.firstElement) {
356
+ return false;
357
+ }
358
+ return this.firstElement.classList.contains(className);
359
+ };
360
+ lgQuery.prototype.hasAttribute = function (attribute) {
361
+ if (!this.firstElement) {
362
+ return false;
363
+ }
364
+ return this.firstElement.hasAttribute(attribute);
365
+ };
366
+ lgQuery.prototype.toggleClass = function (className) {
367
+ if (!this.firstElement) {
368
+ return this;
369
+ }
370
+ if (this.hasClass(className)) {
371
+ this.removeClass(className);
372
+ }
373
+ else {
374
+ this.addClass(className);
375
+ }
376
+ return this;
377
+ };
378
+ lgQuery.prototype.css = function (property, value) {
379
+ var _this = this;
380
+ this._each(function (el) {
381
+ _this._setCssVendorPrefix(el, property, value);
382
+ });
383
+ return this;
384
+ };
385
+ // Need to pass separate namespaces for separate elements
386
+ lgQuery.prototype.on = function (events, listener) {
387
+ var _this = this;
388
+ if (!this.selector) {
389
+ return this;
390
+ }
391
+ events.split(' ').forEach(function (event) {
392
+ if (!Array.isArray(lgQuery.eventListeners[event])) {
393
+ lgQuery.eventListeners[event] = [];
394
+ }
395
+ lgQuery.eventListeners[event].push(listener);
396
+ _this.selector.addEventListener(event.split('.')[0], listener);
397
+ });
398
+ return this;
399
+ };
400
+ // @todo - test this
401
+ lgQuery.prototype.once = function (event, listener) {
402
+ var _this = this;
403
+ this.on(event, function () {
404
+ _this.off(event);
405
+ listener(event);
406
+ });
407
+ return this;
408
+ };
409
+ lgQuery.prototype.off = function (event) {
410
+ var _this = this;
411
+ if (!this.selector) {
412
+ return this;
413
+ }
414
+ Object.keys(lgQuery.eventListeners).forEach(function (eventName) {
415
+ if (_this.isEventMatched(event, eventName)) {
416
+ lgQuery.eventListeners[eventName].forEach(function (listener) {
417
+ _this.selector.removeEventListener(eventName.split('.')[0], listener);
418
+ });
419
+ lgQuery.eventListeners[eventName] = [];
420
+ }
421
+ });
422
+ return this;
423
+ };
424
+ lgQuery.prototype.trigger = function (event, detail) {
425
+ if (!this.firstElement) {
426
+ return this;
427
+ }
428
+ var customEvent = new CustomEvent(event.split('.')[0], {
429
+ detail: detail || null,
430
+ });
431
+ this.firstElement.dispatchEvent(customEvent);
432
+ return this;
433
+ };
434
+ // Does not support IE
435
+ lgQuery.prototype.load = function (url) {
436
+ var _this = this;
437
+ fetch(url)
438
+ .then(function (res) { return res.text(); })
439
+ .then(function (html) {
440
+ _this.selector.innerHTML = html;
441
+ });
442
+ return this;
443
+ };
444
+ lgQuery.prototype.html = function (html) {
445
+ if (html === undefined) {
446
+ if (!this.firstElement) {
447
+ return '';
448
+ }
449
+ return this.firstElement.innerHTML;
450
+ }
451
+ this._each(function (el) {
452
+ el.innerHTML = html;
453
+ });
454
+ return this;
455
+ };
456
+ lgQuery.prototype.append = function (html) {
457
+ this._each(function (el) {
458
+ if (typeof html === 'string') {
459
+ el.insertAdjacentHTML('beforeend', html);
460
+ }
461
+ else {
462
+ el.appendChild(html);
463
+ }
464
+ });
465
+ return this;
466
+ };
467
+ lgQuery.prototype.prepend = function (html) {
468
+ this._each(function (el) {
469
+ el.insertAdjacentHTML('afterbegin', html);
470
+ });
471
+ return this;
472
+ };
473
+ lgQuery.prototype.remove = function () {
474
+ this._each(function (el) {
475
+ el.parentNode.removeChild(el);
476
+ });
477
+ return this;
478
+ };
479
+ lgQuery.prototype.empty = function () {
480
+ this._each(function (el) {
481
+ el.innerHTML = '';
482
+ });
483
+ return this;
484
+ };
485
+ lgQuery.prototype.scrollTop = function (scrollTop) {
486
+ if (scrollTop !== undefined) {
487
+ document.body.scrollTop = scrollTop;
488
+ document.documentElement.scrollTop = scrollTop;
489
+ return this;
490
+ }
491
+ else {
492
+ return (window.pageYOffset ||
493
+ document.documentElement.scrollTop ||
494
+ document.body.scrollTop ||
495
+ 0);
496
+ }
497
+ };
498
+ lgQuery.prototype.scrollLeft = function (scrollLeft) {
499
+ if (scrollLeft !== undefined) {
500
+ document.body.scrollLeft = scrollLeft;
501
+ document.documentElement.scrollLeft = scrollLeft;
502
+ return this;
503
+ }
504
+ else {
505
+ return (window.pageXOffset ||
506
+ document.documentElement.scrollLeft ||
507
+ document.body.scrollLeft ||
508
+ 0);
509
+ }
510
+ };
511
+ lgQuery.prototype.offset = function () {
512
+ if (!this.firstElement) {
513
+ return {
514
+ left: 0,
515
+ top: 0,
516
+ };
517
+ }
518
+ var rect = this.firstElement.getBoundingClientRect();
519
+ var bodyMarginLeft = $LG('body').style().marginLeft;
520
+ // Minus body margin - https://stackoverflow.com/questions/30711548/is-getboundingclientrect-left-returning-a-wrong-value
521
+ return {
522
+ left: rect.left - parseFloat(bodyMarginLeft) + this.scrollLeft(),
523
+ top: rect.top + this.scrollTop(),
524
+ };
525
+ };
526
+ lgQuery.prototype.style = function () {
527
+ if (!this.firstElement) {
528
+ return {};
529
+ }
530
+ return (this.firstElement.currentStyle ||
531
+ window.getComputedStyle(this.firstElement));
532
+ };
533
+ // Width without padding and border even if box-sizing is used.
534
+ lgQuery.prototype.width = function () {
535
+ var style = this.style();
536
+ return (this.firstElement.clientWidth -
537
+ parseFloat(style.paddingLeft) -
538
+ parseFloat(style.paddingRight));
539
+ };
540
+ // Height without padding and border even if box-sizing is used.
541
+ lgQuery.prototype.height = function () {
542
+ var style = this.style();
543
+ return (this.firstElement.clientHeight -
544
+ parseFloat(style.paddingTop) -
545
+ parseFloat(style.paddingBottom));
546
+ };
547
+ lgQuery.eventListeners = {};
548
+ return lgQuery;
549
+ }());
550
+ function $LG(selector) {
551
+ initLgPolyfills();
552
+ return new lgQuery(selector);
553
+ }
554
+
555
+ var defaultDynamicOptions = [
556
+ 'src',
557
+ 'sources',
558
+ 'subHtml',
559
+ 'subHtmlUrl',
560
+ 'html',
561
+ 'video',
562
+ 'poster',
563
+ 'slideName',
564
+ 'responsive',
565
+ 'srcset',
566
+ 'sizes',
567
+ 'iframe',
568
+ 'downloadUrl',
569
+ 'download',
570
+ 'width',
571
+ 'facebookShareUrl',
572
+ 'tweetText',
573
+ 'iframeTitle',
574
+ 'twitterShareUrl',
575
+ 'pinterestShareUrl',
576
+ 'pinterestText',
577
+ 'fbHtml',
578
+ 'disqusIdentifier',
579
+ 'disqusUrl',
580
+ ];
581
+ // Convert html data-attribute to camalcase
582
+ function convertToData(attr) {
583
+ // FInd a way for lgsize
584
+ if (attr === 'href') {
585
+ return 'src';
586
+ }
587
+ attr = attr.replace('data-', '');
588
+ attr = attr.charAt(0).toLowerCase() + attr.slice(1);
589
+ attr = attr.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
590
+ return attr;
591
+ }
592
+ var utils = {
593
+ /**
594
+ * get possible width and height from the lgSize attribute. Used for ZoomFromOrigin option
595
+ */
596
+ getSize: function (el, container, spacing, defaultLgSize) {
597
+ if (spacing === void 0) { spacing = 0; }
598
+ var LGel = $LG(el);
599
+ var lgSize = LGel.attr('data-lg-size') || defaultLgSize;
600
+ if (!lgSize) {
601
+ return;
602
+ }
603
+ var isResponsiveSizes = lgSize.split(',');
604
+ // if at-least two viewport sizes are available
605
+ if (isResponsiveSizes[1]) {
606
+ var wWidth = window.innerWidth;
607
+ for (var i = 0; i < isResponsiveSizes.length; i++) {
608
+ var size_1 = isResponsiveSizes[i];
609
+ var responsiveWidth = parseInt(size_1.split('-')[2], 10);
610
+ if (responsiveWidth > wWidth) {
611
+ lgSize = size_1;
612
+ break;
613
+ }
614
+ // take last item as last option
615
+ if (i === isResponsiveSizes.length - 1) {
616
+ lgSize = size_1;
617
+ }
618
+ }
619
+ }
620
+ var size = lgSize.split('-');
621
+ var width = parseInt(size[0], 10);
622
+ var height = parseInt(size[1], 10);
623
+ var cWidth = container.width();
624
+ var cHeight = container.height() - spacing;
625
+ var maxWidth = Math.min(cWidth, width);
626
+ var maxHeight = Math.min(cHeight, height);
627
+ var ratio = Math.min(maxWidth / width, maxHeight / height);
628
+ return { width: width * ratio, height: height * ratio };
629
+ },
630
+ /**
631
+ * @desc Get transform value based on the imageSize. Used for ZoomFromOrigin option
632
+ * @param {jQuery Element}
633
+ * @returns {String} Transform CSS string
634
+ */
635
+ getTransform: function (el, container, top, bottom, imageSize) {
636
+ if (!imageSize) {
637
+ return;
638
+ }
639
+ var LGel = $LG(el).find('img').first();
640
+ if (!LGel.get()) {
641
+ return;
642
+ }
643
+ var containerRect = container.get().getBoundingClientRect();
644
+ var wWidth = containerRect.width;
645
+ // using innerWidth to include mobile safari bottom bar
646
+ var wHeight = container.height() - (top + bottom);
647
+ var elWidth = LGel.width();
648
+ var elHeight = LGel.height();
649
+ var elStyle = LGel.style();
650
+ var x = (wWidth - elWidth) / 2 -
651
+ LGel.offset().left +
652
+ (parseFloat(elStyle.paddingLeft) || 0) +
653
+ (parseFloat(elStyle.borderLeft) || 0) +
654
+ $LG(window).scrollLeft() +
655
+ containerRect.left;
656
+ var y = (wHeight - elHeight) / 2 -
657
+ LGel.offset().top +
658
+ (parseFloat(elStyle.paddingTop) || 0) +
659
+ (parseFloat(elStyle.borderTop) || 0) +
660
+ $LG(window).scrollTop() +
661
+ top;
662
+ var scX = elWidth / imageSize.width;
663
+ var scY = elHeight / imageSize.height;
664
+ var transform = 'translate3d(' +
665
+ (x *= -1) +
666
+ 'px, ' +
667
+ (y *= -1) +
668
+ 'px, 0) scale3d(' +
669
+ scX +
670
+ ', ' +
671
+ scY +
672
+ ', 1)';
673
+ return transform;
674
+ },
675
+ getIframeMarkup: function (iframeWidth, iframeHeight, iframeMaxWidth, iframeMaxHeight, src, iframeTitle) {
676
+ var title = iframeTitle ? 'title="' + iframeTitle + '"' : '';
677
+ 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>";
678
+ },
679
+ getImgMarkup: function (index, src, altAttr, srcset, sizes, sources) {
680
+ var srcsetAttr = srcset ? "srcset=\"" + srcset + "\"" : '';
681
+ var sizesAttr = sizes ? "sizes=\"" + sizes + "\"" : '';
682
+ var imgMarkup = "<img " + altAttr + " " + srcsetAttr + " " + sizesAttr + " class=\"lg-object lg-image\" data-index=\"" + index + "\" src=\"" + src + "\" />";
683
+ var sourceTag = '';
684
+ if (sources) {
685
+ var sourceObj = typeof sources === 'string' ? JSON.parse(sources) : sources;
686
+ sourceTag = sourceObj.map(function (source) {
687
+ var attrs = '';
688
+ Object.keys(source).forEach(function (key) {
689
+ // Do not remove the first space as it is required to separate the attributes
690
+ attrs += " " + key + "=\"" + source[key] + "\"";
691
+ });
692
+ return "<source " + attrs + "></source>";
693
+ });
694
+ }
695
+ return "" + sourceTag + imgMarkup;
696
+ },
697
+ // Get src from responsive src
698
+ getResponsiveSrc: function (srcItms) {
699
+ var rsWidth = [];
700
+ var rsSrc = [];
701
+ var src = '';
702
+ for (var i = 0; i < srcItms.length; i++) {
703
+ var _src = srcItms[i].split(' ');
704
+ // Manage empty space
705
+ if (_src[0] === '') {
706
+ _src.splice(0, 1);
707
+ }
708
+ rsSrc.push(_src[0]);
709
+ rsWidth.push(_src[1]);
710
+ }
711
+ var wWidth = window.innerWidth;
712
+ for (var j = 0; j < rsWidth.length; j++) {
713
+ if (parseInt(rsWidth[j], 10) > wWidth) {
714
+ src = rsSrc[j];
715
+ break;
716
+ }
717
+ }
718
+ return src;
719
+ },
720
+ isImageLoaded: function (img) {
721
+ if (!img)
722
+ return false;
723
+ // During the onload event, IE correctly identifies any images that
724
+ // weren’t downloaded as not complete. Others should too. Gecko-based
725
+ // browsers act like NS4 in that they report this incorrectly.
726
+ if (!img.complete) {
727
+ return false;
728
+ }
729
+ // However, they do have two very useful properties: naturalWidth and
730
+ // naturalHeight. These give the true size of the image. If it failed
731
+ // to load, either of these should be zero.
732
+ if (img.naturalWidth === 0) {
733
+ return false;
734
+ }
735
+ // No other way of checking: assume it’s ok.
736
+ return true;
737
+ },
738
+ getVideoPosterMarkup: function (_poster, dummyImg, videoContStyle, playVideoString, _isVideo) {
739
+ var videoClass = '';
740
+ if (_isVideo && _isVideo.youtube) {
741
+ videoClass = 'lg-has-youtube';
742
+ }
743
+ else if (_isVideo && _isVideo.vimeo) {
744
+ videoClass = 'lg-has-vimeo';
745
+ }
746
+ else if (_isVideo && _isVideo.tiktoc) {
747
+ videoClass = 'lg-has-tiktoc';
748
+ }
749
+ else {
750
+ videoClass = 'lg-has-html5';
751
+ }
752
+ return "<div class=\"lg-video-cont " + videoClass + "\" style=\"" + videoContStyle + "\">\n <div class=\"lg-video-play-button\">\n <svg\n viewBox=\"0 0 20 20\"\n preserveAspectRatio=\"xMidYMid\"\n focusable=\"false\"\n aria-labelledby=\"" + playVideoString + "\"\n role=\"img\"\n class=\"lg-video-play-icon\"\n >\n <title>" + playVideoString + "</title>\n <polygon class=\"lg-video-play-icon-inner\" points=\"1,0 20,10 1,20\"></polygon>\n </svg>\n <svg class=\"lg-video-play-icon-bg\" viewBox=\"0 0 50 50\" focusable=\"false\">\n <circle cx=\"50%\" cy=\"50%\" r=\"20\"></circle></svg>\n <svg class=\"lg-video-play-icon-circle\" viewBox=\"0 0 50 50\" focusable=\"false\">\n <circle cx=\"50%\" cy=\"50%\" r=\"20\"></circle>\n </svg>\n </div>\n " + (dummyImg || '') + "\n <img class=\"lg-object lg-video-poster\" src=\"" + _poster + "\" />\n </div>";
753
+ },
754
+ getFocusableElements: function (container) {
755
+ var elements = container.querySelectorAll('a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
756
+ var visibleElements = [].filter.call(elements, function (element) {
757
+ var style = window.getComputedStyle(element);
758
+ return style.display !== 'none' && style.visibility !== 'hidden';
759
+ });
760
+ return visibleElements;
761
+ },
762
+ /**
763
+ * @desc Create dynamic elements array from gallery items when dynamic option is false
764
+ * It helps to avoid frequent DOM interaction
765
+ * and avoid multiple checks for dynamic elments
766
+ *
767
+ * @returns {Array} dynamicEl
768
+ */
769
+ getDynamicOptions: function (items, extraProps, getCaptionFromTitleOrAlt, exThumbImage) {
770
+ var dynamicElements = [];
771
+ var availableDynamicOptions = __spreadArrays(defaultDynamicOptions, extraProps);
772
+ [].forEach.call(items, function (item) {
773
+ var dynamicEl = {};
774
+ for (var i = 0; i < item.attributes.length; i++) {
775
+ var attr = item.attributes[i];
776
+ if (attr.specified) {
777
+ var dynamicAttr = convertToData(attr.name);
778
+ var label = '';
779
+ if (availableDynamicOptions.indexOf(dynamicAttr) > -1) {
780
+ label = dynamicAttr;
781
+ }
782
+ if (label) {
783
+ dynamicEl[label] = attr.value;
784
+ }
785
+ }
786
+ }
787
+ var currentItem = $LG(item);
788
+ var alt = currentItem.find('img').first().attr('alt');
789
+ var title = currentItem.attr('title');
790
+ var thumb = exThumbImage
791
+ ? currentItem.attr(exThumbImage)
792
+ : currentItem.find('img').first().attr('src');
793
+ dynamicEl.thumb = thumb;
794
+ if (getCaptionFromTitleOrAlt && !dynamicEl.subHtml) {
795
+ dynamicEl.subHtml = title || alt || '';
796
+ }
797
+ dynamicEl.alt = alt || title || '';
798
+ dynamicElements.push(dynamicEl);
799
+ });
800
+ return dynamicElements;
801
+ },
802
+ isMobile: function () {
803
+ return /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
804
+ },
805
+ /**
806
+ * @desc Check the given src is video
807
+ * @param {String} src
808
+ * @return {Object} video type
809
+ * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] }
810
+ *
811
+ * @todo - this information can be moved to dynamicEl to avoid frequent calls
812
+ */
813
+ isVideo: function (src, isHTML5VIdeo, index) {
814
+ // jadams, 2024-08-01: workaound when src equals '#'
815
+ // jadams, 2024-08-01: TODO, check why src is set to '#'
816
+ if (!src || src === '#') {
817
+ if (isHTML5VIdeo) {
818
+ return {
819
+ html5: true,
820
+ };
821
+ }
822
+ else {
823
+ console.error('lightGallery :- data-src is not provided on slide item ' +
824
+ (index + 1) +
825
+ '. Please make sure the selector property is properly configured. More info - https://www.lightgalleryjs.com/demos/html-markup/');
826
+ return;
827
+ }
828
+ }
829
+
830
+ var youtube = src.match(/\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)([\&|?][\S]*)*/i);
831
+ var vimeo = src.match(/\/\/(?:www\.)?(?:player\.)?vimeo.com\/(?:video\/)?([0-9a-z\-_]+)(.*)?/i);
832
+
833
+ // jadams, added dailymotion|wistia|tiktoc
834
+ var dailymotion = src.match(/\/\/(?:www\.)?dai(?:\.ly)\/(?:video\/)?([0-9a-z\-_]+)(.*)?/);
835
+ var tiktoc = src.match(/\/\/(?:www\.)?tiktok.com\/embed\/?([0-9a-z\-_]+)(.*)?/);
836
+ var wistia = src.match(/\/\/(?:fast\.)?(wistia\.com|wi\.st)\/(medias|embed)\/([0-9a-z\-_]+)(.*)/);
837
+
838
+ if (youtube) {
839
+ return {
840
+ youtube: youtube,
841
+ };
842
+ }
843
+ else if (vimeo) {
844
+ return {
845
+ vimeo: vimeo,
846
+ };
847
+ }
848
+ else if (dailymotion) {
849
+ return {
850
+ dailymotion: dailymotion,
851
+ };
852
+ }
853
+ else if (wistia) {
854
+ return {
855
+ wistia: wistia,
856
+ };
857
+ }
858
+ else if (tiktoc) {
859
+ return {
860
+ tiktoc: tiktoc,
861
+ };
862
+ }
863
+ },
864
+ };
865
+
866
+ // @ref - https://stackoverflow.com/questions/3971841/how-to-resize-images-proportionally-keeping-the-aspect-ratio
867
+ // @ref - https://2ality.com/2017/04/setting-up-multi-platform-packages.html
868
+ // Unique id for each gallery
869
+ var lgId = 0;
870
+ var LightGallery = /** @class */ (function () {
871
+ function LightGallery(element, options) {
872
+ this.lgOpened = false;
873
+ this.index = 0;
874
+ // lightGallery modules
875
+ this.plugins = [];
876
+ // false when lightGallery load first slide content;
877
+ this.lGalleryOn = false;
878
+ // True when a slide animation is in progress
879
+ this.lgBusy = false;
880
+ this.currentItemsInDom = [];
881
+ // Scroll top value before lightGallery is opened
882
+ this.prevScrollTop = 0;
883
+ this.bodyPaddingRight = 0;
884
+ this.isDummyImageRemoved = false;
885
+ this.dragOrSwipeEnabled = false;
886
+ this.mediaContainerPosition = {
887
+ top: 0,
888
+ bottom: 0,
889
+ };
890
+ if (!element) {
891
+ return this;
892
+ }
893
+ lgId++;
894
+ this.lgId = lgId;
895
+ this.el = element;
896
+ this.LGel = $LG(element);
897
+ this.generateSettings(options);
898
+ this.buildModules();
899
+ // When using dynamic mode, ensure dynamicEl is an array
900
+ if (this.settings.dynamic &&
901
+ this.settings.dynamicEl !== undefined &&
902
+ !Array.isArray(this.settings.dynamicEl)) {
903
+ throw 'When using dynamic mode, you must also define dynamicEl as an Array.';
904
+ }
905
+ this.galleryItems = this.getItems();
906
+ this.normalizeSettings();
907
+ // Gallery items
908
+ this.init();
909
+ this.validateLicense();
910
+ return this;
911
+ }
912
+ LightGallery.prototype.generateSettings = function (options) {
913
+ // lightGallery settings
914
+ this.settings = __assign(__assign({}, lightGalleryCoreSettings), options);
915
+ if (this.settings.isMobile &&
916
+ typeof this.settings.isMobile === 'function'
917
+ ? this.settings.isMobile()
918
+ : utils.isMobile()) {
919
+ var mobileSettings = __assign(__assign({}, this.settings.mobileSettings), this.settings.mobileSettings);
920
+ this.settings = __assign(__assign({}, this.settings), mobileSettings);
921
+ }
922
+ };
923
+ LightGallery.prototype.normalizeSettings = function () {
924
+ if (this.settings.slideEndAnimation) {
925
+ this.settings.hideControlOnEnd = false;
926
+ }
927
+ if (!this.settings.closable) {
928
+ this.settings.swipeToClose = false;
929
+ }
930
+ // And reset it on close to get the correct value next time
931
+ this.zoomFromOrigin = this.settings.zoomFromOrigin;
932
+ // At the moment, Zoom from image doesn't support dynamic options
933
+ // @todo add zoomFromOrigin support for dynamic images
934
+ if (this.settings.dynamic) {
935
+ this.zoomFromOrigin = false;
936
+ }
937
+ if (!this.settings.container) {
938
+ this.settings.container = document.body;
939
+ }
940
+ // settings.preload should not be grater than $item.length
941
+ this.settings.preload = Math.min(this.settings.preload, this.galleryItems.length);
942
+ };
943
+ LightGallery.prototype.init = function () {
944
+ var _this = this;
945
+ this.addSlideVideoInfo(this.galleryItems);
946
+ this.buildStructure();
947
+ this.LGel.trigger(lGEvents.init, {
948
+ instance: this,
949
+ });
950
+ if (this.settings.keyPress) {
951
+ this.keyPress();
952
+ }
953
+ setTimeout(function () {
954
+ _this.enableDrag();
955
+ _this.enableSwipe();
956
+ _this.triggerPosterClick();
957
+ }, 50);
958
+ this.arrow();
959
+ if (this.settings.mousewheel) {
960
+ this.mousewheel();
961
+ }
962
+ if (!this.settings.dynamic) {
963
+ this.openGalleryOnItemClick();
964
+ }
965
+ };
966
+ LightGallery.prototype.openGalleryOnItemClick = function () {
967
+ var _this = this;
968
+ var _loop_1 = function (index) {
969
+ var element = this_1.items[index];
970
+ var $element = $LG(element);
971
+ // Using different namespace for click because click event should not unbind if selector is same object('this')
972
+ // @todo manage all event listners - should have namespace that represent element
973
+ var uuid = lgQuery.generateUUID();
974
+ $element
975
+ .attr('data-lg-id', uuid)
976
+ .on("click.lgcustom-item-" + uuid, function (e) {
977
+ e.preventDefault();
978
+ var currentItemIndex = _this.settings.index || index;
979
+ _this.openGallery(currentItemIndex, element);
980
+ });
981
+ };
982
+ var this_1 = this;
983
+ // Using for loop instead of using bubbling as the items can be any html element.
984
+ for (var index = 0; index < this.items.length; index++) {
985
+ _loop_1(index);
986
+ }
987
+ };
988
+ /**
989
+ * Module constructor
990
+ * Modules are build incrementally.
991
+ * Gallery should be opened only once all the modules are initialized.
992
+ * use moduleBuildTimeout to make sure this
993
+ */
994
+ LightGallery.prototype.buildModules = function () {
995
+ var _this = this;
996
+ this.settings.plugins.forEach(function (plugin) {
997
+ _this.plugins.push(new plugin(_this, $LG));
998
+ });
999
+ };
1000
+ LightGallery.prototype.validateLicense = function () {
1001
+ if (!this.settings.licenseKey) {
1002
+ console.error('Please provide a valid license key');
1003
+ }
1004
+ else if (this.settings.licenseKey === '0000-0000-000-0000') {
1005
+ // jadams: disabled license warning
1006
+ // console.warn("lightGallery: " + " license key not valid for business use: " + this.settings.licenseKey);
1007
+ }
1008
+ };
1009
+ LightGallery.prototype.getSlideItem = function (index) {
1010
+ return $LG(this.getSlideItemId(index));
1011
+ };
1012
+ LightGallery.prototype.getSlideItemId = function (index) {
1013
+ return "#lg-item-" + this.lgId + "-" + index;
1014
+ };
1015
+ LightGallery.prototype.getIdName = function (id) {
1016
+ return id + "-" + this.lgId;
1017
+ };
1018
+ LightGallery.prototype.getElementById = function (id) {
1019
+ return $LG("#" + this.getIdName(id));
1020
+ };
1021
+ LightGallery.prototype.manageSingleSlideClassName = function () {
1022
+ if (this.galleryItems.length < 2) {
1023
+ this.outer.addClass('lg-single-item');
1024
+ }
1025
+ else {
1026
+ this.outer.removeClass('lg-single-item');
1027
+ }
1028
+ };
1029
+ LightGallery.prototype.buildStructure = function () {
1030
+ var _this = this;
1031
+ var container = this.$container && this.$container.get();
1032
+ if (container) {
1033
+ return;
1034
+ }
1035
+ var controls = '';
1036
+ var subHtmlCont = '';
1037
+ // Create controls
1038
+ if (this.settings.controls) {
1039
+ controls = "<button type=\"button\" id=\"" + this.getIdName('lg-prev') + "\" aria-label=\"" + this.settings.strings['previousSlide'] + "\" class=\"lg-prev lg-icon\"> " + this.settings.prevHtml + " </button>\n <button type=\"button\" id=\"" + this.getIdName('lg-next') + "\" aria-label=\"" + this.settings.strings['nextSlide'] + "\" class=\"lg-next lg-icon\"> " + this.settings.nextHtml + " </button>";
1040
+ }
1041
+ if (this.settings.appendSubHtmlTo !== '.lg-item') {
1042
+ subHtmlCont =
1043
+ '<div class="lg-sub-html" role="status" aria-live="polite"></div>';
1044
+ }
1045
+ var addClasses = '';
1046
+ if (this.settings.allowMediaOverlap) {
1047
+ // Do not remove space before last single quote
1048
+ addClasses += 'lg-media-overlap ';
1049
+ }
1050
+ var ariaLabelledby = this.settings.ariaLabelledby
1051
+ ? 'aria-labelledby="' + this.settings.ariaLabelledby + '"'
1052
+ : '';
1053
+ var ariaDescribedby = this.settings.ariaDescribedby
1054
+ ? 'aria-describedby="' + this.settings.ariaDescribedby + '"'
1055
+ : '';
1056
+ var containerClassName = "lg-container " + this.settings.addClass + " " + (document.body !== this.settings.container ? 'lg-inline' : '');
1057
+ var closeIcon = this.settings.closable && this.settings.showCloseIcon
1058
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['closeGallery'] + "\" id=\"" + this.getIdName('lg-close') + "\" class=\"lg-close lg-icon\"></button>"
1059
+ : '';
1060
+ var maximizeIcon = this.settings.showMaximizeIcon
1061
+ ? "<button type=\"button\" aria-label=\"" + this.settings.strings['toggleMaximize'] + "\" id=\"" + this.getIdName('lg-maximize') + "\" class=\"lg-maximize lg-icon\"></button>"
1062
+ : '';
1063
+ var template = "\n <div class=\"" + containerClassName + "\" id=\"" + this.getIdName('lg-container') + "\" tabindex=\"-1\" aria-modal=\"true\" " + ariaLabelledby + " " + ariaDescribedby + " role=\"dialog\"\n >\n <div id=\"" + this.getIdName('lg-backdrop') + "\" class=\"lg-backdrop\"></div>\n\n <div id=\"" + this.getIdName('lg-outer') + "\" class=\"lg-outer lg-use-css3 lg-css3 lg-hide-items " + addClasses + " \">\n\n <div id=\"" + this.getIdName('lg-content') + "\" class=\"lg-content\">\n <div id=\"" + this.getIdName('lg-inner') + "\" class=\"lg-inner\">\n </div>\n " + controls + "\n </div>\n <div id=\"" + this.getIdName('lg-toolbar') + "\" class=\"lg-toolbar lg-group\">\n " + maximizeIcon + "\n " + closeIcon + "\n </div>\n " + (this.settings.appendSubHtmlTo === '.lg-outer'
1064
+ ? subHtmlCont
1065
+ : '') + "\n <div id=\"" + this.getIdName('lg-components') + "\" class=\"lg-components\">\n " + (this.settings.appendSubHtmlTo === '.lg-sub-html'
1066
+ ? subHtmlCont
1067
+ : '') + "\n </div>\n </div>\n </div>\n ";
1068
+ $LG(this.settings.container).append(template);
1069
+ if (document.body !== this.settings.container) {
1070
+ $LG(this.settings.container).css('position', 'relative');
1071
+ }
1072
+ this.outer = this.getElementById('lg-outer');
1073
+ this.$lgComponents = this.getElementById('lg-components');
1074
+ this.$backdrop = this.getElementById('lg-backdrop');
1075
+ this.$container = this.getElementById('lg-container');
1076
+ this.$inner = this.getElementById('lg-inner');
1077
+ this.$content = this.getElementById('lg-content');
1078
+ this.$toolbar = this.getElementById('lg-toolbar');
1079
+ this.$backdrop.css('transition-duration', this.settings.backdropDuration + 'ms');
1080
+ var outerClassNames = this.settings.mode + " ";
1081
+ this.manageSingleSlideClassName();
1082
+ if (this.settings.enableDrag) {
1083
+ outerClassNames += 'lg-grab ';
1084
+ }
1085
+ this.outer.addClass(outerClassNames);
1086
+ this.$inner.css('transition-timing-function', this.settings.easing);
1087
+ this.$inner.css('transition-duration', this.settings.speed + 'ms');
1088
+ if (this.settings.download) {
1089
+ this.$toolbar.append("<a id=\"" + this.getIdName('lg-download') + "\" target=\"_blank\" rel=\"noopener\" aria-label=\"" + this.settings.strings['download'] + "\" download class=\"lg-download lg-icon\"></a>");
1090
+ }
1091
+ this.counter();
1092
+ $LG(window).on("resize.lg.global" + this.lgId + " orientationchange.lg.global" + this.lgId, function () {
1093
+ _this.refreshOnResize();
1094
+ });
1095
+ this.hideBars();
1096
+ this.manageCloseGallery();
1097
+ this.toggleMaximize();
1098
+ this.initModules();
1099
+ };
1100
+ LightGallery.prototype.refreshOnResize = function () {
1101
+ if (this.lgOpened) {
1102
+ var currentGalleryItem = this.galleryItems[this.index];
1103
+ var __slideVideoInfo = currentGalleryItem.__slideVideoInfo;
1104
+ this.mediaContainerPosition = this.getMediaContainerPosition();
1105
+ var _a = this.mediaContainerPosition, top_1 = _a.top, bottom = _a.bottom;
1106
+ this.currentImageSize = utils.getSize(this.items[this.index], this.outer, top_1 + bottom, __slideVideoInfo && this.settings.videoMaxSize);
1107
+ if (__slideVideoInfo) {
1108
+ this.resizeVideoSlide(this.index, this.currentImageSize);
1109
+ }
1110
+ if (this.zoomFromOrigin && !this.isDummyImageRemoved) {
1111
+ var imgStyle = this.getDummyImgStyles(this.currentImageSize);
1112
+ this.outer
1113
+ .find('.lg-current .lg-dummy-img')
1114
+ .first()
1115
+ .attr('style', imgStyle);
1116
+ }
1117
+ this.LGel.trigger(lGEvents.containerResize);
1118
+ }
1119
+ };
1120
+ LightGallery.prototype.resizeVideoSlide = function (index, imageSize) {
1121
+ var lgVideoStyle = this.getVideoContStyle(imageSize);
1122
+ var currentSlide = this.getSlideItem(index);
1123
+ currentSlide.find('.lg-video-cont').attr('style', lgVideoStyle);
1124
+ };
1125
+ /**
1126
+ * Update slides dynamically.
1127
+ * Add, edit or delete slides dynamically when lightGallery is opened.
1128
+ * Modify the current gallery items and pass it via updateSlides method
1129
+ * @note
1130
+ * - Do not mutate existing lightGallery items directly.
1131
+ * - Always pass new list of gallery items
1132
+ * - You need to take care of thumbnails outside the gallery if any
1133
+ * - user this method only if you want to update slides when the gallery is opened. Otherwise, use `refresh()` method.
1134
+ * @param items Gallery items
1135
+ * @param index After the update operation, which slide gallery should navigate to
1136
+ * @category lGPublicMethods
1137
+ * @example
1138
+ * const plugin = lightGallery();
1139
+ *
1140
+ * // Adding slides dynamically
1141
+ * let galleryItems = [
1142
+ * // Access existing lightGallery items
1143
+ * // galleryItems are automatically generated internally from the gallery HTML markup
1144
+ * // or directly from galleryItems when dynamic gallery is used
1145
+ * ...plugin.galleryItems,
1146
+ * ...[
1147
+ * {
1148
+ * src: 'img/img-1.png',
1149
+ * thumb: 'img/thumb1.png',
1150
+ * },
1151
+ * ],
1152
+ * ];
1153
+ * plugin.updateSlides(
1154
+ * galleryItems,
1155
+ * plugin.index,
1156
+ * );
1157
+ *
1158
+ *
1159
+ * // Remove slides dynamically
1160
+ * galleryItems = JSON.parse(
1161
+ * JSON.stringify(updateSlideInstance.galleryItems),
1162
+ * );
1163
+ * galleryItems.shift();
1164
+ * updateSlideInstance.updateSlides(galleryItems, 1);
1165
+ * @see <a href="/demos/update-slides/">Demo</a>
1166
+ */
1167
+ LightGallery.prototype.updateSlides = function (items, index) {
1168
+ if (this.index > items.length - 1) {
1169
+ this.index = items.length - 1;
1170
+ }
1171
+ if (items.length === 1) {
1172
+ this.index = 0;
1173
+ }
1174
+ if (!items.length) {
1175
+ this.closeGallery();
1176
+ return;
1177
+ }
1178
+ var currentSrc = this.galleryItems[index].src;
1179
+ this.galleryItems = items;
1180
+ this.updateControls();
1181
+ this.$inner.empty();
1182
+ this.currentItemsInDom = [];
1183
+ var _index = 0;
1184
+ // Find the current index based on source value of the slide
1185
+ this.galleryItems.some(function (galleryItem, itemIndex) {
1186
+ if (galleryItem.src === currentSrc) {
1187
+ _index = itemIndex;
1188
+ return true;
1189
+ }
1190
+ return false;
1191
+ });
1192
+ this.currentItemsInDom = this.organizeSlideItems(_index, -1);
1193
+ this.loadContent(_index, true);
1194
+ this.getSlideItem(_index).addClass('lg-current');
1195
+ this.index = _index;
1196
+ this.updateCurrentCounter(_index);
1197
+ this.LGel.trigger(lGEvents.updateSlides);
1198
+ };
1199
+ // Get gallery items based on multiple conditions
1200
+ LightGallery.prototype.getItems = function () {
1201
+ // Gallery items
1202
+ this.items = [];
1203
+ if (!this.settings.dynamic) {
1204
+ if (this.settings.selector === 'this') {
1205
+ this.items.push(this.el);
1206
+ }
1207
+ else if (this.settings.selector) {
1208
+ if (typeof this.settings.selector === 'string') {
1209
+ if (this.settings.selectWithin) {
1210
+ var selectWithin = $LG(this.settings.selectWithin);
1211
+ this.items = selectWithin
1212
+ .find(this.settings.selector)
1213
+ .get();
1214
+ }
1215
+ else {
1216
+ this.items = this.el.querySelectorAll(this.settings.selector);
1217
+ }
1218
+ }
1219
+ else {
1220
+ this.items = this.settings.selector;
1221
+ }
1222
+ }
1223
+ else {
1224
+ this.items = this.el.children;
1225
+ }
1226
+ return utils.getDynamicOptions(this.items, this.settings.extraProps, this.settings.getCaptionFromTitleOrAlt, this.settings.exThumbImage);
1227
+ }
1228
+ else {
1229
+ return this.settings.dynamicEl || [];
1230
+ }
1231
+ };
1232
+ LightGallery.prototype.shouldHideScrollbar = function () {
1233
+ return (this.settings.hideScrollbar &&
1234
+ document.body === this.settings.container);
1235
+ };
1236
+ LightGallery.prototype.hideScrollbar = function () {
1237
+ if (!this.shouldHideScrollbar()) {
1238
+ return;
1239
+ }
1240
+ this.bodyPaddingRight = parseFloat($LG('body').style().paddingRight);
1241
+ var bodyRect = document.documentElement.getBoundingClientRect();
1242
+ var scrollbarWidth = window.innerWidth - bodyRect.width;
1243
+ $LG(document.body).css('padding-right', scrollbarWidth + this.bodyPaddingRight + 'px');
1244
+ $LG(document.body).addClass('lg-overlay-open');
1245
+ };
1246
+ LightGallery.prototype.resetScrollBar = function () {
1247
+ if (!this.shouldHideScrollbar()) {
1248
+ return;
1249
+ }
1250
+ $LG(document.body).css('padding-right', this.bodyPaddingRight + 'px');
1251
+ $LG(document.body).removeClass('lg-overlay-open');
1252
+ };
1253
+ /**
1254
+ * Open lightGallery.
1255
+ * Open gallery with specific slide by passing index of the slide as parameter.
1256
+ * @category lGPublicMethods
1257
+ * @param {Number} index - index of the slide
1258
+ * @param {HTMLElement} element - Which image lightGallery should zoom from
1259
+ *
1260
+ * @example
1261
+ * const $dynamicGallery = document.getElementById('dynamic-gallery-demo');
1262
+ * const dynamicGallery = lightGallery($dynamicGallery, {
1263
+ * dynamic: true,
1264
+ * dynamicEl: [
1265
+ * {
1266
+ * src: 'img/1.jpg',
1267
+ * thumb: 'img/thumb-1.jpg',
1268
+ * subHtml: '<h4>Image 1 title</h4><p>Image 1 descriptions.</p>',
1269
+ * },
1270
+ * ...
1271
+ * ],
1272
+ * });
1273
+ * $dynamicGallery.addEventListener('click', function () {
1274
+ * // Starts with third item.(Optional).
1275
+ * // This is useful if you want use dynamic mode with
1276
+ * // custom thumbnails (thumbnails outside gallery),
1277
+ * dynamicGallery.openGallery(2);
1278
+ * });
1279
+ *
1280
+ */
1281
+ LightGallery.prototype.openGallery = function (index, element) {
1282
+ var _this = this;
1283
+ if (index === void 0) { index = this.settings.index; }
1284
+ // prevent accidental double execution
1285
+ if (this.lgOpened)
1286
+ return;
1287
+ this.lgOpened = true;
1288
+ this.outer.removeClass('lg-hide-items');
1289
+ this.hideScrollbar();
1290
+ // Add display block, but still has opacity 0
1291
+ this.$container.addClass('lg-show');
1292
+ var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, index);
1293
+ this.currentItemsInDom = itemsToBeInsertedToDom;
1294
+ var items = '';
1295
+ itemsToBeInsertedToDom.forEach(function (item) {
1296
+ items = items + ("<div id=\"" + item + "\" class=\"lg-item\"></div>");
1297
+ });
1298
+ this.$inner.append(items);
1299
+ this.addHtml(index);
1300
+ var transform = '';
1301
+ this.mediaContainerPosition = this.getMediaContainerPosition();
1302
+ var _a = this.mediaContainerPosition, top = _a.top, bottom = _a.bottom;
1303
+ if (!this.settings.allowMediaOverlap) {
1304
+ this.setMediaContainerPosition(top, bottom);
1305
+ }
1306
+ var __slideVideoInfo = this.galleryItems[index].__slideVideoInfo;
1307
+ if (this.zoomFromOrigin && element) {
1308
+ this.currentImageSize = utils.getSize(element, this.outer, top + bottom, __slideVideoInfo && this.settings.videoMaxSize);
1309
+ transform = utils.getTransform(element, this.outer, top, bottom, this.currentImageSize);
1310
+ }
1311
+ if (!this.zoomFromOrigin || !transform) {
1312
+ this.outer.addClass(this.settings.startClass);
1313
+ this.getSlideItem(index).removeClass('lg-complete');
1314
+ }
1315
+ var timeout = this.settings.zoomFromOrigin
1316
+ ? 100
1317
+ : this.settings.backdropDuration;
1318
+ setTimeout(function () {
1319
+ _this.outer.addClass('lg-components-open');
1320
+ }, timeout);
1321
+ this.index = index;
1322
+ this.LGel.trigger(lGEvents.beforeOpen);
1323
+ // add class lg-current to remove initial transition
1324
+ this.getSlideItem(index).addClass('lg-current');
1325
+ this.lGalleryOn = false;
1326
+ // Store the current scroll top value to scroll back after closing the gallery..
1327
+ this.prevScrollTop = $LG(window).scrollTop();
1328
+ setTimeout(function () {
1329
+ // Need to check both zoomFromOrigin and transform values as we need to set set the
1330
+ // default opening animation if user missed to add the lg-size attribute
1331
+ if (_this.zoomFromOrigin && transform) {
1332
+ var currentSlide_1 = _this.getSlideItem(index);
1333
+ currentSlide_1.css('transform', transform);
1334
+ setTimeout(function () {
1335
+ currentSlide_1
1336
+ .addClass('lg-start-progress lg-start-end-progress')
1337
+ .css('transition-duration', _this.settings.startAnimationDuration + 'ms');
1338
+ _this.outer.addClass('lg-zoom-from-image');
1339
+ });
1340
+ setTimeout(function () {
1341
+ currentSlide_1.css('transform', 'translate3d(0, 0, 0)');
1342
+ }, 100);
1343
+ }
1344
+ setTimeout(function () {
1345
+ _this.$backdrop.addClass('in');
1346
+ _this.$container.addClass('lg-show-in');
1347
+ }, 10);
1348
+ setTimeout(function () {
1349
+ if (_this.settings.trapFocus &&
1350
+ document.body === _this.settings.container) {
1351
+ _this.trapFocus();
1352
+ }
1353
+ }, _this.settings.backdropDuration + 50);
1354
+ // lg-visible class resets gallery opacity to 1
1355
+ if (!_this.zoomFromOrigin || !transform) {
1356
+ setTimeout(function () {
1357
+ _this.outer.addClass('lg-visible');
1358
+ }, _this.settings.backdropDuration);
1359
+ }
1360
+ // initiate slide function
1361
+ _this.slide(index, false, false, false);
1362
+ _this.LGel.trigger(lGEvents.afterOpen);
1363
+ });
1364
+ if (document.body === this.settings.container) {
1365
+ $LG('html').addClass('lg-on');
1366
+ }
1367
+ };
1368
+ /**
1369
+ * Note - Changing the position of the media on every slide transition creates a flickering effect.
1370
+ * Therefore, The height of the caption is calculated dynamically, only once based on the first slide caption.
1371
+ * if you have dynamic captions for each media,
1372
+ * you can provide an appropriate height for the captions via allowMediaOverlap option
1373
+ */
1374
+ LightGallery.prototype.getMediaContainerPosition = function () {
1375
+ if (this.settings.allowMediaOverlap) {
1376
+ return {
1377
+ top: 0,
1378
+ bottom: 0,
1379
+ };
1380
+ }
1381
+ var top = this.$toolbar.get().clientHeight || 0;
1382
+ var subHtml = this.outer.find('.lg-components .lg-sub-html').get();
1383
+ var captionHeight = this.settings.defaultCaptionHeight ||
1384
+ (subHtml && subHtml.clientHeight) ||
1385
+ 0;
1386
+ var thumbContainer = this.outer.find('.lg-thumb-outer').get();
1387
+ var thumbHeight = thumbContainer ? thumbContainer.clientHeight : 0;
1388
+ var bottom = thumbHeight + captionHeight;
1389
+ return {
1390
+ top: top,
1391
+ bottom: bottom,
1392
+ };
1393
+ };
1394
+ LightGallery.prototype.setMediaContainerPosition = function (top, bottom) {
1395
+ if (top === void 0) { top = 0; }
1396
+ if (bottom === void 0) { bottom = 0; }
1397
+ this.$content.css('top', top + 'px').css('bottom', bottom + 'px');
1398
+ };
1399
+ LightGallery.prototype.hideBars = function () {
1400
+ var _this = this;
1401
+ // Hide controllers if mouse doesn't move for some period
1402
+ setTimeout(function () {
1403
+ _this.outer.removeClass('lg-hide-items');
1404
+ if (_this.settings.hideBarsDelay > 0) {
1405
+ _this.outer.on('mousemove.lg click.lg touchstart.lg', function () {
1406
+ _this.outer.removeClass('lg-hide-items');
1407
+ clearTimeout(_this.hideBarTimeout);
1408
+ // Timeout will be cleared on each slide movement also
1409
+ _this.hideBarTimeout = setTimeout(function () {
1410
+ _this.outer.addClass('lg-hide-items');
1411
+ }, _this.settings.hideBarsDelay);
1412
+ });
1413
+ _this.outer.trigger('mousemove.lg');
1414
+ }
1415
+ }, this.settings.showBarsAfter);
1416
+ };
1417
+ LightGallery.prototype.initPictureFill = function ($img) {
1418
+ if (this.settings.supportLegacyBrowser) {
1419
+ try {
1420
+ picturefill({
1421
+ elements: [$img.get()],
1422
+ });
1423
+ }
1424
+ catch (e) {
1425
+ console.warn('lightGallery :- If you want srcset or picture tag to be supported for older browser please include picturefil javascript library in your document.');
1426
+ }
1427
+ }
1428
+ };
1429
+ /**
1430
+ * @desc Create image counter
1431
+ * Ex: 1/10
1432
+ */
1433
+ LightGallery.prototype.counter = function () {
1434
+ if (this.settings.counter) {
1435
+ var counterHtml = "<div class=\"lg-counter\" role=\"status\" aria-live=\"polite\">\n <span id=\"" + this.getIdName('lg-counter-current') + "\" class=\"lg-counter-current\">" + (this.index + 1) + " </span> /\n <span id=\"" + this.getIdName('lg-counter-all') + "\" class=\"lg-counter-all\">" + this.galleryItems.length + " </span></div>";
1436
+ this.outer.find(this.settings.appendCounterTo).append(counterHtml);
1437
+ }
1438
+ };
1439
+ /**
1440
+ * @desc add sub-html into the slide
1441
+ * @param {Number} index - index of the slide
1442
+ */
1443
+ LightGallery.prototype.addHtml = function (index) {
1444
+ var subHtml;
1445
+ var subHtmlUrl;
1446
+ if (this.galleryItems[index].subHtmlUrl) {
1447
+ subHtmlUrl = this.galleryItems[index].subHtmlUrl;
1448
+ }
1449
+ else {
1450
+ subHtml = this.galleryItems[index].subHtml;
1451
+ }
1452
+ if (!subHtmlUrl) {
1453
+ if (subHtml) {
1454
+ // get first letter of sub-html
1455
+ // if first letter starts with . or # get the html form the jQuery object
1456
+ var fL = subHtml.substring(0, 1);
1457
+ if (fL === '.' || fL === '#') {
1458
+ if (this.settings.subHtmlSelectorRelative &&
1459
+ !this.settings.dynamic) {
1460
+ subHtml = $LG(this.items)
1461
+ .eq(index)
1462
+ .find(subHtml)
1463
+ .first()
1464
+ .html();
1465
+ }
1466
+ else {
1467
+ subHtml = $LG(subHtml).first().html();
1468
+ }
1469
+ }
1470
+ }
1471
+ else {
1472
+ subHtml = '';
1473
+ }
1474
+ }
1475
+ if (this.settings.appendSubHtmlTo !== '.lg-item') {
1476
+ if (subHtmlUrl) {
1477
+ this.outer.find('.lg-sub-html').load(subHtmlUrl);
1478
+ }
1479
+ else {
1480
+ this.outer.find('.lg-sub-html').html(subHtml);
1481
+ }
1482
+ }
1483
+ else {
1484
+ var currentSlide = $LG(this.getSlideItemId(index));
1485
+ if (subHtmlUrl) {
1486
+ currentSlide.load(subHtmlUrl);
1487
+ }
1488
+ else {
1489
+ currentSlide.append("<div class=\"lg-sub-html\">" + subHtml + "</div>");
1490
+ }
1491
+ }
1492
+ // Add lg-empty-html class if title doesn't exist
1493
+ if (typeof subHtml !== 'undefined' && subHtml !== null) {
1494
+ if (subHtml === '') {
1495
+ this.outer
1496
+ .find(this.settings.appendSubHtmlTo)
1497
+ .addClass('lg-empty-html');
1498
+ }
1499
+ else {
1500
+ this.outer
1501
+ .find(this.settings.appendSubHtmlTo)
1502
+ .removeClass('lg-empty-html');
1503
+ }
1504
+ }
1505
+ this.LGel.trigger(lGEvents.afterAppendSubHtml, {
1506
+ index: index,
1507
+ });
1508
+ };
1509
+ /**
1510
+ * @desc Preload slides
1511
+ * @param {Number} index - index of the slide
1512
+ * @todo preload not working for the first slide, Also, should work for the first and last slide as well
1513
+ */
1514
+ LightGallery.prototype.preload = function (index) {
1515
+ for (var i = 1; i <= this.settings.preload; i++) {
1516
+ if (i >= this.galleryItems.length - index) {
1517
+ break;
1518
+ }
1519
+ this.loadContent(index + i, false);
1520
+ }
1521
+ for (var j = 1; j <= this.settings.preload; j++) {
1522
+ if (index - j < 0) {
1523
+ break;
1524
+ }
1525
+ this.loadContent(index - j, false);
1526
+ }
1527
+ };
1528
+ LightGallery.prototype.getDummyImgStyles = function (imageSize) {
1529
+ if (!imageSize)
1530
+ return '';
1531
+ return "width:" + imageSize.width + "px;\n margin-left: -" + imageSize.width / 2 + "px;\n margin-top: -" + imageSize.height / 2 + "px;\n height:" + imageSize.height + "px";
1532
+ };
1533
+ LightGallery.prototype.getVideoContStyle = function (imageSize) {
1534
+ if (!imageSize)
1535
+ return '';
1536
+ return "width:" + imageSize.width + "px;\n height:" + imageSize.height + "px";
1537
+ };
1538
+ LightGallery.prototype.getDummyImageContent = function ($currentSlide, index, alt) {
1539
+ var $currentItem;
1540
+ if (!this.settings.dynamic) {
1541
+ $currentItem = $LG(this.items).eq(index);
1542
+ }
1543
+ if ($currentItem) {
1544
+ var _dummyImgSrc = void 0;
1545
+ if (!this.settings.exThumbImage) {
1546
+ _dummyImgSrc = $currentItem.find('img').first().attr('src');
1547
+ }
1548
+ else {
1549
+ _dummyImgSrc = $currentItem.attr(this.settings.exThumbImage);
1550
+ }
1551
+ if (!_dummyImgSrc)
1552
+ return '';
1553
+ var imgStyle = this.getDummyImgStyles(this.currentImageSize);
1554
+ var dummyImgContent = "<img " + alt + " style=\"" + imgStyle + "\" class=\"lg-dummy-img\" src=\"" + _dummyImgSrc + "\" />";
1555
+ $currentSlide.addClass('lg-first-slide');
1556
+ this.outer.addClass('lg-first-slide-loading');
1557
+ return dummyImgContent;
1558
+ }
1559
+ return '';
1560
+ };
1561
+ LightGallery.prototype.setImgMarkup = function (src, $currentSlide, index) {
1562
+ var currentGalleryItem = this.galleryItems[index];
1563
+ var alt = currentGalleryItem.alt, srcset = currentGalleryItem.srcset, sizes = currentGalleryItem.sizes, sources = currentGalleryItem.sources;
1564
+ // Use the thumbnail as dummy image which will be resized to actual image size and
1565
+ // displayed on top of actual image
1566
+ var imgContent = '';
1567
+ var altAttr = alt ? 'alt="' + alt + '"' : '';
1568
+ if (this.isFirstSlideWithZoomAnimation()) {
1569
+ imgContent = this.getDummyImageContent($currentSlide, index, altAttr);
1570
+ }
1571
+ else {
1572
+ imgContent = utils.getImgMarkup(index, src, altAttr, srcset, sizes, sources);
1573
+ }
1574
+ var imgMarkup = "<picture class=\"lg-img-wrap\"> " + imgContent + "</picture>";
1575
+ $currentSlide.prepend(imgMarkup);
1576
+ };
1577
+ LightGallery.prototype.onSlideObjectLoad = function ($slide, isHTML5VideoWithoutPoster, onLoad, onError) {
1578
+ var mediaObject = $slide.find('.lg-object').first();
1579
+ if (utils.isImageLoaded(mediaObject.get()) ||
1580
+ isHTML5VideoWithoutPoster) {
1581
+ onLoad();
1582
+ }
1583
+ else {
1584
+ mediaObject.on('load.lg error.lg', function () {
1585
+ onLoad && onLoad();
1586
+ });
1587
+ mediaObject.on('error.lg', function () {
1588
+ onError && onError();
1589
+ });
1590
+ }
1591
+ };
1592
+ /**
1593
+ *
1594
+ * @param $el Current slide item
1595
+ * @param index
1596
+ * @param delay Delay is 0 except first time
1597
+ * @param speed Speed is same as delay, except it is 0 if gallery is opened via hash plugin
1598
+ * @param isFirstSlide
1599
+ */
1600
+ LightGallery.prototype.onLgObjectLoad = function (currentSlide, index, delay, speed, isFirstSlide, isHTML5VideoWithoutPoster) {
1601
+ var _this = this;
1602
+ this.onSlideObjectLoad(currentSlide, isHTML5VideoWithoutPoster, function () {
1603
+ _this.triggerSlideItemLoad(currentSlide, index, delay, speed, isFirstSlide);
1604
+ }, function () {
1605
+ currentSlide.addClass('lg-complete lg-complete_');
1606
+ currentSlide.html('<span class="lg-error-msg">' +
1607
+ _this.settings.strings['mediaLoadingFailed'] +
1608
+ '</span>');
1609
+ });
1610
+ };
1611
+ LightGallery.prototype.triggerSlideItemLoad = function ($currentSlide, index, delay, speed, isFirstSlide) {
1612
+ var _this = this;
1613
+ var currentGalleryItem = this.galleryItems[index];
1614
+ // Adding delay for video slides without poster for better performance and user experience
1615
+ // Videos should start playing once once the gallery is completely loaded
1616
+ var _speed = isFirstSlide &&
1617
+ this.getSlideType(currentGalleryItem) === 'video' &&
1618
+ !currentGalleryItem.poster
1619
+ ? speed
1620
+ : 0;
1621
+ setTimeout(function () {
1622
+ $currentSlide.addClass('lg-complete lg-complete_');
1623
+ _this.LGel.trigger(lGEvents.slideItemLoad, {
1624
+ index: index,
1625
+ delay: delay || 0,
1626
+ isFirstSlide: isFirstSlide,
1627
+ });
1628
+ }, _speed);
1629
+ };
1630
+ LightGallery.prototype.isFirstSlideWithZoomAnimation = function () {
1631
+ return !!(!this.lGalleryOn &&
1632
+ this.zoomFromOrigin &&
1633
+ this.currentImageSize);
1634
+ };
1635
+ // Add video slideInfo
1636
+ LightGallery.prototype.addSlideVideoInfo = function (items) {
1637
+ var _this = this;
1638
+ items.forEach(function (element, index) {
1639
+ element.__slideVideoInfo = utils.isVideo(element.src, !!element.video, index);
1640
+ if (element.__slideVideoInfo &&
1641
+ _this.settings.loadYouTubePoster &&
1642
+ !element.poster &&
1643
+ element.__slideVideoInfo.youtube) {
1644
+ element.poster = "//img.youtube.com/vi/" + element.__slideVideoInfo.youtube[1] + "/mqdefault.jpg";
1645
+ }
1646
+ });
1647
+ };
1648
+
1649
+ /**
1650
+ * Load slide content into slide.
1651
+ * This is used to load content into slides that is not visible too
1652
+ * @param {Number} index - index of the slide.
1653
+ * @param {Boolean} rec - if true call loadcontent() function again.
1654
+ */
1655
+ // jadams
1656
+ LightGallery.prototype.loadContent = function (index, rec) {
1657
+ var _this = this;
1658
+ var currentGalleryItem = this.galleryItems[index];
1659
+ var $currentSlide = $LG(this.getSlideItemId(index));
1660
+ var poster = currentGalleryItem.poster, srcset = currentGalleryItem.srcset, sizes = currentGalleryItem.sizes, sources = currentGalleryItem.sources;
1661
+ var src = currentGalleryItem.src;
1662
+ var video = currentGalleryItem.video;
1663
+ var _html5Video = video && typeof video === 'string' ? JSON.parse(video) : video;
1664
+ if (currentGalleryItem.responsive) {
1665
+ var srcDyItms = currentGalleryItem.responsive.split(',');
1666
+ src = utils.getResponsiveSrc(srcDyItms) || src;
1667
+ }
1668
+ var videoInfo = currentGalleryItem.__slideVideoInfo;
1669
+ var lgVideoStyle = '';
1670
+ var iframe = !!currentGalleryItem.iframe;
1671
+ var isFirstSlide = !this.lGalleryOn;
1672
+ // delay for adding complete class. it is 0 except first time.
1673
+ var delay = 0;
1674
+ if (isFirstSlide) {
1675
+ if (this.zoomFromOrigin && this.currentImageSize) {
1676
+ delay = this.settings.startAnimationDuration + 10;
1677
+ }
1678
+ else {
1679
+ delay = this.settings.backdropDuration + 10;
1680
+ }
1681
+ }
1682
+ if (!$currentSlide.hasClass('lg-loaded')) {
1683
+ if (videoInfo) {
1684
+ var _a = this.mediaContainerPosition, top_2 = _a.top, bottom = _a.bottom;
1685
+ var videoSize = utils.getSize(this.items[index], this.outer, top_2 + bottom, videoInfo && this.settings.videoMaxSize);
1686
+ lgVideoStyle = this.getVideoContStyle(videoSize);
1687
+ }
1688
+ if (iframe) {
1689
+ var markup = utils.getIframeMarkup(this.settings.iframeWidth, this.settings.iframeHeight, this.settings.iframeMaxWidth, this.settings.iframeMaxHeight, src, currentGalleryItem.iframeTitle);
1690
+ $currentSlide.prepend(markup);
1691
+ }
1692
+ else if (poster) {
1693
+ var dummyImg = '';
1694
+ var hasStartAnimation = isFirstSlide &&
1695
+ this.zoomFromOrigin &&
1696
+ this.currentImageSize;
1697
+ if (hasStartAnimation) {
1698
+ dummyImg = this.getDummyImageContent($currentSlide, index, '');
1699
+ }
1700
+ var markup = utils.getVideoPosterMarkup(poster, dummyImg || '', lgVideoStyle, this.settings.strings['playVideo'], videoInfo);
1701
+ $currentSlide.prepend(markup);
1702
+ }
1703
+ else if (videoInfo) {
1704
+ var markup = "<div class=\"lg-video-cont \" style=\"" + lgVideoStyle + "\"></div>";
1705
+ $currentSlide.prepend(markup);
1706
+ }
1707
+ else {
1708
+ this.setImgMarkup(src, $currentSlide, index);
1709
+ if (srcset || sources) {
1710
+ var $img = $currentSlide.find('.lg-object');
1711
+ this.initPictureFill($img);
1712
+ }
1713
+ }
1714
+ if (poster || videoInfo) {
1715
+ this.LGel.trigger(lGEvents.hasVideo, {
1716
+ index: index,
1717
+ src: src,
1718
+ html5Video: _html5Video,
1719
+ hasPoster: !!poster,
1720
+ });
1721
+ }
1722
+ this.LGel.trigger(lGEvents.afterAppendSlide, { index: index });
1723
+ if (this.lGalleryOn &&
1724
+ this.settings.appendSubHtmlTo === '.lg-item') {
1725
+ this.addHtml(index);
1726
+ }
1727
+ }
1728
+ // For first time add some delay for displaying the start animation.
1729
+ var _speed = 0;
1730
+ // Do not change the delay value because it is required for zoom plugin.
1731
+ // If gallery opened from direct url (hash) speed value should be 0
1732
+ if (delay && !$LG(document.body).hasClass('lg-from-hash')) {
1733
+ _speed = delay;
1734
+ }
1735
+ // Only for first slide and zoomFromOrigin is enabled
1736
+ if (this.isFirstSlideWithZoomAnimation()) {
1737
+ setTimeout(function () {
1738
+ $currentSlide
1739
+ .removeClass('lg-start-end-progress lg-start-progress')
1740
+ .removeAttr('style');
1741
+ }, this.settings.startAnimationDuration + 100);
1742
+ if (!$currentSlide.hasClass('lg-loaded')) {
1743
+ setTimeout(function () {
1744
+ if (_this.getSlideType(currentGalleryItem) === 'image') {
1745
+ var alt = currentGalleryItem.alt;
1746
+ var altAttr = alt ? 'alt="' + alt + '"' : '';
1747
+ $currentSlide
1748
+ .find('.lg-img-wrap')
1749
+ .append(utils.getImgMarkup(index, src, altAttr, srcset, sizes, currentGalleryItem.sources));
1750
+ if (srcset || sources) {
1751
+ var $img = $currentSlide.find('.lg-object');
1752
+ _this.initPictureFill($img);
1753
+ }
1754
+ }
1755
+ if (_this.getSlideType(currentGalleryItem) === 'image' ||
1756
+ (_this.getSlideType(currentGalleryItem) === 'video' &&
1757
+ poster)) {
1758
+ _this.onLgObjectLoad($currentSlide, index, delay, _speed, true, false);
1759
+ // load remaining slides once the slide is completely loaded
1760
+ _this.onSlideObjectLoad($currentSlide, !!(videoInfo && videoInfo.html5 && !poster), function () {
1761
+ _this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
1762
+ }, function () {
1763
+ _this.loadContentOnFirstSlideLoad(index, $currentSlide, _speed);
1764
+ });
1765
+ }
1766
+ }, this.settings.startAnimationDuration + 100);
1767
+ }
1768
+ }
1769
+ // SLide content has been added to dom
1770
+ $currentSlide.addClass('lg-loaded');
1771
+ if (!this.isFirstSlideWithZoomAnimation() ||
1772
+ (this.getSlideType(currentGalleryItem) === 'video' && !poster)) {
1773
+ this.onLgObjectLoad($currentSlide, index, delay, _speed, isFirstSlide, !!(videoInfo && videoInfo.html5 && !poster));
1774
+ }
1775
+ // When gallery is opened once content is loaded (second time) need to add lg-complete class for css styling
1776
+ if ((!this.zoomFromOrigin || !this.currentImageSize) &&
1777
+ $currentSlide.hasClass('lg-complete_') &&
1778
+ !this.lGalleryOn) {
1779
+ setTimeout(function () {
1780
+ $currentSlide.addClass('lg-complete');
1781
+ }, this.settings.backdropDuration);
1782
+ }
1783
+ // Content loaded
1784
+ // Need to set lGalleryOn before calling preload function
1785
+ this.lGalleryOn = true;
1786
+ if (rec === true) {
1787
+ if (!$currentSlide.hasClass('lg-complete_')) {
1788
+ $currentSlide
1789
+ .find('.lg-object')
1790
+ .first()
1791
+ .on('load.lg error.lg', function () {
1792
+ _this.preload(index);
1793
+ });
1794
+ }
1795
+ else {
1796
+ this.preload(index);
1797
+ }
1798
+ }
1799
+ };
1800
+ /**
1801
+ * @desc Remove dummy image content and load next slides
1802
+ * Called only for the first time if zoomFromOrigin animation is enabled
1803
+ * @param index
1804
+ * @param $currentSlide
1805
+ * @param speed
1806
+ */
1807
+ LightGallery.prototype.loadContentOnFirstSlideLoad = function (index, $currentSlide, speed) {
1808
+ var _this = this;
1809
+ setTimeout(function () {
1810
+ $currentSlide.find('.lg-dummy-img').remove();
1811
+ $currentSlide.removeClass('lg-first-slide');
1812
+ _this.outer.removeClass('lg-first-slide-loading');
1813
+ _this.isDummyImageRemoved = true;
1814
+ _this.preload(index);
1815
+ }, speed + 300);
1816
+ };
1817
+ LightGallery.prototype.getItemsToBeInsertedToDom = function (index, prevIndex, numberOfItems) {
1818
+ var _this = this;
1819
+ if (numberOfItems === void 0) { numberOfItems = 0; }
1820
+ var itemsToBeInsertedToDom = [];
1821
+ // Minimum 2 items should be there
1822
+ var possibleNumberOfItems = Math.max(numberOfItems, 3);
1823
+ possibleNumberOfItems = Math.min(possibleNumberOfItems, this.galleryItems.length);
1824
+ var prevIndexItem = "lg-item-" + this.lgId + "-" + prevIndex;
1825
+ if (this.galleryItems.length <= 3) {
1826
+ this.galleryItems.forEach(function (_element, index) {
1827
+ itemsToBeInsertedToDom.push("lg-item-" + _this.lgId + "-" + index);
1828
+ });
1829
+ return itemsToBeInsertedToDom;
1830
+ }
1831
+ if (index < (this.galleryItems.length - 1) / 2) {
1832
+ for (var idx = index; idx > index - possibleNumberOfItems / 2 && idx >= 0; idx--) {
1833
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + idx);
1834
+ }
1835
+ var numberOfExistingItems = itemsToBeInsertedToDom.length;
1836
+ for (var idx = 0; idx < possibleNumberOfItems - numberOfExistingItems; idx++) {
1837
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + (index + idx + 1));
1838
+ }
1839
+ }
1840
+ else {
1841
+ for (var idx = index; idx <= this.galleryItems.length - 1 &&
1842
+ idx < index + possibleNumberOfItems / 2; idx++) {
1843
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + idx);
1844
+ }
1845
+ var numberOfExistingItems = itemsToBeInsertedToDom.length;
1846
+ for (var idx = 0; idx < possibleNumberOfItems - numberOfExistingItems; idx++) {
1847
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + (index - idx - 1));
1848
+ }
1849
+ }
1850
+ if (this.settings.loop) {
1851
+ if (index === this.galleryItems.length - 1) {
1852
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + 0);
1853
+ }
1854
+ else if (index === 0) {
1855
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + (this.galleryItems.length - 1));
1856
+ }
1857
+ }
1858
+ if (itemsToBeInsertedToDom.indexOf(prevIndexItem) === -1) {
1859
+ itemsToBeInsertedToDom.push("lg-item-" + this.lgId + "-" + prevIndex);
1860
+ }
1861
+ return itemsToBeInsertedToDom;
1862
+ };
1863
+ LightGallery.prototype.organizeSlideItems = function (index, prevIndex) {
1864
+ var _this = this;
1865
+ var itemsToBeInsertedToDom = this.getItemsToBeInsertedToDom(index, prevIndex, this.settings.numberOfSlideItemsInDom);
1866
+ itemsToBeInsertedToDom.forEach(function (item) {
1867
+ if (_this.currentItemsInDom.indexOf(item) === -1) {
1868
+ _this.$inner.append("<div id=\"" + item + "\" class=\"lg-item\"></div>");
1869
+ }
1870
+ });
1871
+ this.currentItemsInDom.forEach(function (item) {
1872
+ if (itemsToBeInsertedToDom.indexOf(item) === -1) {
1873
+ $LG("#" + item).remove();
1874
+ }
1875
+ });
1876
+ return itemsToBeInsertedToDom;
1877
+ };
1878
+ /**
1879
+ * Get previous index of the slide
1880
+ */
1881
+ LightGallery.prototype.getPreviousSlideIndex = function () {
1882
+ var prevIndex = 0;
1883
+ try {
1884
+ var currentItemId = this.outer
1885
+ .find('.lg-current')
1886
+ .first()
1887
+ .attr('id');
1888
+ prevIndex = parseInt(currentItemId.split('-')[3]) || 0;
1889
+ }
1890
+ catch (error) {
1891
+ prevIndex = 0;
1892
+ }
1893
+ return prevIndex;
1894
+ };
1895
+ LightGallery.prototype.setDownloadValue = function (index) {
1896
+ if (this.settings.download) {
1897
+ var currentGalleryItem = this.galleryItems[index];
1898
+ var hideDownloadBtn = currentGalleryItem.downloadUrl === false ||
1899
+ currentGalleryItem.downloadUrl === 'false';
1900
+ if (hideDownloadBtn) {
1901
+ this.outer.addClass('lg-hide-download');
1902
+ }
1903
+ else {
1904
+ var $download = this.getElementById('lg-download');
1905
+ this.outer.removeClass('lg-hide-download');
1906
+ $download.attr('href', currentGalleryItem.downloadUrl ||
1907
+ currentGalleryItem.src);
1908
+ if (currentGalleryItem.download) {
1909
+ $download.attr('download', currentGalleryItem.download);
1910
+ }
1911
+ }
1912
+ }
1913
+ };
1914
+ LightGallery.prototype.makeSlideAnimation = function (direction, currentSlideItem, previousSlideItem) {
1915
+ var _this = this;
1916
+ if (this.lGalleryOn) {
1917
+ previousSlideItem.addClass('lg-slide-progress');
1918
+ }
1919
+ setTimeout(function () {
1920
+ // remove all transitions
1921
+ _this.outer.addClass('lg-no-trans');
1922
+ _this.outer
1923
+ .find('.lg-item')
1924
+ .removeClass('lg-prev-slide lg-next-slide');
1925
+ if (direction === 'prev') {
1926
+ //prevslide
1927
+ currentSlideItem.addClass('lg-prev-slide');
1928
+ previousSlideItem.addClass('lg-next-slide');
1929
+ }
1930
+ else {
1931
+ // next slide
1932
+ currentSlideItem.addClass('lg-next-slide');
1933
+ previousSlideItem.addClass('lg-prev-slide');
1934
+ }
1935
+ // give 50 ms for browser to add/remove class
1936
+ setTimeout(function () {
1937
+ _this.outer.find('.lg-item').removeClass('lg-current');
1938
+ currentSlideItem.addClass('lg-current');
1939
+ // reset all transitions
1940
+ _this.outer.removeClass('lg-no-trans');
1941
+ }, 50);
1942
+ }, this.lGalleryOn ? this.settings.slideDelay : 0);
1943
+ };
1944
+ /**
1945
+ * Goto a specific slide.
1946
+ * @param {Number} index - index of the slide
1947
+ * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
1948
+ * @param {Boolean} fromThumb - true if slide function called via thumbnail click
1949
+ * @param {String} direction - Direction of the slide(next/prev)
1950
+ * @category lGPublicMethods
1951
+ * @example
1952
+ * const plugin = lightGallery();
1953
+ * // to go to 3rd slide
1954
+ * plugin.slide(2);
1955
+ *
1956
+ */
1957
+ LightGallery.prototype.slide = function (index, fromTouch, fromThumb, direction) {
1958
+ var _this = this;
1959
+ var prevIndex = this.getPreviousSlideIndex();
1960
+ this.currentItemsInDom = this.organizeSlideItems(index, prevIndex);
1961
+ // Prevent multiple call, Required for hsh plugin
1962
+ if (this.lGalleryOn && prevIndex === index) {
1963
+ return;
1964
+ }
1965
+ var numberOfGalleryItems = this.galleryItems.length;
1966
+ if (!this.lgBusy) {
1967
+ if (this.settings.counter) {
1968
+ this.updateCurrentCounter(index);
1969
+ }
1970
+ var currentSlideItem = this.getSlideItem(index);
1971
+ var previousSlideItem_1 = this.getSlideItem(prevIndex);
1972
+ var currentGalleryItem = this.galleryItems[index];
1973
+ var videoInfo = currentGalleryItem.__slideVideoInfo;
1974
+ this.outer.attr('data-lg-slide-type', this.getSlideType(currentGalleryItem));
1975
+ this.setDownloadValue(index);
1976
+ if (videoInfo) {
1977
+ var _a = this.mediaContainerPosition, top_3 = _a.top, bottom = _a.bottom;
1978
+ var videoSize = utils.getSize(this.items[index], this.outer, top_3 + bottom, videoInfo && this.settings.videoMaxSize);
1979
+ this.resizeVideoSlide(index, videoSize);
1980
+ }
1981
+ this.LGel.trigger(lGEvents.beforeSlide, {
1982
+ prevIndex: prevIndex,
1983
+ index: index,
1984
+ fromTouch: !!fromTouch,
1985
+ fromThumb: !!fromThumb,
1986
+ });
1987
+ this.lgBusy = true;
1988
+ clearTimeout(this.hideBarTimeout);
1989
+ this.arrowDisable(index);
1990
+ if (!direction) {
1991
+ if (index < prevIndex) {
1992
+ direction = 'prev';
1993
+ }
1994
+ else if (index > prevIndex) {
1995
+ direction = 'next';
1996
+ }
1997
+ }
1998
+ if (!fromTouch) {
1999
+ this.makeSlideAnimation(direction, currentSlideItem, previousSlideItem_1);
2000
+ }
2001
+ else {
2002
+ this.outer
2003
+ .find('.lg-item')
2004
+ .removeClass('lg-prev-slide lg-current lg-next-slide');
2005
+ var touchPrev = void 0;
2006
+ var touchNext = void 0;
2007
+ if (numberOfGalleryItems > 2) {
2008
+ touchPrev = index - 1;
2009
+ touchNext = index + 1;
2010
+ if (index === 0 && prevIndex === numberOfGalleryItems - 1) {
2011
+ // next slide
2012
+ touchNext = 0;
2013
+ touchPrev = numberOfGalleryItems - 1;
2014
+ }
2015
+ else if (index === numberOfGalleryItems - 1 &&
2016
+ prevIndex === 0) {
2017
+ // prev slide
2018
+ touchNext = 0;
2019
+ touchPrev = numberOfGalleryItems - 1;
2020
+ }
2021
+ }
2022
+ else {
2023
+ touchPrev = 0;
2024
+ touchNext = 1;
2025
+ }
2026
+ if (direction === 'prev') {
2027
+ this.getSlideItem(touchNext).addClass('lg-next-slide');
2028
+ }
2029
+ else {
2030
+ this.getSlideItem(touchPrev).addClass('lg-prev-slide');
2031
+ }
2032
+ currentSlideItem.addClass('lg-current');
2033
+ }
2034
+ // Do not put load content in set timeout as it needs to load immediately when the gallery is opened
2035
+ if (!this.lGalleryOn) {
2036
+ this.loadContent(index, true);
2037
+ }
2038
+ else {
2039
+ setTimeout(function () {
2040
+ _this.loadContent(index, true);
2041
+ // Add title if this.settings.appendSubHtmlTo === lg-sub-html
2042
+ if (_this.settings.appendSubHtmlTo !== '.lg-item') {
2043
+ _this.addHtml(index);
2044
+ }
2045
+ }, this.settings.speed + 50 + (fromTouch ? 0 : this.settings.slideDelay));
2046
+ }
2047
+ setTimeout(function () {
2048
+ _this.lgBusy = false;
2049
+ previousSlideItem_1.removeClass('lg-slide-progress');
2050
+ _this.LGel.trigger(lGEvents.afterSlide, {
2051
+ prevIndex: prevIndex,
2052
+ index: index,
2053
+ fromTouch: fromTouch,
2054
+ fromThumb: fromThumb,
2055
+ });
2056
+ }, (this.lGalleryOn ? this.settings.speed + 100 : 100) + (fromTouch ? 0 : this.settings.slideDelay));
2057
+ }
2058
+ this.index = index;
2059
+ };
2060
+ LightGallery.prototype.updateCurrentCounter = function (index) {
2061
+ this.getElementById('lg-counter-current').html(index + 1 + '');
2062
+ };
2063
+ LightGallery.prototype.updateCounterTotal = function () {
2064
+ this.getElementById('lg-counter-all').html(this.galleryItems.length + '');
2065
+ };
2066
+ LightGallery.prototype.getSlideType = function (item) {
2067
+ if (item.__slideVideoInfo) {
2068
+ return 'video';
2069
+ }
2070
+ else if (item.iframe) {
2071
+ return 'iframe';
2072
+ }
2073
+ else {
2074
+ return 'image';
2075
+ }
2076
+ };
2077
+ LightGallery.prototype.touchMove = function (startCoords, endCoords, e) {
2078
+ var distanceX = endCoords.pageX - startCoords.pageX;
2079
+ var distanceY = endCoords.pageY - startCoords.pageY;
2080
+ var allowSwipe = false;
2081
+ if (this.swipeDirection) {
2082
+ allowSwipe = true;
2083
+ }
2084
+ else {
2085
+ if (Math.abs(distanceX) > 15) {
2086
+ this.swipeDirection = 'horizontal';
2087
+ allowSwipe = true;
2088
+ }
2089
+ else if (Math.abs(distanceY) > 15) {
2090
+ this.swipeDirection = 'vertical';
2091
+ allowSwipe = true;
2092
+ }
2093
+ }
2094
+ if (!allowSwipe) {
2095
+ return;
2096
+ }
2097
+ var $currentSlide = this.getSlideItem(this.index);
2098
+ if (this.swipeDirection === 'horizontal') {
2099
+ e === null || e === void 0 ? void 0 : e.preventDefault();
2100
+ // reset opacity and transition duration
2101
+ this.outer.addClass('lg-dragging');
2102
+ // move current slide
2103
+ this.setTranslate($currentSlide, distanceX, 0);
2104
+ // move next and prev slide with current slide
2105
+ var width = $currentSlide.get().offsetWidth;
2106
+ var slideWidthAmount = (width * 15) / 100;
2107
+ var gutter = slideWidthAmount - Math.abs((distanceX * 10) / 100);
2108
+ this.setTranslate(this.outer.find('.lg-prev-slide').first(), -width + distanceX - gutter, 0);
2109
+ this.setTranslate(this.outer.find('.lg-next-slide').first(), width + distanceX + gutter, 0);
2110
+ }
2111
+ else if (this.swipeDirection === 'vertical') {
2112
+ if (this.settings.swipeToClose) {
2113
+ e === null || e === void 0 ? void 0 : e.preventDefault();
2114
+ this.$container.addClass('lg-dragging-vertical');
2115
+ var opacity = 1 - Math.abs(distanceY) / window.innerHeight;
2116
+ this.$backdrop.css('opacity', opacity);
2117
+ var scale = 1 - Math.abs(distanceY) / (window.innerWidth * 2);
2118
+ this.setTranslate($currentSlide, 0, distanceY, scale, scale);
2119
+ if (Math.abs(distanceY) > 100) {
2120
+ this.outer
2121
+ .addClass('lg-hide-items')
2122
+ .removeClass('lg-components-open');
2123
+ }
2124
+ }
2125
+ }
2126
+ };
2127
+ LightGallery.prototype.touchEnd = function (endCoords, startCoords, event) {
2128
+ var _this = this;
2129
+ var distance;
2130
+ // keep slide animation for any mode while dragg/swipe
2131
+ if (this.settings.mode !== 'lg-slide') {
2132
+ this.outer.addClass('lg-slide');
2133
+ }
2134
+ // set transition duration
2135
+ setTimeout(function () {
2136
+ _this.$container.removeClass('lg-dragging-vertical');
2137
+ _this.outer
2138
+ .removeClass('lg-dragging lg-hide-items')
2139
+ .addClass('lg-components-open');
2140
+ var triggerClick = true;
2141
+ if (_this.swipeDirection === 'horizontal') {
2142
+ distance = endCoords.pageX - startCoords.pageX;
2143
+ var distanceAbs = Math.abs(endCoords.pageX - startCoords.pageX);
2144
+ if (distance < 0 &&
2145
+ distanceAbs > _this.settings.swipeThreshold) {
2146
+ _this.goToNextSlide(true);
2147
+ triggerClick = false;
2148
+ }
2149
+ else if (distance > 0 &&
2150
+ distanceAbs > _this.settings.swipeThreshold) {
2151
+ _this.goToPrevSlide(true);
2152
+ triggerClick = false;
2153
+ }
2154
+ }
2155
+ else if (_this.swipeDirection === 'vertical') {
2156
+ distance = Math.abs(endCoords.pageY - startCoords.pageY);
2157
+ if (_this.settings.closable &&
2158
+ _this.settings.swipeToClose &&
2159
+ distance > 100) {
2160
+ _this.closeGallery();
2161
+ return;
2162
+ }
2163
+ else {
2164
+ _this.$backdrop.css('opacity', 1);
2165
+ }
2166
+ }
2167
+ _this.outer.find('.lg-item').removeAttr('style');
2168
+ if (triggerClick &&
2169
+ Math.abs(endCoords.pageX - startCoords.pageX) < 5) {
2170
+ // Trigger click if distance is less than 5 pix
2171
+ var target = $LG(event.target);
2172
+ if (_this.isPosterElement(target)) {
2173
+ _this.LGel.trigger(lGEvents.posterClick);
2174
+ }
2175
+ }
2176
+ _this.swipeDirection = undefined;
2177
+ });
2178
+ // remove slide class once drag/swipe is completed if mode is not slide
2179
+ setTimeout(function () {
2180
+ if (!_this.outer.hasClass('lg-dragging') &&
2181
+ _this.settings.mode !== 'lg-slide') {
2182
+ _this.outer.removeClass('lg-slide');
2183
+ }
2184
+ }, this.settings.speed + 100);
2185
+ };
2186
+ LightGallery.prototype.enableSwipe = function () {
2187
+ var _this = this;
2188
+ var startCoords = {};
2189
+ var endCoords = {};
2190
+ var isMoved = false;
2191
+ var isSwiping = false;
2192
+ if (this.settings.enableSwipe) {
2193
+ this.$inner.on('touchstart.lg', function (e) {
2194
+ _this.dragOrSwipeEnabled = true;
2195
+ var $item = _this.getSlideItem(_this.index);
2196
+ if (($LG(e.target).hasClass('lg-item') ||
2197
+ $item.get().contains(e.target)) &&
2198
+ !_this.outer.hasClass('lg-zoomed') &&
2199
+ !_this.lgBusy &&
2200
+ e.touches.length === 1) {
2201
+ isSwiping = true;
2202
+ _this.touchAction = 'swipe';
2203
+ _this.manageSwipeClass();
2204
+ startCoords = {
2205
+ pageX: e.touches[0].pageX,
2206
+ pageY: e.touches[0].pageY,
2207
+ };
2208
+ }
2209
+ });
2210
+ this.$inner.on('touchmove.lg', function (e) {
2211
+ if (isSwiping &&
2212
+ _this.touchAction === 'swipe' &&
2213
+ e.touches.length === 1) {
2214
+ endCoords = {
2215
+ pageX: e.touches[0].pageX,
2216
+ pageY: e.touches[0].pageY,
2217
+ };
2218
+ _this.touchMove(startCoords, endCoords, e);
2219
+ isMoved = true;
2220
+ }
2221
+ });
2222
+ this.$inner.on('touchend.lg', function (event) {
2223
+ if (_this.touchAction === 'swipe') {
2224
+ if (isMoved) {
2225
+ isMoved = false;
2226
+ _this.touchEnd(endCoords, startCoords, event);
2227
+ }
2228
+ else if (isSwiping) {
2229
+ var target = $LG(event.target);
2230
+ if (_this.isPosterElement(target)) {
2231
+ _this.LGel.trigger(lGEvents.posterClick);
2232
+ }
2233
+ }
2234
+ _this.touchAction = undefined;
2235
+ isSwiping = false;
2236
+ }
2237
+ });
2238
+ }
2239
+ };
2240
+ LightGallery.prototype.enableDrag = function () {
2241
+ var _this = this;
2242
+ var startCoords = {};
2243
+ var endCoords = {};
2244
+ var isDraging = false;
2245
+ var isMoved = false;
2246
+ if (this.settings.enableDrag) {
2247
+ this.outer.on('mousedown.lg', function (e) {
2248
+ _this.dragOrSwipeEnabled = true;
2249
+ var $item = _this.getSlideItem(_this.index);
2250
+ if ($LG(e.target).hasClass('lg-item') ||
2251
+ $item.get().contains(e.target)) {
2252
+ if (!_this.outer.hasClass('lg-zoomed') && !_this.lgBusy) {
2253
+ e.preventDefault();
2254
+ if (!_this.lgBusy) {
2255
+ _this.manageSwipeClass();
2256
+ startCoords = {
2257
+ pageX: e.pageX,
2258
+ pageY: e.pageY,
2259
+ };
2260
+ isDraging = true;
2261
+ // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
2262
+ _this.outer.get().scrollLeft += 1;
2263
+ _this.outer.get().scrollLeft -= 1;
2264
+ // *
2265
+ _this.outer
2266
+ .removeClass('lg-grab')
2267
+ .addClass('lg-grabbing');
2268
+ _this.LGel.trigger(lGEvents.dragStart);
2269
+ }
2270
+ }
2271
+ }
2272
+ });
2273
+ $LG(window).on("mousemove.lg.global" + this.lgId, function (e) {
2274
+ if (isDraging && _this.lgOpened) {
2275
+ isMoved = true;
2276
+ endCoords = {
2277
+ pageX: e.pageX,
2278
+ pageY: e.pageY,
2279
+ };
2280
+ _this.touchMove(startCoords, endCoords);
2281
+ _this.LGel.trigger(lGEvents.dragMove);
2282
+ }
2283
+ });
2284
+ $LG(window).on("mouseup.lg.global" + this.lgId, function (event) {
2285
+ if (!_this.lgOpened) {
2286
+ return;
2287
+ }
2288
+ var target = $LG(event.target);
2289
+ if (isMoved) {
2290
+ isMoved = false;
2291
+ _this.touchEnd(endCoords, startCoords, event);
2292
+ _this.LGel.trigger(lGEvents.dragEnd);
2293
+ }
2294
+ else if (_this.isPosterElement(target)) {
2295
+ _this.LGel.trigger(lGEvents.posterClick);
2296
+ }
2297
+ // Prevent execution on click
2298
+ if (isDraging) {
2299
+ isDraging = false;
2300
+ _this.outer.removeClass('lg-grabbing').addClass('lg-grab');
2301
+ }
2302
+ });
2303
+ }
2304
+ };
2305
+ LightGallery.prototype.triggerPosterClick = function () {
2306
+ var _this = this;
2307
+ this.$inner.on('click.lg', function (event) {
2308
+ if (!_this.dragOrSwipeEnabled &&
2309
+ _this.isPosterElement($LG(event.target))) {
2310
+ _this.LGel.trigger(lGEvents.posterClick);
2311
+ }
2312
+ });
2313
+ };
2314
+ LightGallery.prototype.manageSwipeClass = function () {
2315
+ var _touchNext = this.index + 1;
2316
+ var _touchPrev = this.index - 1;
2317
+ if (this.settings.loop && this.galleryItems.length > 2) {
2318
+ if (this.index === 0) {
2319
+ _touchPrev = this.galleryItems.length - 1;
2320
+ }
2321
+ else if (this.index === this.galleryItems.length - 1) {
2322
+ _touchNext = 0;
2323
+ }
2324
+ }
2325
+ this.outer.find('.lg-item').removeClass('lg-next-slide lg-prev-slide');
2326
+ if (_touchPrev > -1) {
2327
+ this.getSlideItem(_touchPrev).addClass('lg-prev-slide');
2328
+ }
2329
+ this.getSlideItem(_touchNext).addClass('lg-next-slide');
2330
+ };
2331
+ /**
2332
+ * Go to next slide
2333
+ * @param {Boolean} fromTouch - true if slide function called via touch event
2334
+ * @category lGPublicMethods
2335
+ * @example
2336
+ * const plugin = lightGallery();
2337
+ * plugin.goToNextSlide();
2338
+ * @see <a href="/demos/methods/">Demo</a>
2339
+ */
2340
+ LightGallery.prototype.goToNextSlide = function (fromTouch) {
2341
+ var _this = this;
2342
+ var _loop = this.settings.loop;
2343
+ if (fromTouch && this.galleryItems.length < 3) {
2344
+ _loop = false;
2345
+ }
2346
+ if (!this.lgBusy) {
2347
+ if (this.index + 1 < this.galleryItems.length) {
2348
+ this.index++;
2349
+ this.LGel.trigger(lGEvents.beforeNextSlide, {
2350
+ index: this.index,
2351
+ });
2352
+ this.slide(this.index, !!fromTouch, false, 'next');
2353
+ }
2354
+ else {
2355
+ if (_loop) {
2356
+ this.index = 0;
2357
+ this.LGel.trigger(lGEvents.beforeNextSlide, {
2358
+ index: this.index,
2359
+ });
2360
+ this.slide(this.index, !!fromTouch, false, 'next');
2361
+ }
2362
+ else if (this.settings.slideEndAnimation && !fromTouch) {
2363
+ this.outer.addClass('lg-right-end');
2364
+ setTimeout(function () {
2365
+ _this.outer.removeClass('lg-right-end');
2366
+ }, 400);
2367
+ }
2368
+ }
2369
+ }
2370
+ };
2371
+ /**
2372
+ * Go to previous slides
2373
+ * @param {Boolean} fromTouch - true if slide function called via touch event
2374
+ * @category lGPublicMethods
2375
+ * @example
2376
+ * const plugin = lightGallery({});
2377
+ * plugin.goToPrevSlide();
2378
+ * @see <a href="/demos/methods/">Demo</a>
2379
+ *
2380
+ */
2381
+ LightGallery.prototype.goToPrevSlide = function (fromTouch) {
2382
+ var _this = this;
2383
+ var _loop = this.settings.loop;
2384
+ if (fromTouch && this.galleryItems.length < 3) {
2385
+ _loop = false;
2386
+ }
2387
+ if (!this.lgBusy) {
2388
+ if (this.index > 0) {
2389
+ this.index--;
2390
+ this.LGel.trigger(lGEvents.beforePrevSlide, {
2391
+ index: this.index,
2392
+ fromTouch: fromTouch,
2393
+ });
2394
+ this.slide(this.index, !!fromTouch, false, 'prev');
2395
+ }
2396
+ else {
2397
+ if (_loop) {
2398
+ this.index = this.galleryItems.length - 1;
2399
+ this.LGel.trigger(lGEvents.beforePrevSlide, {
2400
+ index: this.index,
2401
+ fromTouch: fromTouch,
2402
+ });
2403
+ this.slide(this.index, !!fromTouch, false, 'prev');
2404
+ }
2405
+ else if (this.settings.slideEndAnimation && !fromTouch) {
2406
+ this.outer.addClass('lg-left-end');
2407
+ setTimeout(function () {
2408
+ _this.outer.removeClass('lg-left-end');
2409
+ }, 400);
2410
+ }
2411
+ }
2412
+ }
2413
+ };
2414
+ LightGallery.prototype.keyPress = function () {
2415
+ var _this = this;
2416
+ $LG(window).on("keydown.lg.global" + this.lgId, function (e) {
2417
+ if (_this.lgOpened &&
2418
+ _this.settings.escKey === true &&
2419
+ e.keyCode === 27) {
2420
+ e.preventDefault();
2421
+ if (_this.settings.allowMediaOverlap &&
2422
+ _this.outer.hasClass('lg-can-toggle') &&
2423
+ _this.outer.hasClass('lg-components-open')) {
2424
+ _this.outer.removeClass('lg-components-open');
2425
+ }
2426
+ else {
2427
+ _this.closeGallery();
2428
+ }
2429
+ }
2430
+ if (_this.lgOpened && _this.galleryItems.length > 1) {
2431
+ if (e.keyCode === 37) {
2432
+ e.preventDefault();
2433
+ _this.goToPrevSlide();
2434
+ }
2435
+ if (e.keyCode === 39) {
2436
+ e.preventDefault();
2437
+ _this.goToNextSlide();
2438
+ }
2439
+ }
2440
+ });
2441
+ };
2442
+ LightGallery.prototype.arrow = function () {
2443
+ var _this = this;
2444
+ this.getElementById('lg-prev').on('click.lg', function () {
2445
+ _this.goToPrevSlide();
2446
+ });
2447
+ this.getElementById('lg-next').on('click.lg', function () {
2448
+ _this.goToNextSlide();
2449
+ });
2450
+ };
2451
+ LightGallery.prototype.arrowDisable = function (index) {
2452
+ // Disable arrows if settings.hideControlOnEnd is true
2453
+ if (!this.settings.loop && this.settings.hideControlOnEnd) {
2454
+ var $prev = this.getElementById('lg-prev');
2455
+ var $next = this.getElementById('lg-next');
2456
+ if (index + 1 === this.galleryItems.length) {
2457
+ $next.attr('disabled', 'disabled').addClass('disabled');
2458
+ }
2459
+ else {
2460
+ $next.removeAttr('disabled').removeClass('disabled');
2461
+ }
2462
+ if (index === 0) {
2463
+ $prev.attr('disabled', 'disabled').addClass('disabled');
2464
+ }
2465
+ else {
2466
+ $prev.removeAttr('disabled').removeClass('disabled');
2467
+ }
2468
+ }
2469
+ };
2470
+ LightGallery.prototype.setTranslate = function ($el, xValue, yValue, scaleX, scaleY) {
2471
+ if (scaleX === void 0) { scaleX = 1; }
2472
+ if (scaleY === void 0) { scaleY = 1; }
2473
+ $el.css('transform', 'translate3d(' +
2474
+ xValue +
2475
+ 'px, ' +
2476
+ yValue +
2477
+ 'px, 0px) scale3d(' +
2478
+ scaleX +
2479
+ ', ' +
2480
+ scaleY +
2481
+ ', 1)');
2482
+ };
2483
+ LightGallery.prototype.mousewheel = function () {
2484
+ var _this = this;
2485
+ var lastCall = 0;
2486
+ this.outer.on('wheel.lg', function (e) {
2487
+ if (!e.deltaY || _this.galleryItems.length < 2) {
2488
+ return;
2489
+ }
2490
+ e.preventDefault();
2491
+ var now = new Date().getTime();
2492
+ if (now - lastCall < 1000) {
2493
+ return;
2494
+ }
2495
+ lastCall = now;
2496
+ if (e.deltaY > 0) {
2497
+ _this.goToNextSlide();
2498
+ }
2499
+ else if (e.deltaY < 0) {
2500
+ _this.goToPrevSlide();
2501
+ }
2502
+ });
2503
+ };
2504
+ LightGallery.prototype.isSlideElement = function (target) {
2505
+ return (target.hasClass('lg-outer') ||
2506
+ target.hasClass('lg-item') ||
2507
+ target.hasClass('lg-img-wrap'));
2508
+ };
2509
+ LightGallery.prototype.isPosterElement = function (target) {
2510
+ var playButton = this.getSlideItem(this.index)
2511
+ .find('.lg-video-play-button')
2512
+ .get();
2513
+ return (target.hasClass('lg-video-poster') ||
2514
+ target.hasClass('lg-video-play-button') ||
2515
+ (playButton && playButton.contains(target.get())));
2516
+ };
2517
+ /**
2518
+ * Maximize minimize inline gallery.
2519
+ * @category lGPublicMethods
2520
+ */
2521
+ LightGallery.prototype.toggleMaximize = function () {
2522
+ var _this = this;
2523
+ this.getElementById('lg-maximize').on('click.lg', function () {
2524
+ _this.$container.toggleClass('lg-inline');
2525
+ _this.refreshOnResize();
2526
+ });
2527
+ };
2528
+ LightGallery.prototype.invalidateItems = function () {
2529
+ for (var index = 0; index < this.items.length; index++) {
2530
+ var element = this.items[index];
2531
+ var $element = $LG(element);
2532
+ $element.off("click.lgcustom-item-" + $element.attr('data-lg-id'));
2533
+ }
2534
+ };
2535
+ LightGallery.prototype.trapFocus = function () {
2536
+ var _this = this;
2537
+ this.$container.get().focus({
2538
+ preventScroll: true,
2539
+ });
2540
+ $LG(window).on("keydown.lg.global" + this.lgId, function (e) {
2541
+ if (!_this.lgOpened) {
2542
+ return;
2543
+ }
2544
+ var isTabPressed = e.key === 'Tab' || e.keyCode === 9;
2545
+ if (!isTabPressed) {
2546
+ return;
2547
+ }
2548
+ var focusableEls = utils.getFocusableElements(_this.$container.get());
2549
+ var firstFocusableEl = focusableEls[0];
2550
+ var lastFocusableEl = focusableEls[focusableEls.length - 1];
2551
+ if (e.shiftKey) {
2552
+ if (document.activeElement === firstFocusableEl) {
2553
+ lastFocusableEl.focus();
2554
+ e.preventDefault();
2555
+ }
2556
+ }
2557
+ else {
2558
+ if (document.activeElement === lastFocusableEl) {
2559
+ firstFocusableEl.focus();
2560
+ e.preventDefault();
2561
+ }
2562
+ }
2563
+ });
2564
+ };
2565
+ LightGallery.prototype.manageCloseGallery = function () {
2566
+ var _this = this;
2567
+ if (!this.settings.closable)
2568
+ return;
2569
+ var mousedown = false;
2570
+ this.getElementById('lg-close').on('click.lg', function () {
2571
+ _this.closeGallery();
2572
+ });
2573
+ if (this.settings.closeOnTap) {
2574
+ // If you drag the slide and release outside gallery gets close on chrome
2575
+ // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer
2576
+ this.outer.on('mousedown.lg', function (e) {
2577
+ var target = $LG(e.target);
2578
+ if (_this.isSlideElement(target)) {
2579
+ mousedown = true;
2580
+ }
2581
+ else {
2582
+ mousedown = false;
2583
+ }
2584
+ });
2585
+ this.outer.on('mousemove.lg', function () {
2586
+ mousedown = false;
2587
+ });
2588
+ this.outer.on('mouseup.lg', function (e) {
2589
+ var target = $LG(e.target);
2590
+ if (_this.isSlideElement(target) && mousedown) {
2591
+ if (!_this.outer.hasClass('lg-dragging')) {
2592
+ _this.closeGallery();
2593
+ }
2594
+ }
2595
+ });
2596
+ }
2597
+ };
2598
+ /**
2599
+ * Close lightGallery if it is opened.
2600
+ *
2601
+ * @description If closable is false in the settings, you need to pass true via closeGallery method to force close gallery
2602
+ * @return returns the estimated time to close gallery completely including the close animation duration
2603
+ * @category lGPublicMethods
2604
+ * @example
2605
+ * const plugin = lightGallery();
2606
+ * plugin.closeGallery();
2607
+ *
2608
+ */
2609
+ LightGallery.prototype.closeGallery = function (force) {
2610
+ var _this = this;
2611
+ if (!this.lgOpened || (!this.settings.closable && !force)) {
2612
+ return 0;
2613
+ }
2614
+ this.LGel.trigger(lGEvents.beforeClose);
2615
+ if (this.settings.resetScrollPosition && !this.settings.hideScrollbar) {
2616
+ $LG(window).scrollTop(this.prevScrollTop);
2617
+ }
2618
+ var currentItem = this.items[this.index];
2619
+ var transform;
2620
+ if (this.zoomFromOrigin && currentItem) {
2621
+ var _a = this.mediaContainerPosition, top_4 = _a.top, bottom = _a.bottom;
2622
+ var _b = this.galleryItems[this.index], __slideVideoInfo = _b.__slideVideoInfo, poster = _b.poster;
2623
+ var imageSize = utils.getSize(currentItem, this.outer, top_4 + bottom, __slideVideoInfo && poster && this.settings.videoMaxSize);
2624
+ transform = utils.getTransform(currentItem, this.outer, top_4, bottom, imageSize);
2625
+ }
2626
+ if (this.zoomFromOrigin && transform) {
2627
+ this.outer.addClass('lg-closing lg-zoom-from-image');
2628
+ this.getSlideItem(this.index)
2629
+ .addClass('lg-start-end-progress')
2630
+ .css('transition-duration', this.settings.startAnimationDuration + 'ms')
2631
+ .css('transform', transform);
2632
+ }
2633
+ else {
2634
+ this.outer.addClass('lg-hide-items');
2635
+ // lg-zoom-from-image is used for setting the opacity to 1 if zoomFromOrigin is true
2636
+ // If the closing item doesn't have the lg-size attribute, remove this class to avoid the closing css conflicts
2637
+ this.outer.removeClass('lg-zoom-from-image');
2638
+ }
2639
+ // Unbind all events added by lightGallery
2640
+ // @todo
2641
+ //this.$el.off('.lg.tm');
2642
+ this.destroyModules();
2643
+ this.lGalleryOn = false;
2644
+ this.isDummyImageRemoved = false;
2645
+ this.zoomFromOrigin = this.settings.zoomFromOrigin;
2646
+ clearTimeout(this.hideBarTimeout);
2647
+ this.hideBarTimeout = false;
2648
+ $LG('html').removeClass('lg-on');
2649
+ this.outer.removeClass('lg-visible lg-components-open');
2650
+ // Resetting opacity to 0 isd required as vertical swipe to close function adds inline opacity.
2651
+ this.$backdrop.removeClass('in').css('opacity', 0);
2652
+ var removeTimeout = this.zoomFromOrigin && transform
2653
+ ? Math.max(this.settings.startAnimationDuration, this.settings.backdropDuration)
2654
+ : this.settings.backdropDuration;
2655
+ this.$container.removeClass('lg-show-in');
2656
+ // Once the closign animation is completed and gallery is invisible
2657
+ setTimeout(function () {
2658
+ if (_this.zoomFromOrigin && transform) {
2659
+ _this.outer.removeClass('lg-zoom-from-image');
2660
+ }
2661
+ _this.$container.removeClass('lg-show');
2662
+ // Reset scrollbar
2663
+ _this.resetScrollBar();
2664
+ // Need to remove inline opacity as it is used in the stylesheet as well
2665
+ _this.$backdrop
2666
+ .removeAttr('style')
2667
+ .css('transition-duration', _this.settings.backdropDuration + 'ms');
2668
+ _this.outer.removeClass("lg-closing " + _this.settings.startClass);
2669
+ _this.getSlideItem(_this.index).removeClass('lg-start-end-progress');
2670
+ _this.$inner.empty();
2671
+ if (_this.lgOpened) {
2672
+ _this.LGel.trigger(lGEvents.afterClose, {
2673
+ instance: _this,
2674
+ });
2675
+ }
2676
+ if (_this.$container.get()) {
2677
+ _this.$container.get().blur();
2678
+ }
2679
+ _this.lgOpened = false;
2680
+ }, removeTimeout + 100);
2681
+ return removeTimeout + 100;
2682
+ };
2683
+ LightGallery.prototype.initModules = function () {
2684
+ this.plugins.forEach(function (module) {
2685
+ try {
2686
+ module.init();
2687
+ }
2688
+ catch (err) {
2689
+ console.warn("lightGallery:- make sure lightGallery module is properly initiated");
2690
+ }
2691
+ });
2692
+ };
2693
+ LightGallery.prototype.destroyModules = function (destroy) {
2694
+ this.plugins.forEach(function (module) {
2695
+ try {
2696
+ if (destroy) {
2697
+ module.destroy();
2698
+ }
2699
+ else {
2700
+ module.closeGallery && module.closeGallery();
2701
+ }
2702
+ }
2703
+ catch (err) {
2704
+ console.warn("lightGallery:- make sure lightGallery module is properly destroyed");
2705
+ }
2706
+ });
2707
+ };
2708
+ /**
2709
+ * Refresh lightGallery with new set of children.
2710
+ *
2711
+ * @description This is useful to update the gallery when the child elements are changed without calling destroy method.
2712
+ *
2713
+ * If you are using dynamic mode, you can pass the modified array of dynamicEl as the first parameter to refresh the dynamic gallery
2714
+ * @see <a href="/demos/dynamic-mode/">Demo</a>
2715
+ * @category lGPublicMethods
2716
+ * @example
2717
+ * const plugin = lightGallery();
2718
+ * // Delete or add children, then call
2719
+ * plugin.refresh();
2720
+ *
2721
+ */
2722
+ LightGallery.prototype.refresh = function (galleryItems) {
2723
+ if (!this.settings.dynamic) {
2724
+ this.invalidateItems();
2725
+ }
2726
+ if (galleryItems) {
2727
+ this.galleryItems = galleryItems;
2728
+ }
2729
+ else {
2730
+ this.galleryItems = this.getItems();
2731
+ }
2732
+ this.updateControls();
2733
+ this.openGalleryOnItemClick();
2734
+ this.LGel.trigger(lGEvents.updateSlides);
2735
+ };
2736
+ LightGallery.prototype.updateControls = function () {
2737
+ this.addSlideVideoInfo(this.galleryItems);
2738
+ this.updateCounterTotal();
2739
+ this.manageSingleSlideClassName();
2740
+ };
2741
+ LightGallery.prototype.destroyGallery = function () {
2742
+ this.destroyModules(true);
2743
+ if (!this.settings.dynamic) {
2744
+ this.invalidateItems();
2745
+ }
2746
+ $LG(window).off(".lg.global" + this.lgId);
2747
+ this.LGel.off('.lg');
2748
+ this.$container.remove();
2749
+ };
2750
+ /**
2751
+ * Destroy lightGallery.
2752
+ * Destroy lightGallery and its plugin instances completely
2753
+ *
2754
+ * @description This method also calls CloseGallery function internally. Returns the time takes to completely close and destroy the instance.
2755
+ * In case if you want to re-initialize lightGallery right after destroying it, initialize it only once the destroy process is completed.
2756
+ * You can use refresh method most of the times.
2757
+ * @category lGPublicMethods
2758
+ * @example
2759
+ * const plugin = lightGallery();
2760
+ * plugin.destroy();
2761
+ *
2762
+ */
2763
+ LightGallery.prototype.destroy = function () {
2764
+ var closeTimeout = this.closeGallery(true);
2765
+ if (closeTimeout) {
2766
+ setTimeout(this.destroyGallery.bind(this), closeTimeout);
2767
+ }
2768
+ else {
2769
+ this.destroyGallery();
2770
+ }
2771
+ return closeTimeout;
2772
+ };
2773
+ return LightGallery;
2774
+ }());
2775
+
2776
+ function lightGallery(el, options) {
2777
+ return new LightGallery(el, options);
2778
+ }
2779
+
2780
+ return lightGallery;
2781
+
2782
+ })));