lightgallery 2.9.0 → 3.0.0-beta.2

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