j1-template 2024.3.13 → 2024.3.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +1 -1
  3. data/_includes/themes/j1/layouts/layout_resource_generator.html +1 -4
  4. data/_includes/themes/j1/procedures/blocks/footer/boxes/social_media_icons.proc +24 -23
  5. data/_includes/themes/j1/procedures/layouts/content_writer.proc +4 -3
  6. data/_includes/themes/j1/procedures/layouts/default_writer.proc +37 -6
  7. data/_includes/themes/j1/procedures/layouts/module_writer.proc +31 -95
  8. data/_includes/themes/j1/procedures/layouts/resource_writer.proc +51 -29
  9. data/assets/data/amplitude.28.html +887 -0
  10. data/assets/data/amplitude.29.html +923 -0
  11. data/assets/data/amplitude.html +311 -46
  12. data/assets/data/banner.html +9 -7
  13. data/assets/data/masterslider.html +128 -7
  14. data/assets/data/panel.html +16 -65
  15. data/assets/theme/j1/adapter/js/amplitude.23.js +1165 -0
  16. data/assets/theme/j1/adapter/js/amplitude.24.js +1164 -0
  17. data/assets/theme/j1/adapter/js/amplitude.25.js +1268 -0
  18. data/assets/theme/j1/adapter/js/amplitude.js +294 -117
  19. data/assets/theme/j1/adapter/js/attic.js +14 -11
  20. data/assets/theme/j1/adapter/js/docsearch.js +2 -2
  21. data/assets/theme/j1/adapter/js/fab.js +2 -2
  22. data/assets/theme/j1/adapter/js/j1.js +8 -8
  23. data/assets/theme/j1/adapter/js/lazyLoader.js +60 -10
  24. data/assets/theme/j1/adapter/js/masonry.js +1 -1
  25. data/assets/theme/j1/adapter/js/masterslider.js +2 -2
  26. data/assets/theme/j1/adapter/js/particles.js +2 -2
  27. data/assets/theme/j1/adapter/js/scroller.js +2 -2
  28. data/assets/theme/j1/adapter/js/slick.js +2 -2
  29. data/assets/theme/j1/adapter/js/themes.js +1 -1
  30. data/assets/theme/j1/adapter/js/translator.js +2 -2
  31. data/assets/theme/j1/adapter/js/waves.js +1 -1
  32. data/assets/theme/j1/core/css/animate.css +1634 -1070
  33. data/assets/theme/j1/core/css/animate.css.map +1 -0
  34. data/assets/theme/j1/core/css/animate.min.css +2 -1
  35. data/assets/theme/j1/core/css/animate.min.css.map +1 -0
  36. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css +3060 -1538
  37. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css.map +1 -0
  38. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css +2 -1
  39. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css.map +1 -0
  40. data/assets/theme/j1/core/css/icon-fonts/iconify.css +2308 -1153
  41. data/assets/theme/j1/core/css/icon-fonts/iconify.css.map +1 -0
  42. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css +2 -1
  43. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css.map +1 -0
  44. data/assets/theme/j1/core/css/icon-fonts/mdi.css +16716 -8423
  45. data/assets/theme/j1/core/css/icon-fonts/mdi.css.map +1 -0
  46. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css +2 -1
  47. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css.map +1 -0
  48. data/assets/theme/j1/core/css/icon-fonts/mdib.css +5554 -2766
  49. data/assets/theme/j1/core/css/icon-fonts/mdib.css.map +1 -0
  50. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css +2 -1
  51. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css.map +1 -0
  52. data/assets/theme/j1/core/css/icon-fonts/mdil.css +742 -441
  53. data/assets/theme/j1/core/css/icon-fonts/mdil.css.map +1 -0
  54. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css +2 -1
  55. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css.map +1 -0
  56. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css +6552 -3980
  57. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css.map +1 -0
  58. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -5
  59. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css.map +1 -0
  60. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css +6818 -4131
  61. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css.map +1 -0
  62. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css +2 -5
  63. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css.map +1 -0
  64. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +18568 -11577
  65. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -0
  66. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +2 -35
  67. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -0
  68. data/assets/theme/j1/core/css/vendor.css +1771 -1043
  69. data/assets/theme/j1/core/css/vendor.css.map +1 -0
  70. data/assets/theme/j1/core/css/vendor.min.css +2 -1
  71. data/assets/theme/j1/core/css/vendor.min.css.map +1 -0
  72. data/assets/theme/j1/core/js/template.js +399 -447
  73. data/assets/theme/j1/core/js/template.min.js +7 -7
  74. data/assets/theme/j1/core/js/template.min.js.map +1 -1
  75. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +4 -2
  76. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +39 -4
  77. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
  78. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +57 -17
  79. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
  80. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/pause.png +0 -0
  81. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.png +0 -0
  82. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.svg +87 -0
  83. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +60 -0
  84. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +59 -0
  85. data/assets/theme/j1/modules/amplitudejs/js/amplitude.js +65 -21
  86. data/assets/theme/j1/modules/amplitudejs/js/amplitude.min.js +1 -1
  87. data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +113 -0
  88. data/assets/theme/j1/modules/iconPicker/js/universal-icon-picker.js +471 -471
  89. data/assets/theme/j1/modules/j1LazyLoader/LICENSE +21 -0
  90. data/assets/theme/j1/modules/j1LazyLoader/js/j1Lazy.js +870 -0
  91. data/assets/theme/j1/modules/js-cookies/js/js.cookie.js +3 -3
  92. data/assets/theme/j1/modules/lazyCssLoader/js/main.0.js +166 -0
  93. data/assets/theme/j1/modules/lazyCssLoader/js/main.1.js +65 -0
  94. data/assets/theme/j1/modules/lazyCssLoader/js/main.js +66 -0
  95. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/examplePlugin.js +13 -0
  96. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/my-plugin.js +25 -0
  97. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/plugin-interface.js +9 -0
  98. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/pluginA.js +46 -0
  99. data/assets/theme/j1/modules/lazyLoader/js/plugins/README.md +324 -0
  100. data/assets/theme/j1/modules/lazyLoader/js/plugins/jquery.lazy.picture.js +188 -0
  101. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +1 -1
  102. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +794 -0
  103. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +151 -67
  104. data/assets/theme/j1/modules/slimSelect/js/select.js +1 -1
  105. data/assets/theme/j1/modules/slimSelect/js/select.min.js +3 -3
  106. data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +2 -1
  107. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.min.js +1 -1
  108. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/icon/scalable/dailymotion.svg +62 -0
  109. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.js +832 -0
  110. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.min.js +17 -0
  111. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.min.js +1 -1
  112. data/assets/theme/j1/modules/videojs/js/video.js +2 -2
  113. data/lib/j1/version.rb +1 -1
  114. data/lib/starter_web/README.md +577 -560
  115. data/lib/starter_web/_config.yml +2 -2
  116. data/lib/starter_web/_data/blocks/footer.yml +10 -5
  117. data/lib/starter_web/_data/blocks/panel.yml +2 -2
  118. data/lib/starter_web/_data/layouts/default.yml +14 -3
  119. data/lib/starter_web/_data/modules/amplitude.yml +145 -0
  120. data/lib/starter_web/_data/modules/defaults/amplitude.yml +29 -7
  121. data/lib/starter_web/_data/modules/defaults/lazyLoader.yml +2 -2
  122. data/lib/starter_web/_data/modules/gallery.yml +136 -0
  123. data/lib/starter_web/_data/modules/lazyLoader.0.yml +118 -0
  124. data/lib/starter_web/_data/modules/lazyLoader.yml +68 -31
  125. data/lib/starter_web/_data/modules/masonry.yml +4 -4
  126. data/lib/starter_web/_data/modules/masterslider.yml +118 -12
  127. data/lib/starter_web/_data/modules/navigator_menu.yml +831 -803
  128. data/lib/starter_web/_data/resources.yml +154 -190
  129. data/lib/starter_web/_data/templates/feed.xml +1 -1
  130. data/lib/starter_web/_includes/attributes.asciidoc +1 -0
  131. data/lib/starter_web/_plugins/asciidoctor/amplitude-block.rb +1 -1
  132. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/gallery-block.rb +4 -2
  134. data/lib/starter_web/_plugins/asciidoctor/masonry-block.rb +1 -1
  135. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +58 -46
  136. data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +26 -19
  137. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +30 -40
  138. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  139. data/lib/starter_web/assets/image/icons/lanus/favicon.ico +0 -0
  140. data/lib/starter_web/assets/image/icons/lanus/lanus-512x512.png +0 -0
  141. data/lib/starter_web/assets/image/icons/lanus/lanus.ico +0 -0
  142. data/lib/starter_web/assets/image/icons/lanus/lanus.png +0 -0
  143. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus.svg +76 -0
  144. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus_sw.svg +62 -0
  145. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28 - social.svg +86 -0
  146. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28.svg +64 -0
  147. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x.svg +1 -0
  148. data/lib/starter_web/assets/image/modules/icons/social/twitter_x.png +0 -0
  149. data/lib/starter_web/package.json +7 -18
  150. data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +218 -0
  151. data/lib/starter_web/pages/public/features/template.adoc +18 -8
  152. data/lib/starter_web/pages/public/features/template.asciidoc +758 -0
  153. data/lib/starter_web/pages/public/lazy_loader_tester.adoc +402 -0
  154. data/lib/starter_web/pages/public/manuals/ytdl/man.adoc +3020 -0
  155. data/lib/starter_web/pages/public/manuals/ytdl/man.md +2378 -0
  156. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +0 -16
  157. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/amplitudejs.large.css.asciidoc +505 -0
  158. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.hover.html +69 -0
  159. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.nested.html +75 -0
  160. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.textarea.html +57 -0
  161. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/my.content.html +112 -0
  162. data/lib/starter_web/pages/public/tools/previewer/preview_amplitudejs.adoc +172 -0
  163. data/lib/starter_web/pages/public/tour/_includes/attributes.asciidoc +2 -2
  164. data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +16 -16
  165. data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +13 -3
  166. data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +12 -3
  167. data/lib/starter_web/pages/public/tour/highlghter_rouge.adoc +13 -3
  168. data/lib/starter_web/pages/public/tour/icon_fonts.adoc +12 -3
  169. data/lib/starter_web/pages/public/tour/modal_extentions.adoc +12 -6
  170. data/lib/starter_web/pages/public/tour/{playback_audio.adoc → play_audio.adoc} +207 -188
  171. data/lib/starter_web/pages/public/tour/{playback_video.adoc → play_video.adoc} +49 -51
  172. data/lib/starter_web/pages/public/tour/present_images.adoc +27 -5
  173. data/lib/starter_web/pages/public/tour/quicksearch.adoc +13 -3
  174. data/lib/starter_web/pages/public/tour/responsive_tables.adoc +13 -4
  175. data/lib/starter_web/pages/public/tour/typography.adoc +12 -3
  176. metadata +90 -22
  177. /data/assets/theme/j1/modules/{lazyLoader → j1LazyLoader/js}/plugins/README.md +0 -0
  178. /data/assets/theme/j1/modules/{lazyLoader/plugins/jquery.lazy.picture.js → j1LazyLoader/js/plugins/picture.js} +0 -0
  179. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.js +0 -0
  180. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.min.js +0 -0
  181. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.js +0 -0
  182. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.min.js +0 -0
  183. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.js +0 -0
  184. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.min.js +0 -0
  185. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.js +0 -0
  186. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.min.js +0 -0
  187. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.picture.min.js +0 -0
  188. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.js +0 -0
  189. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.min.js +0 -0
  190. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.js +0 -0
  191. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.min.js +0 -0
  192. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.js +0 -0
  193. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.min.js +0 -0
