j1-template 2024.3.23 → 2024.3.24

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 (199) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/gallery_app.html +102 -14
  3. data/assets/theme/j1/adapter/js/gallery.js +13 -2
  4. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +29 -0
  5. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  6. data/assets/theme/j1/core/css/vendor.css +1 -1
  7. data/assets/theme/j1/core/css/vendor.min.css +1 -1
  8. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +36 -17
  9. data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +1 -8
  10. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +423 -297
  11. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +1 -8
  12. data/assets/theme/j1/modules/rtable/css/theme/uno/rtable.css +11 -1
  13. data/assets/theme/j1/modules/videojs/css/themes/uno.css +41 -29
  14. data/assets/theme/j1/modules/videojs/css/themes/uno.min.css +1 -1
  15. data/assets/theme/j1/modules/videojs/plugins/controls/aspect-ratio-panel/!examples/index.html +4 -9
  16. data/assets/theme/j1/modules/videojs/plugins/controls/hotkeys/!examples/example.html +1 -1
  17. data/assets/theme/j1/modules/videojs/plugins/controls/persist-settings/!examples/index.html +3 -7
  18. data/assets/theme/j1/modules/videojs/plugins/controls/playbackrate-adjuster/!examples/index.html +3 -8
  19. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-controls.html +4 -4
  20. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-javascript.html +3 -3
  21. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-playlist.html +3 -3
  22. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/global-parameters.html +3 -3
  23. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/simple.html +15 -4
  24. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/switch.html +3 -3
  25. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/index.html +3 -3
  26. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/player/index.html +3 -3
  27. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/global-parameters.html +5 -5
  28. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/simple.html +5 -5
  29. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/switch.html +5 -5
  30. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-controls.html +5 -5
  31. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-javascript.html +5 -5
  32. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-list.html +5 -5
  33. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-playlist.html +5 -5
  34. data/lib/j1/version.rb +1 -1
  35. data/lib/starter_web/README.md +5 -5
  36. data/lib/starter_web/_config.yml +1 -1
  37. data/lib/starter_web/_data/blocks/banner.yml +2 -2
  38. data/lib/starter_web/_data/modules/attics.yml +11 -0
  39. data/lib/starter_web/_data/modules/carousel.yml +1 -1
  40. data/lib/starter_web/_data/modules/defaults/masonry.yml +115 -22
  41. data/lib/starter_web/_data/modules/gallery.yml +163 -215
  42. data/lib/starter_web/_data/modules/masonry.yml +6 -0
  43. data/lib/starter_web/_data/templates/feed.xml +1 -1
  44. data/lib/starter_web/_includes/attributes.asciidoc +7 -0
  45. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  46. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-redl.jpg +0 -0
  47. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-shatov.jpg +0 -0
  48. data/lib/starter_web/assets/image/module/attic/1920x1280/alexey-ruban.jpg +0 -0
  49. data/lib/starter_web/assets/image/module/attic/1920x1280/andrea-badino.jpg +0 -0
  50. data/lib/starter_web/assets/image/module/attic/1920x1280/bootstrap-modal.jpg +0 -0
  51. data/lib/starter_web/assets/image/module/attic/1920x1280/bp-miller.jpg +0 -0
  52. data/lib/starter_web/assets/image/module/attic/1920x1280/brad-neathery.jpg +0 -0
  53. data/lib/starter_web/assets/image/module/attic/1920x1280/brigitta-schneiter.jpg +0 -0
  54. data/lib/starter_web/assets/image/module/attic/1920x1280/build-with-gemini.jpg +0 -0
  55. data/lib/starter_web/assets/image/module/attic/1920x1280/clem-onojeghuo.jpg +0 -0
  56. data/lib/starter_web/assets/image/module/attic/1920x1280/crawford-jolly.jpg +0 -0
  57. data/lib/starter_web/assets/image/module/attic/1920x1280/eleni-afiontzi.jpg +0 -0
  58. data/lib/starter_web/assets/image/module/attic/1920x1280/fly-d.jpg +0 -0
  59. data/lib/starter_web/assets/image/module/attic/1920x1280/guillaume-bolduc.jpg +0 -0
  60. data/lib/starter_web/assets/image/module/attic/1920x1280/ideas-start-here-1920x1280.jpg +0 -0
  61. data/lib/starter_web/assets/image/module/attic/1920x1280/isaac-davis.jpg +0 -0
  62. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-2.jpg +0 -0
  63. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-3.jpg +0 -0
  64. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-starter-mockup-1.jpg +0 -0
  65. data/lib/starter_web/assets/image/module/attic/1920x1280/john-schnobrich-2.jpg +0 -0
  66. data/lib/starter_web/assets/image/module/attic/1920x1280/josep-martins.jpg +0 -0
  67. data/lib/starter_web/assets/image/module/attic/1920x1280/josh-liu.jpg +0 -0
  68. data/lib/starter_web/assets/image/module/attic/1920x1280/kelly-sikkemal.jpg +0 -0
  69. data/lib/starter_web/assets/image/module/attic/1920x1280/kira-auf-der-heide.jpg +0 -0
  70. data/lib/starter_web/assets/image/module/attic/1920x1280/kristopher-roller.jpg +0 -0
  71. data/lib/starter_web/assets/image/module/attic/1920x1280/markus-spiske.jpg +0 -0
  72. data/lib/starter_web/assets/image/module/attic/1920x1280/martin-sanchez.jpg +0 -0
  73. data/lib/starter_web/assets/image/module/attic/1920x1280/material_symbols.jpg +0 -0
  74. data/lib/starter_web/assets/image/module/attic/1920x1280/matthaeus.jpg +0 -0
  75. data/lib/starter_web/assets/image/module/attic/1920x1280/melanie-deziel.jpg +0 -0
  76. data/lib/starter_web/assets/image/module/attic/1920x1280/milad-fakurian.jpg +0 -0
  77. data/lib/starter_web/assets/image/module/attic/1920x1280/mohammad-rahmani.jpg +0 -0
  78. data/lib/starter_web/assets/image/module/attic/1920x1280/nasa.jpg +0 -0
  79. data/lib/starter_web/assets/image/module/attic/1920x1280/quino-al-2.jpg +0 -0
  80. data/lib/starter_web/assets/image/module/attic/1920x1280/stories-ink-tattoo-care.jpg +0 -0
  81. data/lib/starter_web/assets/image/module/attic/1920x1280/towfiqu-barbhuiya.jpg +0 -0
  82. data/lib/starter_web/assets/image/page/tour/bootswatch-themes.jpg +0 -0
  83. data/lib/starter_web/index.html +3 -2
  84. data/lib/starter_web/package.json +1 -1
  85. data/lib/starter_web/pages/public/panels/intro_panel/_includes/attributes.asciidoc +1 -1
  86. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +5 -5
  87. data/lib/starter_web/pages/public/tools/tester/app_tester_amplitudejs_yt.adoc +7 -3
  88. data/lib/starter_web/pages/public/tools/tester/app_tester_swiperjs.adoc +7 -3
  89. data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +18 -3
  90. data/lib/starter_web/pages/public/tour/_includes/attributes.asciidoc +1 -2
  91. data/lib/starter_web/pages/public/tour/_includes/documents/themes_bootstrap.asciidoc +1 -1
  92. data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +7 -3
  93. data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +62 -7
  94. data/lib/starter_web/pages/public/tour/icon_fonts.adoc +4 -8
  95. data/lib/starter_web/pages/public/tour/modal_extentions.adoc +2 -2
  96. data/lib/starter_web/pages/public/tour/responsive_tables.adoc +21 -15
  97. data/lib/starter_web/pages/public/tour/typography.adoc +5 -5
  98. data/lib/starter_web/pages/public/tour/video_data.adoc +24 -5
  99. metadata +11 -102
  100. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lg-transitions.css +0 -984
  101. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lg-transitions.min.css +0 -26
  102. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lightgallery-bundle.css +0 -1627
  103. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/lightgallery-bundle.min.css +0 -25
  104. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/animation-w.png +0 -0
  105. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/customize-w.png +0 -0
  106. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/dynamic-w.png +0 -0
  107. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/facebook-icon.svg +0 -10
  108. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/googleplus-icon.svg +0 -30
  109. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/html5-w.png +0 -0
  110. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/linked-in.png +0 -0
  111. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/module-w.png +0 -0
  112. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/play-button-hover.svg +0 -94
  113. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/play-button.png +0 -0
  114. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/play-button.svg +0 -93
  115. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/responsive-w.png +0 -0
  116. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/thumb-w.png +0 -0
  117. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/touch-w.png +0 -0
  118. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/twitter-icon.svg +0 -15
  119. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/twitter.png +0 -0
  120. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/video1-w.png +0 -0
  121. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/zoom-w.png +0 -0
  122. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/icons/zoom.png +0 -0
  123. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/uno.css +0 -140
  124. data/assets/theme/j1/modules/lightGallery/!v2.7.2/css/themes/uno/uno.min.css +0 -19
  125. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.svg +0 -54
  126. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.ttf +0 -0
  127. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.woff +0 -0
  128. data/assets/theme/j1/modules/lightGallery/!v2.7.2/fonts/lg.woff2 +0 -0
  129. data/assets/theme/j1/modules/lightGallery/!v2.7.2/images/loading.gif +0 -0
  130. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/loading.gif +0 -0
  131. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/video-play.png +0 -0
  132. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/vimeo-play.png +0 -0
  133. data/assets/theme/j1/modules/lightGallery/!v2.7.2/img/youtube-play.png +0 -0
  134. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/lightgallery.js +0 -2782
  135. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/lightgallery.min.js +0 -26
  136. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/LICENSE.md +0 -44
  137. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/README.md +0 -37
  138. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/parser.js +0 -890
  139. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/parser/webvtt/parser.min.js +0 -8
  140. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/j1/j1-video.js +0 -402
  141. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/j1/j1-video.min.js +0 -7
  142. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/j1/lg-video.1.js +0 -585
  143. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-autoplay.js +0 -275
  144. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-autoplay.min.js +0 -26
  145. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-comment.js +0 -230
  146. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-comment.min.js +0 -26
  147. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-fullscreen.js +0 -160
  148. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-fullscreen.min.js +0 -26
  149. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-hash.js +0 -223
  150. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-hash.min.js +0 -27
  151. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-medium-zoom.js +0 -157
  152. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-medium-zoom.min.js +0 -26
  153. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-pager.js +0 -164
  154. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-pager.min.js +0 -26
  155. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-rotate.js +0 -299
  156. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-rotate.min.js +0 -26
  157. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-share.js +0 -244
  158. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-share.min.js +0 -27
  159. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-thumbnail.js +0 -509
  160. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-thumbnail.min.js +0 -26
  161. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-video.js +0 -909
  162. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-video.min.js +0 -26
  163. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-vimeo-thumbnail.js +0 -207
  164. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-vimeo-thumbnail.min.js +0 -26
  165. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-zoom.js +0 -999
  166. data/assets/theme/j1/modules/lightGallery/!v2.7.2/js/plugins/lg-zoom.min.js +0 -26
  167. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-thumbnail.0.js +0 -495
  168. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-thumbnail.1.js +0 -513
  169. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.0.js +0 -553
  170. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.1.js +0 -585
  171. data/assets/theme/j1/modules/lightGallery/js/plugins/j1/lg-video.2.js +0 -914
  172. data/assets/theme/j1/modules/videojs/!v8.12.0/css/font/README.md +0 -151
  173. data/assets/theme/j1/modules/videojs/!v8.12.0/css/font/VideoJS.svg +0 -150
  174. data/assets/theme/j1/modules/videojs/!v8.12.0/css/font/video-js-cdn.css +0 -2012
  175. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/city.css +0 -147
  176. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/city.min.css +0 -5
  177. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/fantasy.css +0 -113
  178. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/fantasy.min.css +0 -5
  179. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/forest.css +0 -166
  180. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/forest.min.css +0 -5
  181. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/sea.css +0 -72
  182. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/sea.min.css +0 -5
  183. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/uno.css +0 -311
  184. data/assets/theme/j1/modules/videojs/!v8.12.0/css/themes/uno.min.css +0 -19
  185. data/assets/theme/j1/modules/videojs/!v8.12.0/css/videojs.css +0 -1686
  186. data/assets/theme/j1/modules/videojs/!v8.12.0/css/videojs.min.css +0 -13
  187. data/assets/theme/j1/modules/videojs/!v8.12.0/js/video.js +0 -65226
  188. data/assets/theme/j1/modules/videojs/!v8.12.0/js/video.min.js +0 -55
  189. data/lib/starter_web/_data/modules/gallery_app.yml +0 -1002
  190. data/lib/starter_web/_data/modules/gallery_playlists.yml +0 -534
  191. data/lib/starter_web/assets/image/module/attic/1920x1280/alina-grubnyak.jpg +0 -0
  192. data/lib/starter_web/assets/image/module/attic/1920x1280/bruno-figueiredo.jpg +0 -0
  193. data/lib/starter_web/assets/image/module/attic/1920x1280/harpal-singh.jpg +0 -0
  194. data/lib/starter_web/assets/image/module/attic/1920x1280/hayden-mills-2.jpg +0 -0
  195. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-1.jpg +0 -0
  196. data/lib/starter_web/assets/image/module/attic/1920x1280/recha-oktaviani.jpg +0 -0
  197. data/lib/starter_web/assets/image/module/attic/1920x1280/tiny_desk.jpg +0 -0
  198. data/lib/starter_web/assets/image/module/attic/ideas-start-here-1920x1280-bw.jpg +0 -0
  199. data/lib/starter_web/assets/image/module/attic/ideas-start-here-1920x1280.jpg +0 -0
