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