@@ -0,0 +1,794 @@
1
+ /*
2
+ # -----------------------------------------------------------------------------
3
+ # ~/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js
4
+ # Provides lightGallery JS code for the plugin lgVideo
5
+ #
6
+ # Product/Info:
7
+ # https://jekyll.one
8
+ #
9
+ # Copyright (C) 2023 Sachin Neravath
10
+ # Copyright (C) 2023, 2024 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.lgVideo = 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 url = new URL(window.location.href);
48
+ var origin = url.origin;
49
+
50
+ var __assign = function() {
51
+ __assign = Object.assign || function __assign(t) {
52
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
53
+ s = arguments[i];
54
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
55
+ }
56
+ return t;
57
+ };
58
+ return __assign.apply(this, arguments);
59
+ };
60
+
61
+ var videoSettings = {
62
+ autoplayFirstVideo: true,
63
+ htmlPlayerParams: false,
64
+ youTubePlayerParams: false,
65
+ vimeoPlayerParams: false,
66
+ dailymotionPlayerParams: false,
67
+ wistiaPlayerParams: false,
68
+ tiktokPlayerParams: false,
69
+ gotoNextSlideOnVideoEnd: true,
70
+ autoplayVideoOnSlide: false,
71
+ videojs: false,
72
+ videojsTheme: '',
73
+ videojsOptions: {},
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 param = function (obj) {
111
+ return Object.keys(obj)
112
+ .map(function (k) {
113
+ return encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]);
114
+ })
115
+ .join('&');
116
+ };
117
+ var paramsToObject = function (url) {
118
+ var paramas = url
119
+ .slice(1)
120
+ .split('&')
121
+ .map(function (p) { return p.split('='); })
122
+ .reduce(function (obj, pair) {
123
+ var _a = pair.map(decodeURIComponent), key = _a[0], value = _a[1];
124
+ obj[key] = value;
125
+ return obj;
126
+ }, {});
127
+ return paramas;
128
+ };
129
+ var getYouTubeParams = function (videoInfo, youTubePlayerParamsSettings) {
130
+ if (!videoInfo.youtube)
131
+ return '';
132
+ var slideUrlParams = videoInfo.youtube[2]
133
+ ? paramsToObject(videoInfo.youtube[2])
134
+ : '';
135
+
136
+ // For YouTube first params gets priority if duplicates found
137
+ // See: https://stackoverflow.com/questions/40685142/youtube-autoplay-does-not-work-with-iframe
138
+ var defaultYouTubePlayerParams = {
139
+ autoplay: 0,
140
+ controls: 1,
141
+ enablejsapi: 1,
142
+ hl: 'en',
143
+ loop: 0,
144
+ mute: 1,
145
+ wmode: 'opaque',
146
+ origin: origin,
147
+ };
148
+
149
+ var playerParamsSettings = youTubePlayerParamsSettings || {};
150
+ var youTubePlayerParams = __assign(__assign(__assign({}, defaultYouTubePlayerParams), playerParamsSettings), slideUrlParams);
151
+ var youTubeParams = "?" + param(youTubePlayerParams);
152
+ return youTubeParams;
153
+ };
154
+ var isYouTubeNoCookie = function (url) {
155
+ return url.includes('youtube-nocookie.com');
156
+ };
157
+ var getVimeoURLParams = function (defaultParams, videoInfo) {
158
+ if (!videoInfo || !videoInfo.vimeo)
159
+ return '';
160
+ var urlParams = videoInfo.vimeo[2] || '';
161
+ var defaultPlayerParams = defaultParams && Object.keys(defaultParams).length !== 0
162
+ ? '&' + param(defaultParams)
163
+ : '';
164
+ // Support private video
165
+ var urlWithHash = videoInfo.vimeo[0].split('/').pop() || '';
166
+ var urlWithHashWithParams = urlWithHash.split('?')[0] || '';
167
+ var hash = urlWithHashWithParams.split('#')[0];
168
+ var isPrivate = videoInfo.vimeo[1] !== hash;
169
+ if (isPrivate) {
170
+ urlParams = urlParams.replace("/" + hash, '');
171
+ }
172
+ urlParams =
173
+ urlParams[0] == '?' ? '&' + urlParams.slice(1) : urlParams || '';
174
+ // For vimeo last params gets priority if duplicates found
175
+ var vimeoPlayerParams = "?autoplay=0&muted=1" + (isPrivate ? "&h=" + hash : '') + defaultPlayerParams + urlParams;
176
+ return vimeoPlayerParams;
177
+ };
178
+
179
+ var getTikTokURLParams = function (defaultParams, videoInfo) {
180
+ if (!videoInfo || !videoInfo.tiktok)
181
+ return '';
182
+ var urlParams = videoInfo.tiktok[2] || '';
183
+ var defaultPlayerParams = defaultParams && Object.keys(defaultParams).length !== 0
184
+ ? '&' + param(defaultParams)
185
+ : '';
186
+ // Support private video
187
+ var urlWithHash = videoInfo.tiktok[0].split('/').pop() || '';
188
+ var urlWithHashWithParams = urlWithHash.split('?')[0] || '';
189
+ var hash = urlWithHashWithParams.split('#')[0];
190
+ var isPrivate = videoInfo.tiktok[1] !== hash;
191
+ if (isPrivate) {
192
+ urlParams = urlParams.replace("/" + hash, '');
193
+ }
194
+ urlParams =
195
+ urlParams[0] == '?' ? '&' + urlParams.slice(1) : urlParams || '';
196
+ // For vimeo last params gets priority if duplicates found
197
+ var tiktokPlayerParams = "?autoplay=0&muted=1" + defaultPlayerParams + urlParams;
198
+ return tiktokPlayerParams;
199
+ };
200
+
201
+ // -------------------------------------------------------------------------
202
+ // loadVtt
203
+ // Loads a given WEBVTT file (from data path) and process loaded
204
+ // data in callback cb (function)
205
+ // -------------------------------------------------------------------------
206
+ var loadVtt = function (data_path, cb) {
207
+ var parser = new WebVTTParser();
208
+
209
+ $.ajax({
210
+ url: data_path,
211
+ type: 'GET',
212
+ success: cb,
213
+ error: function(data) {
214
+ var json_data = JSON.stringify(data, undefined, 2);
215
+ }
216
+ });
217
+
218
+ } // END loadVtt
219
+
220
+ /**
221
+ * Video module for lightGallery
222
+ * Supports HTML5, YouTube, Vimeo, Wistia, Dailymotion, TikToc
223
+ *
224
+
225
+ * @ref Youtube
226
+ * https://developers.google.com/youtube/player_parameters#enablejsapi
227
+ * https://developers.google.com/youtube/iframe_api_reference
228
+ * https://developer.chrome.com/blog/autoplay/#iframe-delegation
229
+ *
230
+ * @ref Vimeo
231
+ * https://stackoverflow.com/questions/10488943/easy-way-to-get-vimeo-id-from-a-vimeo-url
232
+ * https://vimeo.zendesk.com/hc/en-us/articles/360000121668-Starting-playback-at-a-specific-timecode
233
+ * https://vimeo.zendesk.com/hc/en-us/articles/360001494447-Using-Player-Parameters
234
+ *
235
+ * @ref Wistia
236
+ * https://wistia.com/support/integrations/wordpress(How to get url)
237
+ * https://wistia.com/support/developers/embed-options#using-embed-options
238
+ * https://wistia.com/support/developers/player-api
239
+ * https://wistia.com/support/developers/construct-an-embed-code
240
+ * http://jsfiddle.net/xvnm7xLm/
241
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
242
+ * https://wistia.com/support/embed-and-share/sharing-videos
243
+ * https://private-sharing.wistia.com/medias/mwhrulrucj
244
+ *
245
+ */
246
+ var Video = /** @class */ (function () {
247
+ function Video(instance) {
248
+ // get lightGallery core plugin instance
249
+ this.core = instance;
250
+ this.settings = __assign(__assign({}, videoSettings), this.core.settings);
251
+ return this;
252
+ }
253
+
254
+ Video.prototype.init = function () {
255
+ var _this = this;
256
+ /**
257
+ * Event triggered when video url found without poster
258
+ * Append video HTML
259
+ * Play if autoplayFirstVideo is true
260
+ */
261
+ this.core.LGel.on(lGEvents.hasVideo + ".video", this.onHasVideo.bind(this));
262
+ this.core.LGel.on(lGEvents.posterClick + ".video", function () {
263
+ var $el = _this.core.getSlideItem(_this.core.index);
264
+ _this.loadVideoOnPosterClick($el);
265
+ });
266
+ this.core.LGel.on(lGEvents.slideItemLoad + ".video", this.onSlideItemLoad.bind(this));
267
+ // @desc fired immediately before each slide transition.
268
+ this.core.LGel.on(lGEvents.beforeSlide + ".video", this.onBeforeSlide.bind(this));
269
+ // @desc fired immediately after each slide transition.
270
+ this.core.LGel.on(lGEvents.afterSlide + ".video", this.onAfterSlide.bind(this));
271
+ };
272
+
273
+ /**
274
+ * @desc Event triggered when a slide is completely loaded
275
+ *
276
+ * @param {Event} event - lightGalley custom event
277
+ */
278
+ Video.prototype.onSlideItemLoad = function (event) {
279
+ var _this = this;
280
+ var _a = event.detail, isFirstSlide = _a.isFirstSlide, index = _a.index;
281
+ // Should check the active slide as well as user may have moved to different slide before the first slide is loaded
282
+ if (this.settings.autoplayFirstVideo &&
283
+ isFirstSlide &&
284
+ index === this.core.index) {
285
+ // Delay is just for the transition effect on video load
286
+ setTimeout(function () {
287
+ _this.loadAndPlayVideo(index);
288
+ }, 200);
289
+ }
290
+ // Should not call on first slide. should check only if the slide is active
291
+ if (!isFirstSlide &&
292
+ this.settings.autoplayVideoOnSlide &&
293
+ index === this.core.index) {
294
+ this.loadAndPlayVideo(index);
295
+ }
296
+ };
297
+
298
+ /**
299
+ * @desc Event triggered when video url or poster found
300
+ * Append video HTML is poster is not given
301
+ * Play if autoplayFirstVideo is true
302
+ *
303
+ * @param {Event} event - Javascript Event object.
304
+ */
305
+ Video.prototype.onHasVideo = function (event) {
306
+ var _a = event.detail, index = _a.index, src = _a.src, html5Video = _a.html5Video, hasPoster = _a.hasPoster;
307
+ if (!hasPoster) {
308
+ // All functions are called separately if poster exist in loadVideoOnPosterClick function
309
+ this.appendVideos(this.core.getSlideItem(index), {
310
+ src: src,
311
+ addClass: 'lg-object',
312
+ index: index,
313
+ html5Video: html5Video,
314
+ });
315
+ // Automatically navigate to next slide once video reaches the end.
316
+ this.gotoNextSlideOnVideoEnd(src, index);
317
+ } else {
318
+ // jadams
319
+ var slideItem = this.core.getSlideItem(index);
320
+ }
321
+ };
322
+
323
+ /**
324
+ * @desc fired immediately before each slide transition.
325
+ * Pause the previous video
326
+ * Hide the download button if the slide contains YouTube, Vimeo, or Wistia videos.
327
+ *
328
+ * @param {Event} event - Javascript Event object.
329
+ * @param {number} prevIndex - Previous index of the slide.
330
+ * @param {number} index - Current index of the slide
331
+ */
332
+ Video.prototype.onBeforeSlide = function (event) {
333
+ if (this.core.lGalleryOn) {
334
+ var prevIndex = event.detail.prevIndex;
335
+ this.pauseVideo(prevIndex);
336
+ }
337
+ };
338
+
339
+ /**
340
+ * @desc fired immediately after each slide transition.
341
+ * Play video if autoplayVideoOnSlide option is enabled.
342
+ *
343
+ * @param {Event} event - Javascript Event object.
344
+ * @param {number} prevIndex - Previous index of the slide.
345
+ * @param {number} index - Current index of the slide
346
+ * @todo should check on onSlideLoad as well if video is not loaded on after slide
347
+ */
348
+ Video.prototype.onAfterSlide = function (event) {
349
+ var _this = this;
350
+ var _a = event.detail, index = _a.index, prevIndex = _a.prevIndex;
351
+ // Do not call on first slide
352
+ var $slide = this.core.getSlideItem(index);
353
+ if (this.settings.autoplayVideoOnSlide && index !== prevIndex) {
354
+ if ($slide.hasClass('lg-complete')) {
355
+ setTimeout(function () {
356
+ _this.loadAndPlayVideo(index);
357
+ }, 100);
358
+ }
359
+ }
360
+ };
361
+
362
+ Video.prototype.loadAndPlayVideo = function (index) {
363
+ var $slide = this.core.getSlideItem(index);
364
+ var currentGalleryItem = this.core.galleryItems[index];
365
+ if (currentGalleryItem.poster) {
366
+ this.loadVideoOnPosterClick($slide, true);
367
+ }
368
+ else {
369
+ this.playVideo(index);
370
+ }
371
+ };
372
+ /**
373
+ * Play HTML5, Youtube, Vimeo or Wistia videos in a particular slide.
374
+ * @param {number} index - Index of the slide
375
+ */
376
+ Video.prototype.playVideo = function (index) {
377
+ this.controlVideo(index, 'play');
378
+ };
379
+
380
+ /**
381
+ * Pause HTML5, Youtube, Vimeo or Wistia videos in a particular slide.
382
+ * @param {number} index - Index of the slide
383
+ */
384
+ Video.prototype.pauseVideo = function (index) {
385
+ this.controlVideo(index, 'pause');
386
+ };
387
+
388
+ Video.prototype.getVideoHtml = function (src, addClass, index, html5Video) {
389
+ var video = '';
390
+ var videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};
391
+ var currentGalleryItem = this.core.galleryItems[index];
392
+ var videoTitle = currentGalleryItem.title || currentGalleryItem.alt;
393
+ videoTitle = videoTitle ? 'title="' + videoTitle + '"' : '';
394
+ var commonIframeProps = "allowtransparency=\"true\"\n frameborder=\"0\"\n scrolling=\"no\"\n allowfullscreen\n mozallowfullscreen\n webkitallowfullscreen\n msallowfullscreen";
395
+ if (videoInfo.youtube) {
396
+ var videoId = 'lg-youtube' + index;
397
+ var youTubeParams = getYouTubeParams(videoInfo, this.settings.youTubePlayerParams);
398
+ var isYouTubeNoCookieURL = isYouTubeNoCookie(src);
399
+ var youtubeURL = isYouTubeNoCookieURL
400
+ ? '//www.youtube-nocookie.com/'
401
+ : '//www.youtube.com/';
402
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-youtube " + addClass + "\" " + videoTitle + " src=\"" + youtubeURL + "embed/" + (videoInfo.youtube[1] + youTubeParams) + "\" " + commonIframeProps + "></iframe>";
403
+ }
404
+ else if (videoInfo.vimeo) {
405
+ var videoId = 'lg-vimeo' + index;
406
+ var playerParams = getVimeoURLParams(this.settings.vimeoPlayerParams, videoInfo);
407
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-vimeo " + addClass + "\" " + videoTitle + " src=\"//player.vimeo.com/video/" + (videoInfo.vimeo[1] + playerParams) + "\" " + commonIframeProps + "></iframe>";
408
+ }
409
+ // jadams: added Wistia Player
410
+ else if (videoInfo.wistia) {
411
+ var wistiaId = 'lg-wistia' + index;
412
+ var playerParams = param(this.settings.wistiaPlayerParams);
413
+ playerParams = playerParams ? '?' + playerParams : '';
414
+ video = "<iframe allow=\"autoplay\" id=\"" + wistiaId + "\" src=\"//fast.wistia.net/embed/" + videoInfo.wistia[3] + (videoInfo.wistia[4] + playerParams) + "\" " + videoTitle + " class=\"wistia_embed lg-video-object lg-wistia " + addClass + "\" name=\"wistia_embed\" " + commonIframeProps + "></iframe>";
415
+ }
416
+ // jadams: added Dailymotion Player
417
+ else if (videoInfo.dailymotion) {
418
+ var dailymotionId = 'lg-dailymotion' + index;
419
+ var playerParams = param(this.settings.dailymotionPlayerParams);
420
+ playerParams = playerParams ? '?' + playerParams : '';
421
+ video = "<iframe allow=\"autoplay\" id=\"" + dailymotionId + "\" src=\"//www.dailymotion.com/embed/video/" + (videoInfo.dailymotion[1] + playerParams) + "\" " + videoTitle + " class=\"dailymotion_embed lg-video-object lg-dailymotion " + addClass + "\" name=\"dailymotion_embed\" " + commonIframeProps + "></iframe>";
422
+ }
423
+ // jadams, 2024-01-22: added TicToc Player
424
+ else if (videoInfo.tiktoc) {
425
+ var tictocId = 'lg-tictoc' + index;
426
+ var playerParams = getTikTokURLParams(this.settings.TicTocPlayerParams);
427
+ video = "<iframe allow=\"autoplay\" id=" + videoId + " class=\"lg-video-object lg-tictoc " + addClass + "\" " + videoTitle + " src=\"//tiktok.com/embed/" + (videoInfo.tiktoc[1]) + "\" " + videoTitle + commonIframeProps + "></iframe>";
428
+ }
429
+ else if (videoInfo.html5) {
430
+ var html5VideoMarkup = '';
431
+ for (var i = 0; i < html5Video.source.length; i++) {
432
+ html5VideoMarkup += "<source src=\"" + html5Video.source[i].src + "\" type=\"" + html5Video.source[i].type + "\">";
433
+ }
434
+ if (html5Video.tracks) {
435
+ var _loop_1 = function (i) {
436
+ var trackAttributes = '';
437
+ var track = html5Video.tracks[i];
438
+ Object.keys(track || {}).forEach(function (key) {
439
+ trackAttributes += key + "=\"" + track[key] + "\" ";
440
+ });
441
+ html5VideoMarkup += "<track " + trackAttributes + ">";
442
+ };
443
+ for (var i = 0; i < html5Video.tracks.length; i++) {
444
+ _loop_1(i);
445
+ }
446
+ }
447
+ var html5VideoAttrs_1 = '';
448
+ var videoAttributes_1 = html5Video.attributes || {};
449
+ Object.keys(videoAttributes_1 || {}).forEach(function (key) {
450
+ html5VideoAttrs_1 += key + "=\"" + videoAttributes_1[key] + "\" ";
451
+ });
452
+ video = "<video class=\"lg-video-object lg-html5 " + (this.settings.videojs && this.settings.videojsTheme
453
+ ? this.settings.videojsTheme + ' '
454
+ : '') + " " + (this.settings.videojs ? ' video-js' : '') + "\" " + html5VideoAttrs_1 + ">\n " + html5VideoMarkup + "\n Your browser does not support HTML5 video.\n </video>";
455
+ }
456
+ return video;
457
+ };
458
+
459
+ /**
460
+ * @desc - Append videos to the slide
461
+ *
462
+ * @param {HTMLElement} el - slide element
463
+ * @param {Object} videoParams - Video parameters, Contains src, class, index, htmlVideo
464
+ */
465
+ Video.prototype.appendVideos = function (el, videoParams) {
466
+ var _a;
467
+ var videoHtml = this.getVideoHtml(videoParams.src, videoParams.addClass, videoParams.index, videoParams.html5Video);
468
+ el.find('.lg-video-cont').append(videoHtml);
469
+ var $videoElement = el.find('.lg-video-object').first();
470
+ if (videoParams.html5Video) {
471
+ $videoElement.on('mousedown.lg.video', function (e) {
472
+ e.stopPropagation();
473
+ });
474
+ }
475
+ if (this.settings.videojs && ((_a = this.core.galleryItems[videoParams.index].__slideVideoInfo) === null || _a === void 0 ? void 0 : _a.html5)) {
476
+ try {
477
+ return videojs($videoElement.get(), this.settings.videojsOptions);
478
+ }
479
+ catch (e) {
480
+ console.warn('lightGallery: Make sure you have included videojs');
481
+ }
482
+ }
483
+ };
484
+
485
+ Video.prototype.gotoNextSlideOnVideoEnd = function (src, index) {
486
+ var _this = this;
487
+ var $videoElement = this.core
488
+ .getSlideItem(index)
489
+ .find('.lg-video-object')
490
+ .first();
491
+ var videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};
492
+ if (this.settings.gotoNextSlideOnVideoEnd) {
493
+ if (videoInfo.html5) {
494
+ $videoElement.on('ended', function () {
495
+ _this.core.goToNextSlide();
496
+ });
497
+ }
498
+ else if (videoInfo.vimeo) {
499
+ try {
500
+ // https://github.com/vimeo/player.js/#ended
501
+ new Vimeo.Player($videoElement.get()).on('ended', function () {
502
+ _this.core.goToNextSlide();
503
+ });
504
+ }
505
+ catch (e) {
506
+ // jadams:
507
+ console.warn('lightGallery: Make sure you have included //github.com/vimeo/player.js');
508
+ }
509
+ }
510
+ else if (videoInfo.wistia) {
511
+ try {
512
+ window._wq = window._wq || [];
513
+ // @todo Event is gettign triggered multiple times
514
+ window._wq.push({
515
+ id: $videoElement.attr('id'),
516
+ onReady: function (video) {
517
+ video.bind('end', function () {
518
+ _this.core.goToNextSlide();
519
+ });
520
+ },
521
+ });
522
+ }
523
+ catch (e) {
524
+ // jadams:
525
+ console.warn('lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js');
526
+ }
527
+ }
528
+ }
529
+ };
530
+
531
+ Video.prototype.controlVideo = function (index, action) {
532
+ var trackSrc,
533
+ $videoElement, videoInfo, videoStart, videoData, videoId,
534
+ videojsPlayer, zoomPlugin;
535
+
536
+ var playbackRatesDefaults = '[0.25, 0.5, 1, 1.5, 2]';
537
+ var chapterTracksEnabled = false;
538
+
539
+ var hotkeysPluginDefaults = {
540
+ volumeStep: 0.1,
541
+ seekStep: 5,
542
+ enableMute: true,
543
+ enableVolumeScroll: true,
544
+ enableHoverScroll: false,
545
+ enableFullscreen: true,
546
+ enableNumbers: true,
547
+ enableJogStyle: false,
548
+ alwaysCaptureHotkeys: false,
549
+ captureDocumentHotkeys: false,
550
+ enableModifiersForNumbers: false,
551
+ enableInactiveFocus: true,
552
+ skipInitialFocus: false
553
+ };
554
+
555
+ var zoomPluginDefaults = {
556
+ moveX: 0,
557
+ moveY: 0,
558
+ rotate: 0,
559
+ zoom: 1
560
+ };
561
+
562
+ videoInfo = this.core.galleryItems[index].__slideVideoInfo || {};
563
+ $videoElement = this.core
564
+ .getSlideItem(index)
565
+ .find('.lg-video-object')
566
+ .first()
567
+
568
+ // chapter tracks only available for VJS
569
+ //
570
+ if (this.core.galleryItems[this.core.index].video !== undefined && videoInfo.html5) {
571
+ videoData = JSON.parse(this.core.galleryItems[this.core.index].video);
572
+ if (videoData.tracks !== undefined && videoData.tracks.length > 0) {
573
+ for (var i=0; i<videoData.tracks.length; i++) {
574
+ if (videoData.tracks[i].kind == 'chapters') {
575
+ trackSrc = videoData.tracks[i].src;
576
+ chapterTracksEnabled = true;
577
+ }
578
+ }
579
+ } // END if videoData.tracks
580
+
581
+ if ($videoElement.selector !== undefined) {
582
+ videoId = $videoElement.selector.id;
583
+ videojsPlayer = videojs(videoId);
584
+ } else {
585
+ videojsPlayer = 'unknown';
586
+ }
587
+
588
+ if (videojsPlayer !== 'unknown') {
589
+
590
+ // jadams, 2024-06-16: added VJS Plugins hotkeys|zoom, playbackRates
591
+ // ---------------------------------------------------------------
592
+ var hotkeysPlugin = this.settings.videojsOptions.controlBar.hotkeysPlugin;
593
+ var zoomPlugin = this.settings.videojsOptions.controlBar.zoomPlugin;
594
+ var playbackRates = (this.settings.videojsOptions.controlBar.playbackRates !== undefined) ? this.settings.videojsOptions.controlBar.playbackRates : playbackRatesDefaults;
595
+
596
+ // jadams, 2024-01-22: added video start position
597
+ // ---------------------------------------------------------------
598
+ if (this.settings.videojsOptions.videoStart !== undefined) {
599
+ videoStart = this.settings.videojsOptions.videoStart[index];
600
+ videojsPlayer.on("play", function() {
601
+ var startFromSecond = new Date('1970-01-01T' + videoStart + 'Z').getTime() / 1000;
602
+ videojsPlayer.currentTime(startFromSecond);
603
+
604
+ }); // END on "play"
605
+ } // END if videoStart
606
+
607
+ // add playbackRates (only available for VJS)
608
+ videojsPlayer.playbackRates(playbackRates);
609
+
610
+ // add hotkeysPlugin (only available for VJS)
611
+ if (hotkeysPlugin !== undefined && hotkeysPlugin.enabled) {
612
+ hotkeysPlugin.options = __assign(__assign({}, hotkeysPluginDefaults), hotkeysPlugin.options);
613
+ videojsPlayer.hotkeys({
614
+ enableModifiersForNumbers: hotkeysPlugin.options.enableModifiersForNumbers
615
+ });
616
+ } // END if hotkeysPlugin enabled
617
+
618
+ // add zoomPlugin (only available for VJS)
619
+ if (zoomPlugin !== undefined && zoomPlugin.enabled) {
620
+ zoomPlugin.options = __assign(__assign({}, zoomPluginDefaults), zoomPlugin.options);
621
+ videojsPlayer.zoomPlugin({
622
+ moveX: zoomPlugin.options.moveX,
623
+ moveY: zoomPlugin.options.moveY,
624
+ rotate: zoomPlugin.options.rotate,
625
+ zoom: zoomPlugin.options.zoom
626
+ });
627
+ } // END if zoomPlugin enabled
628
+
629
+ // jadams, 2023-12-11: added chapter track processing (only available for VJS)
630
+ // -----------------------------------------------------------------
631
+ if (chapterTracksEnabled) {
632
+ var parser = new WebVTTParser();
633
+ var markers = [];
634
+
635
+ function cb_load (data /* ,textStatus, jqXHR */ ) {
636
+ var tree = parser.parse(data, 'metadata');
637
+ var marker;
638
+
639
+ // add chapter tracks to markers array
640
+ for (var i=0; i<tree.cues.length; i++) {
641
+ marker = { time: tree.cues[i].startTime, label: tree.cues[i].text };
642
+ markers.push(marker);
643
+ }
644
+ }; // END callback
645
+
646
+ // load chapter tracks
647
+ loadVtt(trackSrc, cb_load);
648
+
649
+ // add chapter tracks on play
650
+ videojsPlayer.on("play", function() {
651
+ videojsPlayer.currentTime(videoStart);
652
+
653
+ var total = videojsPlayer.duration();
654
+ var timeline = $(videojsPlayer.controlBar.progressControl.children_[0].el_);
655
+
656
+ // add chapter tracks on timeline (delayed)
657
+ setTimeout (function() {
658
+ var markers_loaded = setInterval (function () {
659
+ if (markers.length) {
660
+ for (var i=0; i<markers.length; i++) {
661
+ var left = (markers[i].time / total * 100) + '%';
662
+ var time = markers[i].time;
663
+ var el = $('<div class="vjs-chapter-marker" style="left: ' +left+ '" data-time="' +time+ '"> <span>' +markers[i].label+ '</span></div>');
664
+
665
+ el.click(function() {
666
+ videojsPlayer.currentTime($(this).data('time'));
667
+ });
668
+
669
+ timeline.append(el);
670
+ }
671
+ clearInterval(markers_loaded);
672
+ }
673
+ }, 10);
674
+ }, 1000 );
675
+
676
+ }); // END on "play"
677
+
678
+ } // END if chapterTracksEnabled
679
+
680
+ } // END if videojsPlayer is defined
681
+
682
+ } // END if videoInfo.html5
683
+
684
+ if (!$videoElement.get())
685
+ return;
686
+ if (videoInfo.youtube) {
687
+ try {
688
+ $videoElement.get().contentWindow.postMessage("{\"event\":\"command\",\"func\":\"" + action + "Video\",\"args\":\"\"}", '*');
689
+ }
690
+ catch (e) {
691
+ console.error("lightGallery:- " + e);
692
+ }
693
+ }
694
+ else if (videoInfo.vimeo) {
695
+ try {
696
+ new Vimeo.Player($videoElement.get())[action]();
697
+ }
698
+ catch (e) {
699
+ console.warn('lightGallery: Make sure you have included //github.com/vimeo/player.js');
700
+ }
701
+ }
702
+ else if (videoInfo.html5) {
703
+ if (this.settings.videojs) {
704
+ try {
705
+ videojs($videoElement.get())[action]();
706
+ }
707
+ catch (e) {
708
+ console.warn('lightGallery: Make sure you have included videojs');
709
+ }
710
+ }
711
+ else {
712
+ $videoElement.get()[action]();
713
+ }
714
+ }
715
+ else if (videoInfo.wistia) {
716
+ try {
717
+ window._wq = window._wq || [];
718
+ // @todo Find a way to destroy wistia player instance
719
+ window._wq.push({
720
+ id: $videoElement.attr('id'),
721
+ onReady: function (video) {
722
+ video[action]();
723
+ },
724
+ });
725
+ }
726
+ catch (e) {
727
+ console.warn('lightGallery: Make sure you have included //fast.wistia.com/assets/external/E-v1.js');
728
+ }
729
+ }
730
+ };
731
+
732
+ Video.prototype.loadVideoOnPosterClick = function ($el, forcePlay) {
733
+ var _this = this;
734
+ // check slide has poster
735
+ if (!$el.hasClass('lg-video-loaded')) {
736
+ // check if video element present
737
+ if (!$el.hasClass('lg-has-video')) {
738
+ $el.addClass('lg-has-video');
739
+ var _html = void 0;
740
+ var _src = this.core.galleryItems[this.core.index].src;
741
+ var video = this.core.galleryItems[this.core.index].video;
742
+ if (video) {
743
+ _html =
744
+ typeof video === 'string' ? JSON.parse(video) : video;
745
+ }
746
+ var videoJsPlayer_1 = this.appendVideos($el, {
747
+ src: _src,
748
+ addClass: '',
749
+ index: this.core.index,
750
+ html5Video: _html,
751
+ });
752
+ this.gotoNextSlideOnVideoEnd(_src, this.core.index);
753
+ var $tempImg = $el.find('.lg-object').first().get();
754
+ // @todo make sure it is working
755
+ $el.find('.lg-video-cont').first().append($tempImg);
756
+ $el.addClass('lg-video-loading');
757
+ videoJsPlayer_1 &&
758
+ videoJsPlayer_1.ready(function () {
759
+ videoJsPlayer_1.on('loadedmetadata', function () {
760
+ _this.onVideoLoadAfterPosterClick($el, _this.core.index);
761
+ });
762
+ });
763
+ $el.find('.lg-video-object')
764
+ .first()
765
+ .on('load.lg error.lg loadedmetadata.lg', function () {
766
+ setTimeout(function () {
767
+ _this.onVideoLoadAfterPosterClick($el, _this.core.index);
768
+ }, 50);
769
+ });
770
+ }
771
+ else {
772
+ this.playVideo(this.core.index);
773
+ }
774
+ }
775
+ else if (forcePlay) {
776
+ this.playVideo(this.core.index);
777
+ }
778
+ };
779
+
780
+ Video.prototype.onVideoLoadAfterPosterClick = function ($el, index) {
781
+ $el.addClass('lg-video-loaded');
782
+ this.playVideo(index);
783
+ };
784
+
785
+ Video.prototype.destroy = function () {
786
+ this.core.LGel.off('.lg.video');
787
+ this.core.LGel.off('.video');
788
+ };
789
+ return Video;
790
+ }());
791
+
792
+ return Video;
793
+
794
+ })));