@@ -1,999 +0,0 @@
1
- /*
2
- # -----------------------------------------------------------------------------
3
- # ~/assets/theme/j1/modules/lightGallery/js/plugins/lg-zoom.js
4
- # Provides lightGallery JS code for the plugin lgZoom
5
- #
6
- # Product/Info:
7
- # https://jekyll.one
8
- #
9
- # Copyright (C) 2025 Sachin Neravath
10
- # Copyright (C) 2023-2025 Juergen Adams
11
- #
12
- # J1 Template is licensed under the MIT License.
13
- # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
14
- # lightGallery is licensed under the GPLv3 license
15
- # See: https://github.com/sachinchoolur/lightGallery/blob/master/LICENSE
16
- # -----------------------------------------------------------------------------
17
- */
18
-
19
- /*!
20
- * lightgallery | 2.7.2 | September 20th 2023
21
- * http://www.lightgalleryjs.com/
22
- * Copyright (c) 2020 Sachin Neravath;
23
- * @license GPLv3
24
- */
25
-
26
- (function (global, factory) {
27
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
28
- typeof define === 'function' && define.amd ? define(factory) :
29
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.lgZoom = factory());
30
- }(this, (function () { 'use strict';
31
-
32
- /*! *****************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
-
47
- var __assign = function() {
48
- __assign = Object.assign || function __assign(t) {
49
- for (var s, i = 1, n = arguments.length; i < n; i++) {
50
- s = arguments[i];
51
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
52
- }
53
- return t;
54
- };
55
- return __assign.apply(this, arguments);
56
- };
57
-
58
- var zoomSettings = {
59
- scale: 1,
60
- zoom: true,
61
- infiniteZoom: true,
62
- actualSize: true,
63
- showZoomInOutIcons: false,
64
- actualSizeIcons: {
65
- zoomIn: 'lg-zoom-in',
66
- zoomOut: 'lg-zoom-out',
67
- },
68
- enableZoomAfter: 300,
69
- zoomPluginStrings: {
70
- zoomIn: 'Zoom in',
71
- zoomOut: 'Zoom out',
72
- viewActualSize: 'View actual size',
73
- },
74
- };
75
-
76
- /**
77
- * List of lightGallery events
78
- * All events should be documented here
79
- * Below interfaces are used to build the website documentations
80
- * */
81
- var lGEvents = {
82
- afterAppendSlide: 'lgAfterAppendSlide',
83
- init: 'lgInit',
84
- hasVideo: 'lgHasVideo',
85
- containerResize: 'lgContainerResize',
86
- updateSlides: 'lgUpdateSlides',
87
- afterAppendSubHtml: 'lgAfterAppendSubHtml',
88
- beforeOpen: 'lgBeforeOpen',
89
- afterOpen: 'lgAfterOpen',
90
- slideItemLoad: 'lgSlideItemLoad',
91
- beforeSlide: 'lgBeforeSlide',
92
- afterSlide: 'lgAfterSlide',
93
- posterClick: 'lgPosterClick',
94
- dragStart: 'lgDragStart',
95
- dragMove: 'lgDragMove',
96
- dragEnd: 'lgDragEnd',
97
- beforeNextSlide: 'lgBeforeNextSlide',
98
- beforePrevSlide: 'lgBeforePrevSlide',
99
- beforeClose: 'lgBeforeClose',
100
- afterClose: 'lgAfterClose',
101
- rotateLeft: 'lgRotateLeft',
102
- rotateRight: 'lgRotateRight',
103
- flipHorizontal: 'lgFlipHorizontal',
104
- flipVertical: 'lgFlipVertical',
105
- autoplay: 'lgAutoplay',
106
- autoplayStart: 'lgAutoplayStart',
107
- autoplayStop: 'lgAutoplayStop',
108
- };
109
-
110
- var ZOOM_TRANSITION_DURATION = 500;
111
- var Zoom = /** @class */ (function () {
112
- function Zoom(instance, $LG) {
113
- // get lightGallery core plugin instance
114
- this.core = instance;
115
- this.$LG = $LG;
116
- this.settings = __assign(__assign({}, zoomSettings), this.core.settings);
117
- return this;
118
- }
119
- // Append Zoom controls. Actual size, Zoom-in, Zoom-out
120
- Zoom.prototype.buildTemplates = function () {
121
- var zoomIcons = this.settings.showZoomInOutIcons
122
- ? "<button id=\"" + this.core.getIdName('lg-zoom-in') + "\" type=\"button\" aria-label=\"" + this.settings.zoomPluginStrings['zoomIn'] + "\" class=\"lg-zoom-in lg-icon\"></button><button id=\"" + this.core.getIdName('lg-zoom-out') + "\" type=\"button\" aria-label=\"" + this.settings.zoomPluginStrings['zoomIn'] + "\" class=\"lg-zoom-out lg-icon\"></button>"
123
- : '';
124
- if (this.settings.actualSize) {
125
- zoomIcons += "<button id=\"" + this.core.getIdName('lg-actual-size') + "\" type=\"button\" aria-label=\"" + this.settings.zoomPluginStrings['viewActualSize'] + "\" class=\"" + this.settings.actualSizeIcons.zoomIn + " lg-icon\"></button>";
126
- }
127
- this.core.outer.addClass('lg-use-transition-for-zoom');
128
- this.core.$toolbar.first().append(zoomIcons);
129
- };
130
- /**
131
- * @desc Enable zoom option only once the image is completely loaded
132
- * If zoomFromOrigin is true, Zoom is enabled once the dummy image has been inserted
133
- *
134
- * Zoom styles are defined under lg-zoomable CSS class.
135
- */
136
- Zoom.prototype.enableZoom = function (event) {
137
- var _this = this;
138
- // delay will be 0 except first time
139
- var _speed = this.settings.enableZoomAfter + event.detail.delay;
140
- // set _speed value 0 if gallery opened from direct url and if it is first slide
141
- if (this.$LG('body').first().hasClass('lg-from-hash') &&
142
- event.detail.delay) {
143
- // will execute only once
144
- _speed = 0;
145
- }
146
- else {
147
- // Remove lg-from-hash to enable starting animation.
148
- this.$LG('body').first().removeClass('lg-from-hash');
149
- }
150
- this.zoomableTimeout = setTimeout(function () {
151
- if (!_this.isImageSlide(_this.core.index)) {
152
- return;
153
- }
154
- _this.core.getSlideItem(event.detail.index).addClass('lg-zoomable');
155
- if (event.detail.index === _this.core.index) {
156
- _this.setZoomEssentials();
157
- }
158
- }, _speed + 30);
159
- };
160
- Zoom.prototype.enableZoomOnSlideItemLoad = function () {
161
- // Add zoomable class
162
- this.core.LGel.on(lGEvents.slideItemLoad + ".zoom", this.enableZoom.bind(this));
163
- };
164
- Zoom.prototype.getDragCords = function (e) {
165
- return {
166
- x: e.pageX,
167
- y: e.pageY,
168
- };
169
- };
170
- Zoom.prototype.getSwipeCords = function (e) {
171
- var x = e.touches[0].pageX;
172
- var y = e.touches[0].pageY;
173
- return {
174
- x: x,
175
- y: y,
176
- };
177
- };
178
- Zoom.prototype.getDragAllowedAxises = function (scale, scaleDiff) {
179
- var $image = this.core
180
- .getSlideItem(this.core.index)
181
- .find('.lg-image')
182
- .first()
183
- .get();
184
- var height = 0;
185
- var width = 0;
186
- var rect = $image.getBoundingClientRect();
187
- if (scale) {
188
- height = $image.offsetHeight * scale;
189
- width = $image.offsetWidth * scale;
190
- }
191
- else if (scaleDiff) {
192
- height = rect.height + scaleDiff * rect.height;
193
- width = rect.width + scaleDiff * rect.width;
194
- }
195
- else {
196
- height = rect.height;
197
- width = rect.width;
198
- }
199
- var allowY = height > this.containerRect.height;
200
- var allowX = width > this.containerRect.width;
201
- return {
202
- allowX: allowX,
203
- allowY: allowY,
204
- };
205
- };
206
- Zoom.prototype.setZoomEssentials = function () {
207
- this.containerRect = this.core.$content.get().getBoundingClientRect();
208
- };
209
- /**
210
- * @desc Image zoom
211
- * Translate the wrap and scale the image to get better user experience
212
- *
213
- * @param {String} scale - Zoom decrement/increment value
214
- */
215
- Zoom.prototype.zoomImage = function (scale, scaleDiff, reposition, resetToMax) {
216
- if (Math.abs(scaleDiff) <= 0)
217
- return;
218
- var offsetX = this.containerRect.width / 2 + this.containerRect.left;
219
- var offsetY = this.containerRect.height / 2 +
220
- this.containerRect.top +
221
- this.scrollTop;
222
- var originalX;
223
- var originalY;
224
- if (scale === 1) {
225
- this.positionChanged = false;
226
- }
227
- var dragAllowedAxises = this.getDragAllowedAxises(0, scaleDiff);
228
- var allowY = dragAllowedAxises.allowY, allowX = dragAllowedAxises.allowX;
229
- if (this.positionChanged) {
230
- originalX = this.left / (this.scale - scaleDiff);
231
- originalY = this.top / (this.scale - scaleDiff);
232
- this.pageX = offsetX - originalX;
233
- this.pageY = offsetY - originalY;
234
- this.positionChanged = false;
235
- }
236
- var possibleSwipeCords = this.getPossibleSwipeDragCords(scaleDiff);
237
- var x;
238
- var y;
239
- var _x = offsetX - this.pageX;
240
- var _y = offsetY - this.pageY;
241
- if (scale - scaleDiff > 1) {
242
- var scaleVal = (scale - scaleDiff) / Math.abs(scaleDiff);
243
- _x =
244
- (scaleDiff < 0 ? -_x : _x) +
245
- this.left * (scaleVal + (scaleDiff < 0 ? -1 : 1));
246
- _y =
247
- (scaleDiff < 0 ? -_y : _y) +
248
- this.top * (scaleVal + (scaleDiff < 0 ? -1 : 1));
249
- x = _x / scaleVal;
250
- y = _y / scaleVal;
251
- }
252
- else {
253
- var scaleVal = (scale - scaleDiff) * scaleDiff;
254
- x = _x * scaleVal;
255
- y = _y * scaleVal;
256
- }
257
- if (reposition) {
258
- if (allowX) {
259
- if (this.isBeyondPossibleLeft(x, possibleSwipeCords.minX)) {
260
- x = possibleSwipeCords.minX;
261
- }
262
- else if (this.isBeyondPossibleRight(x, possibleSwipeCords.maxX)) {
263
- x = possibleSwipeCords.maxX;
264
- }
265
- }
266
- else {
267
- if (scale > 1) {
268
- if (x < possibleSwipeCords.minX) {
269
- x = possibleSwipeCords.minX;
270
- }
271
- else if (x > possibleSwipeCords.maxX) {
272
- x = possibleSwipeCords.maxX;
273
- }
274
- }
275
- }
276
- // @todo fix this
277
- if (allowY) {
278
- if (this.isBeyondPossibleTop(y, possibleSwipeCords.minY)) {
279
- y = possibleSwipeCords.minY;
280
- }
281
- else if (this.isBeyondPossibleBottom(y, possibleSwipeCords.maxY)) {
282
- y = possibleSwipeCords.maxY;
283
- }
284
- }
285
- else {
286
- // If the translate value based on index of beyond the viewport, utilize the available space to prevent image being cut out
287
- if (scale > 1) {
288
- //If image goes beyond viewport top, use the minim possible translate value
289
- if (y < possibleSwipeCords.minY) {
290
- y = possibleSwipeCords.minY;
291
- }
292
- else if (y > possibleSwipeCords.maxY) {
293
- y = possibleSwipeCords.maxY;
294
- }
295
- }
296
- }
297
- }
298
- this.setZoomStyles({
299
- x: x,
300
- y: y,
301
- scale: scale,
302
- });
303
- this.left = x;
304
- this.top = y;
305
- if (resetToMax) {
306
- this.setZoomImageSize();
307
- }
308
- };
309
- Zoom.prototype.resetImageTranslate = function (index) {
310
- if (!this.isImageSlide(index)) {
311
- return;
312
- }
313
- var $image = this.core.getSlideItem(index).find('.lg-image').first();
314
- this.imageReset = false;
315
- $image.removeClass('reset-transition reset-transition-y reset-transition-x');
316
- this.core.outer.removeClass('lg-actual-size');
317
- $image.css('width', 'auto').css('height', 'auto');
318
- setTimeout(function () {
319
- $image.removeClass('no-transition');
320
- }, 10);
321
- };
322
- Zoom.prototype.setZoomImageSize = function () {
323
- var _this = this;
324
- var $image = this.core
325
- .getSlideItem(this.core.index)
326
- .find('.lg-image')
327
- .first();
328
- setTimeout(function () {
329
- var actualSizeScale = _this.getCurrentImageActualSizeScale();
330
- if (_this.scale >= actualSizeScale) {
331
- $image.addClass('no-transition');
332
- _this.imageReset = true;
333
- }
334
- }, ZOOM_TRANSITION_DURATION);
335
- setTimeout(function () {
336
- var actualSizeScale = _this.getCurrentImageActualSizeScale();
337
- if (_this.scale >= actualSizeScale) {
338
- var dragAllowedAxises = _this.getDragAllowedAxises(_this.scale);
339
- $image
340
- .css('width', $image.get().naturalWidth + 'px')
341
- .css('height', $image.get().naturalHeight + 'px');
342
- _this.core.outer.addClass('lg-actual-size');
343
- if (dragAllowedAxises.allowX && dragAllowedAxises.allowY) {
344
- $image.addClass('reset-transition');
345
- }
346
- else if (dragAllowedAxises.allowX &&
347
- !dragAllowedAxises.allowY) {
348
- $image.addClass('reset-transition-x');
349
- }
350
- else if (!dragAllowedAxises.allowX &&
351
- dragAllowedAxises.allowY) {
352
- $image.addClass('reset-transition-y');
353
- }
354
- }
355
- }, ZOOM_TRANSITION_DURATION + 50);
356
- };
357
- /**
358
- * @desc apply scale3d to image and translate to image wrap
359
- * @param {style} X,Y and scale
360
- */
361
- Zoom.prototype.setZoomStyles = function (style) {
362
- var $imageWrap = this.core
363
- .getSlideItem(this.core.index)
364
- .find('.lg-img-wrap')
365
- .first();
366
- var $image = this.core
367
- .getSlideItem(this.core.index)
368
- .find('.lg-image')
369
- .first();
370
- var $dummyImage = this.core.outer
371
- .find('.lg-current .lg-dummy-img')
372
- .first();
373
- this.scale = style.scale;
374
- $image.css('transform', 'scale3d(' + style.scale + ', ' + style.scale + ', 1)');
375
- $dummyImage.css('transform', 'scale3d(' + style.scale + ', ' + style.scale + ', 1)');
376
- var transform = 'translate3d(' + style.x + 'px, ' + style.y + 'px, 0)';
377
- $imageWrap.css('transform', transform);
378
- };
379
- /**
380
- * @param index - Index of the current slide
381
- * @param event - event will be available only if the function is called on clicking/taping the imags
382
- */
383
- Zoom.prototype.setActualSize = function (index, event) {
384
- var _this = this;
385
- if (this.zoomInProgress) {
386
- return;
387
- }
388
- this.zoomInProgress = true;
389
- var currentItem = this.core.galleryItems[this.core.index];
390
- this.resetImageTranslate(index);
391
- setTimeout(function () {
392
- // Allow zoom only on image
393
- if (!currentItem.src ||
394
- _this.core.outer.hasClass('lg-first-slide-loading')) {
395
- return;
396
- }
397
- var scale = _this.getCurrentImageActualSizeScale();
398
- var prevScale = _this.scale;
399
- if (_this.core.outer.hasClass('lg-zoomed')) {
400
- _this.scale = 1;
401
- }
402
- else {
403
- _this.scale = _this.getScale(scale);
404
- }
405
- _this.setPageCords(event);
406
- _this.beginZoom(_this.scale);
407
- _this.zoomImage(_this.scale, _this.scale - prevScale, true, true);
408
- }, 50);
409
- setTimeout(function () {
410
- _this.core.outer.removeClass('lg-grabbing').addClass('lg-grab');
411
- }, 60);
412
- setTimeout(function () {
413
- _this.zoomInProgress = false;
414
- }, ZOOM_TRANSITION_DURATION + 110);
415
- };
416
- Zoom.prototype.getNaturalWidth = function (index) {
417
- var $image = this.core.getSlideItem(index).find('.lg-image').first();
418
- var naturalWidth = this.core.galleryItems[index].width;
419
- return naturalWidth
420
- ? parseFloat(naturalWidth)
421
- : $image.get().naturalWidth;
422
- };
423
- Zoom.prototype.getActualSizeScale = function (naturalWidth, width) {
424
- var _scale;
425
- var scale;
426
- if (naturalWidth >= width) {
427
- _scale = naturalWidth / width;
428
- scale = _scale || 2;
429
- }
430
- else {
431
- scale = 1;
432
- }
433
- return scale;
434
- };
435
- Zoom.prototype.getCurrentImageActualSizeScale = function () {
436
- var $image = this.core
437
- .getSlideItem(this.core.index)
438
- .find('.lg-image')
439
- .first();
440
- var width = $image.get().offsetWidth;
441
- var naturalWidth = this.getNaturalWidth(this.core.index) || width;
442
- return this.getActualSizeScale(naturalWidth, width);
443
- };
444
- Zoom.prototype.getPageCords = function (event) {
445
- var cords = {};
446
- if (event) {
447
- cords.x = event.pageX || event.touches[0].pageX;
448
- cords.y = event.pageY || event.touches[0].pageY;
449
- }
450
- else {
451
- var containerRect = this.core.$content
452
- .get()
453
- .getBoundingClientRect();
454
- cords.x = containerRect.width / 2 + containerRect.left;
455
- cords.y =
456
- containerRect.height / 2 + this.scrollTop + containerRect.top;
457
- }
458
- return cords;
459
- };
460
- Zoom.prototype.setPageCords = function (event) {
461
- var pageCords = this.getPageCords(event);
462
- this.pageX = pageCords.x;
463
- this.pageY = pageCords.y;
464
- };
465
- Zoom.prototype.manageActualPixelClassNames = function () {
466
- var $actualSize = this.core.getElementById('lg-actual-size');
467
- $actualSize
468
- .removeClass(this.settings.actualSizeIcons.zoomIn)
469
- .addClass(this.settings.actualSizeIcons.zoomOut);
470
- };
471
- // If true, zoomed - in else zoomed out
472
- Zoom.prototype.beginZoom = function (scale) {
473
- this.core.outer.removeClass('lg-zoom-drag-transition lg-zoom-dragging');
474
- if (scale > 1) {
475
- this.core.outer.addClass('lg-zoomed');
476
- this.manageActualPixelClassNames();
477
- }
478
- else {
479
- this.resetZoom();
480
- }
481
- return scale > 1;
482
- };
483
- Zoom.prototype.getScale = function (scale) {
484
- var actualSizeScale = this.getCurrentImageActualSizeScale();
485
- if (scale < 1) {
486
- scale = 1;
487
- }
488
- else if (scale > actualSizeScale) {
489
- scale = actualSizeScale;
490
- }
491
- return scale;
492
- };
493
- Zoom.prototype.init = function () {
494
- var _this = this;
495
- if (!this.settings.zoom) {
496
- return;
497
- }
498
- this.buildTemplates();
499
- this.enableZoomOnSlideItemLoad();
500
- var tapped = null;
501
- this.core.outer.on('dblclick.lg', function (event) {
502
- if (!_this.$LG(event.target).hasClass('lg-image')) {
503
- return;
504
- }
505
- _this.setActualSize(_this.core.index, event);
506
- });
507
- this.core.outer.on('touchstart.lg', function (event) {
508
- var $target = _this.$LG(event.target);
509
- if (event.touches.length === 1 && $target.hasClass('lg-image')) {
510
- if (!tapped) {
511
- tapped = setTimeout(function () {
512
- tapped = null;
513
- }, 300);
514
- }
515
- else {
516
- clearTimeout(tapped);
517
- tapped = null;
518
- event.preventDefault();
519
- _this.setActualSize(_this.core.index, event);
520
- }
521
- }
522
- });
523
- this.core.LGel.on(lGEvents.containerResize + ".zoom " + lGEvents.rotateRight + ".zoom " + lGEvents.rotateLeft + ".zoom " + lGEvents.flipHorizontal + ".zoom " + lGEvents.flipVertical + ".zoom", function () {
524
- if (!_this.core.lgOpened ||
525
- !_this.isImageSlide(_this.core.index) ||
526
- _this.core.touchAction) {
527
- return;
528
- }
529
- var _LGel = _this.core
530
- .getSlideItem(_this.core.index)
531
- .find('.lg-img-wrap')
532
- .first();
533
- _this.top = 0;
534
- _this.left = 0;
535
- _this.setZoomEssentials();
536
- _this.setZoomSwipeStyles(_LGel, { x: 0, y: 0 });
537
- _this.positionChanged = true;
538
- });
539
- // Update zoom on resize and orientationchange
540
- this.$LG(window).on("scroll.lg.zoom.global" + this.core.lgId, function () {
541
- if (!_this.core.lgOpened)
542
- return;
543
- _this.scrollTop = _this.$LG(window).scrollTop();
544
- });
545
- this.core.getElementById('lg-zoom-out').on('click.lg', function () {
546
- // Allow zoom only on image
547
- if (!_this.isImageSlide(_this.core.index)) {
548
- return;
549
- }
550
- var timeout = 0;
551
- if (_this.imageReset) {
552
- _this.resetImageTranslate(_this.core.index);
553
- timeout = 50;
554
- }
555
- setTimeout(function () {
556
- var scale = _this.scale - _this.settings.scale;
557
- if (scale < 1) {
558
- scale = 1;
559
- }
560
- _this.beginZoom(scale);
561
- _this.zoomImage(scale, -_this.settings.scale, true, !_this.settings.infiniteZoom);
562
- }, timeout);
563
- });
564
- this.core.getElementById('lg-zoom-in').on('click.lg', function () {
565
- _this.zoomIn();
566
- });
567
- this.core.getElementById('lg-actual-size').on('click.lg', function () {
568
- _this.setActualSize(_this.core.index);
569
- });
570
- this.core.LGel.on(lGEvents.beforeOpen + ".zoom", function () {
571
- _this.core.outer.find('.lg-item').removeClass('lg-zoomable');
572
- });
573
- this.core.LGel.on(lGEvents.afterOpen + ".zoom", function () {
574
- _this.scrollTop = _this.$LG(window).scrollTop();
575
- // Set the initial value center
576
- _this.pageX = _this.core.outer.width() / 2;
577
- _this.pageY = _this.core.outer.height() / 2 + _this.scrollTop;
578
- _this.scale = 1;
579
- });
580
- // Reset zoom on slide change
581
- this.core.LGel.on(lGEvents.afterSlide + ".zoom", function (event) {
582
- var prevIndex = event.detail.prevIndex;
583
- _this.scale = 1;
584
- _this.positionChanged = false;
585
- _this.zoomInProgress = false;
586
- _this.resetZoom(prevIndex);
587
- _this.resetImageTranslate(prevIndex);
588
- if (_this.isImageSlide(_this.core.index)) {
589
- _this.setZoomEssentials();
590
- }
591
- });
592
- // Drag option after zoom
593
- this.zoomDrag();
594
- this.pinchZoom();
595
- this.zoomSwipe();
596
- // Store the zoomable timeout value just to clear it while closing
597
- this.zoomableTimeout = false;
598
- this.positionChanged = false;
599
- this.zoomInProgress = false;
600
- };
601
- Zoom.prototype.zoomIn = function () {
602
- // Allow zoom only on image
603
- if (!this.isImageSlide(this.core.index)) {
604
- return;
605
- }
606
- var scale = this.scale + this.settings.scale;
607
- if (!this.settings.infiniteZoom) {
608
- scale = this.getScale(scale);
609
- }
610
- this.beginZoom(scale);
611
- this.zoomImage(scale, Math.min(this.settings.scale, scale - this.scale), true, !this.settings.infiniteZoom);
612
- };
613
- // Reset zoom effect
614
- Zoom.prototype.resetZoom = function (index) {
615
- this.core.outer.removeClass('lg-zoomed lg-zoom-drag-transition');
616
- var $actualSize = this.core.getElementById('lg-actual-size');
617
- var $item = this.core.getSlideItem(index !== undefined ? index : this.core.index);
618
- $actualSize
619
- .removeClass(this.settings.actualSizeIcons.zoomOut)
620
- .addClass(this.settings.actualSizeIcons.zoomIn);
621
- $item.find('.lg-img-wrap').first().removeAttr('style');
622
- $item.find('.lg-image').first().removeAttr('style');
623
- this.scale = 1;
624
- this.left = 0;
625
- this.top = 0;
626
- // Reset pagx pagy values to center
627
- this.setPageCords();
628
- };
629
- Zoom.prototype.getTouchDistance = function (e) {
630
- return Math.sqrt((e.touches[0].pageX - e.touches[1].pageX) *
631
- (e.touches[0].pageX - e.touches[1].pageX) +
632
- (e.touches[0].pageY - e.touches[1].pageY) *
633
- (e.touches[0].pageY - e.touches[1].pageY));
634
- };
635
- Zoom.prototype.pinchZoom = function () {
636
- var _this = this;
637
- var startDist = 0;
638
- var pinchStarted = false;
639
- var initScale = 1;
640
- var prevScale = 0;
641
- var $item = this.core.getSlideItem(this.core.index);
642
- this.core.outer.on('touchstart.lg', function (e) {
643
- $item = _this.core.getSlideItem(_this.core.index);
644
- if (!_this.isImageSlide(_this.core.index)) {
645
- return;
646
- }
647
- if (e.touches.length === 2) {
648
- e.preventDefault();
649
- if (_this.core.outer.hasClass('lg-first-slide-loading')) {
650
- return;
651
- }
652
- initScale = _this.scale || 1;
653
- _this.core.outer.removeClass('lg-zoom-drag-transition lg-zoom-dragging');
654
- _this.setPageCords(e);
655
- _this.resetImageTranslate(_this.core.index);
656
- _this.core.touchAction = 'pinch';
657
- startDist = _this.getTouchDistance(e);
658
- }
659
- });
660
- this.core.$inner.on('touchmove.lg', function (e) {
661
- if (e.touches.length === 2 &&
662
- _this.core.touchAction === 'pinch' &&
663
- (_this.$LG(e.target).hasClass('lg-item') ||
664
- $item.get().contains(e.target))) {
665
- e.preventDefault();
666
- var endDist = _this.getTouchDistance(e);
667
- var distance = startDist - endDist;
668
- if (!pinchStarted && Math.abs(distance) > 5) {
669
- pinchStarted = true;
670
- }
671
- if (pinchStarted) {
672
- prevScale = _this.scale;
673
- var _scale = Math.max(1, initScale + -distance * 0.02);
674
- _this.scale =
675
- Math.round((_scale + Number.EPSILON) * 100) / 100;
676
- var diff = _this.scale - prevScale;
677
- _this.zoomImage(_this.scale, Math.round((diff + Number.EPSILON) * 100) / 100, false, false);
678
- }
679
- }
680
- });
681
- this.core.$inner.on('touchend.lg', function (e) {
682
- if (_this.core.touchAction === 'pinch' &&
683
- (_this.$LG(e.target).hasClass('lg-item') ||
684
- $item.get().contains(e.target))) {
685
- pinchStarted = false;
686
- startDist = 0;
687
- if (_this.scale <= 1) {
688
- _this.resetZoom();
689
- }
690
- else {
691
- var actualSizeScale = _this.getCurrentImageActualSizeScale();
692
- if (_this.scale >= actualSizeScale) {
693
- var scaleDiff = actualSizeScale - _this.scale;
694
- if (scaleDiff === 0) {
695
- scaleDiff = 0.01;
696
- }
697
- _this.zoomImage(actualSizeScale, scaleDiff, false, true);
698
- }
699
- _this.manageActualPixelClassNames();
700
- _this.core.outer.addClass('lg-zoomed');
701
- }
702
- _this.core.touchAction = undefined;
703
- }
704
- });
705
- };
706
- Zoom.prototype.touchendZoom = function (startCoords, endCoords, allowX, allowY, touchDuration) {
707
- var distanceXnew = endCoords.x - startCoords.x;
708
- var distanceYnew = endCoords.y - startCoords.y;
709
- var speedX = Math.abs(distanceXnew) / touchDuration + 1;
710
- var speedY = Math.abs(distanceYnew) / touchDuration + 1;
711
- if (speedX > 2) {
712
- speedX += 1;
713
- }
714
- if (speedY > 2) {
715
- speedY += 1;
716
- }
717
- distanceXnew = distanceXnew * speedX;
718
- distanceYnew = distanceYnew * speedY;
719
- var _LGel = this.core
720
- .getSlideItem(this.core.index)
721
- .find('.lg-img-wrap')
722
- .first();
723
- var distance = {};
724
- distance.x = this.left + distanceXnew;
725
- distance.y = this.top + distanceYnew;
726
- var possibleSwipeCords = this.getPossibleSwipeDragCords();
727
- if (Math.abs(distanceXnew) > 15 || Math.abs(distanceYnew) > 15) {
728
- if (allowY) {
729
- if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
730
- distance.y = possibleSwipeCords.minY;
731
- }
732
- else if (this.isBeyondPossibleBottom(distance.y, possibleSwipeCords.maxY)) {
733
- distance.y = possibleSwipeCords.maxY;
734
- }
735
- }
736
- if (allowX) {
737
- if (this.isBeyondPossibleLeft(distance.x, possibleSwipeCords.minX)) {
738
- distance.x = possibleSwipeCords.minX;
739
- }
740
- else if (this.isBeyondPossibleRight(distance.x, possibleSwipeCords.maxX)) {
741
- distance.x = possibleSwipeCords.maxX;
742
- }
743
- }
744
- if (allowY) {
745
- this.top = distance.y;
746
- }
747
- else {
748
- distance.y = this.top;
749
- }
750
- if (allowX) {
751
- this.left = distance.x;
752
- }
753
- else {
754
- distance.x = this.left;
755
- }
756
- this.setZoomSwipeStyles(_LGel, distance);
757
- this.positionChanged = true;
758
- }
759
- };
760
- Zoom.prototype.getZoomSwipeCords = function (startCoords, endCoords, allowX, allowY, possibleSwipeCords) {
761
- var distance = {};
762
- if (allowY) {
763
- distance.y = this.top + (endCoords.y - startCoords.y);
764
- if (this.isBeyondPossibleTop(distance.y, possibleSwipeCords.minY)) {
765
- var diffMinY = possibleSwipeCords.minY - distance.y;
766
- distance.y = possibleSwipeCords.minY - diffMinY / 6;
767
- }
768
- else if (this.isBeyondPossibleBottom(distance.y, possibleSwipeCords.maxY)) {
769
- var diffMaxY = distance.y - possibleSwipeCords.maxY;
770
- distance.y = possibleSwipeCords.maxY + diffMaxY / 6;
771
- }
772
- }
773
- else {
774
- distance.y = this.top;
775
- }
776
- if (allowX) {
777
- distance.x = this.left + (endCoords.x - startCoords.x);
778
- if (this.isBeyondPossibleLeft(distance.x, possibleSwipeCords.minX)) {
779
- var diffMinX = possibleSwipeCords.minX - distance.x;
780
- distance.x = possibleSwipeCords.minX - diffMinX / 6;
781
- }
782
- else if (this.isBeyondPossibleRight(distance.x, possibleSwipeCords.maxX)) {
783
- var difMaxX = distance.x - possibleSwipeCords.maxX;
784
- distance.x = possibleSwipeCords.maxX + difMaxX / 6;
785
- }
786
- }
787
- else {
788
- distance.x = this.left;
789
- }
790
- return distance;
791
- };
792
- Zoom.prototype.isBeyondPossibleLeft = function (x, minX) {
793
- return x >= minX;
794
- };
795
- Zoom.prototype.isBeyondPossibleRight = function (x, maxX) {
796
- return x <= maxX;
797
- };
798
- Zoom.prototype.isBeyondPossibleTop = function (y, minY) {
799
- return y >= minY;
800
- };
801
- Zoom.prototype.isBeyondPossibleBottom = function (y, maxY) {
802
- return y <= maxY;
803
- };
804
- Zoom.prototype.isImageSlide = function (index) {
805
- var currentItem = this.core.galleryItems[index];
806
- return this.core.getSlideType(currentItem) === 'image';
807
- };
808
- Zoom.prototype.getPossibleSwipeDragCords = function (scale) {
809
- var $image = this.core
810
- .getSlideItem(this.core.index)
811
- .find('.lg-image')
812
- .first();
813
- var bottom = this.core.mediaContainerPosition.bottom;
814
- var imgRect = $image.get().getBoundingClientRect();
815
- var imageHeight = imgRect.height;
816
- var imageWidth = imgRect.width;
817
- if (scale) {
818
- imageHeight = imageHeight + scale * imageHeight;
819
- imageWidth = imageWidth + scale * imageWidth;
820
- }
821
- var minY = (imageHeight - this.containerRect.height) / 2;
822
- var maxY = (this.containerRect.height - imageHeight) / 2 + bottom;
823
- var minX = (imageWidth - this.containerRect.width) / 2;
824
- var maxX = (this.containerRect.width - imageWidth) / 2;
825
- var possibleSwipeCords = {
826
- minY: minY,
827
- maxY: maxY,
828
- minX: minX,
829
- maxX: maxX,
830
- };
831
- return possibleSwipeCords;
832
- };
833
- Zoom.prototype.setZoomSwipeStyles = function (LGel, distance) {
834
- LGel.css('transform', 'translate3d(' + distance.x + 'px, ' + distance.y + 'px, 0)');
835
- };
836
- Zoom.prototype.zoomSwipe = function () {
837
- var _this = this;
838
- var startCoords = {};
839
- var endCoords = {};
840
- var isMoved = false;
841
- // Allow x direction drag
842
- var allowX = false;
843
- // Allow Y direction drag
844
- var allowY = false;
845
- var startTime = new Date();
846
- var endTime = new Date();
847
- var possibleSwipeCords;
848
- var _LGel;
849
- var $item = this.core.getSlideItem(this.core.index);
850
- this.core.$inner.on('touchstart.lg', function (e) {
851
- // Allow zoom only on image
852
- if (!_this.isImageSlide(_this.core.index)) {
853
- return;
854
- }
855
- $item = _this.core.getSlideItem(_this.core.index);
856
- if ((_this.$LG(e.target).hasClass('lg-item') ||
857
- $item.get().contains(e.target)) &&
858
- e.touches.length === 1 &&
859
- _this.core.outer.hasClass('lg-zoomed')) {
860
- e.preventDefault();
861
- startTime = new Date();
862
- _this.core.touchAction = 'zoomSwipe';
863
- _LGel = _this.core
864
- .getSlideItem(_this.core.index)
865
- .find('.lg-img-wrap')
866
- .first();
867
- var dragAllowedAxises = _this.getDragAllowedAxises(0);
868
- allowY = dragAllowedAxises.allowY;
869
- allowX = dragAllowedAxises.allowX;
870
- if (allowX || allowY) {
871
- startCoords = _this.getSwipeCords(e);
872
- }
873
- possibleSwipeCords = _this.getPossibleSwipeDragCords();
874
- // reset opacity and transition duration
875
- _this.core.outer.addClass('lg-zoom-dragging lg-zoom-drag-transition');
876
- }
877
- });
878
- this.core.$inner.on('touchmove.lg', function (e) {
879
- if (e.touches.length === 1 &&
880
- _this.core.touchAction === 'zoomSwipe' &&
881
- (_this.$LG(e.target).hasClass('lg-item') ||
882
- $item.get().contains(e.target))) {
883
- e.preventDefault();
884
- _this.core.touchAction = 'zoomSwipe';
885
- endCoords = _this.getSwipeCords(e);
886
- var distance = _this.getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords);
887
- if (Math.abs(endCoords.x - startCoords.x) > 15 ||
888
- Math.abs(endCoords.y - startCoords.y) > 15) {
889
- isMoved = true;
890
- _this.setZoomSwipeStyles(_LGel, distance);
891
- }
892
- }
893
- });
894
- this.core.$inner.on('touchend.lg', function (e) {
895
- if (_this.core.touchAction === 'zoomSwipe' &&
896
- (_this.$LG(e.target).hasClass('lg-item') ||
897
- $item.get().contains(e.target))) {
898
- e.preventDefault();
899
- _this.core.touchAction = undefined;
900
- _this.core.outer.removeClass('lg-zoom-dragging');
901
- if (!isMoved) {
902
- return;
903
- }
904
- isMoved = false;
905
- endTime = new Date();
906
- var touchDuration = endTime.valueOf() - startTime.valueOf();
907
- _this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration);
908
- }
909
- });
910
- };
911
- Zoom.prototype.zoomDrag = function () {
912
- var _this = this;
913
- var startCoords = {};
914
- var endCoords = {};
915
- var isDragging = false;
916
- var isMoved = false;
917
- // Allow x direction drag
918
- var allowX = false;
919
- // Allow Y direction drag
920
- var allowY = false;
921
- var startTime;
922
- var endTime;
923
- var possibleSwipeCords;
924
- var _LGel;
925
- this.core.outer.on('mousedown.lg.zoom', function (e) {
926
- // Allow zoom only on image
927
- if (!_this.isImageSlide(_this.core.index)) {
928
- return;
929
- }
930
- var $item = _this.core.getSlideItem(_this.core.index);
931
- if (_this.$LG(e.target).hasClass('lg-item') ||
932
- $item.get().contains(e.target)) {
933
- startTime = new Date();
934
- _LGel = _this.core
935
- .getSlideItem(_this.core.index)
936
- .find('.lg-img-wrap')
937
- .first();
938
- var dragAllowedAxises = _this.getDragAllowedAxises(0);
939
- allowY = dragAllowedAxises.allowY;
940
- allowX = dragAllowedAxises.allowX;
941
- if (_this.core.outer.hasClass('lg-zoomed')) {
942
- if (_this.$LG(e.target).hasClass('lg-object') &&
943
- (allowX || allowY)) {
944
- e.preventDefault();
945
- startCoords = _this.getDragCords(e);
946
- possibleSwipeCords = _this.getPossibleSwipeDragCords();
947
- isDragging = true;
948
- _this.core.outer
949
- .removeClass('lg-grab')
950
- .addClass('lg-grabbing lg-zoom-drag-transition lg-zoom-dragging');
951
- // reset opacity and transition duration
952
- }
953
- }
954
- }
955
- });
956
- this.$LG(window).on("mousemove.lg.zoom.global" + this.core.lgId, function (e) {
957
- if (isDragging) {
958
- isMoved = true;
959
- endCoords = _this.getDragCords(e);
960
- var distance = _this.getZoomSwipeCords(startCoords, endCoords, allowX, allowY, possibleSwipeCords);
961
- _this.setZoomSwipeStyles(_LGel, distance);
962
- }
963
- });
964
- this.$LG(window).on("mouseup.lg.zoom.global" + this.core.lgId, function (e) {
965
- if (isDragging) {
966
- endTime = new Date();
967
- isDragging = false;
968
- _this.core.outer.removeClass('lg-zoom-dragging');
969
- // Fix for chrome mouse move on click
970
- if (isMoved &&
971
- (startCoords.x !== endCoords.x ||
972
- startCoords.y !== endCoords.y)) {
973
- endCoords = _this.getDragCords(e);
974
- var touchDuration = endTime.valueOf() - startTime.valueOf();
975
- _this.touchendZoom(startCoords, endCoords, allowX, allowY, touchDuration);
976
- }
977
- isMoved = false;
978
- }
979
- _this.core.outer.removeClass('lg-grabbing').addClass('lg-grab');
980
- });
981
- };
982
- Zoom.prototype.closeGallery = function () {
983
- this.resetZoom();
984
- this.zoomInProgress = false;
985
- };
986
- Zoom.prototype.destroy = function () {
987
- // Unbind all events added by lightGallery zoom plugin
988
- this.$LG(window).off(".lg.zoom.global" + this.core.lgId);
989
- this.core.LGel.off('.lg.zoom');
990
- this.core.LGel.off('.zoom');
991
- clearTimeout(this.zoomableTimeout);
992
- this.zoomableTimeout = false;
993
- };
994
- return Zoom;
995
- }());
996
-
997
- return Zoom;
998
-
999
- })));