j1-template 2024.3.15 → 2024.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/amplitude.html +7 -7
  3. data/assets/data/panel.html +4 -3
  4. data/assets/theme/j1/adapter/js/amplitude.js +100 -81
  5. data/assets/theme/j1/adapter/js/masonry.js +2 -2
  6. data/assets/theme/j1/adapter/js/videojs.js +212 -0
  7. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +7 -4
  8. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -1
  9. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  10. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -1
  11. data/assets/theme/j1/core/js/template.js +4 -0
  12. data/assets/theme/j1/core/js/template.min.js +2 -2
  13. data/assets/theme/j1/core/js/template.min.js.map +1 -1
  14. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +81 -1
  15. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.min.css +1 -1
  16. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +3 -2
  17. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
  18. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +19 -4
  19. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
  20. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/artist.svg +78 -0
  21. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/mute.svg +52 -20
  22. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/next.svg +20 -39
  23. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/now-playing.svg +24 -38
  24. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-hide.svg +85 -0
  25. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-music.svg +85 -0
  26. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-show.svg +85 -0
  27. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist.svg +85 -0
  28. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/previous.svg +18 -37
  29. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +33 -30
  30. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +33 -29
  31. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/small/next.svg +55 -14
  32. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/small/previous.svg +56 -14
  33. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/volume.svg +38 -21
  34. data/assets/theme/j1/modules/amplitudejs/js/amplitude.map +20 -20
  35. data/assets/theme/j1/modules/amplitudejs/js/tech/youtube_example.js +211 -0
  36. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +206 -122
  37. data/assets/theme/j1/modules/videojs/assets/icons/custom-icons/next.svg +82 -0
  38. data/assets/theme/j1/modules/videojs/css/font/README.md +151 -0
  39. data/assets/theme/j1/modules/videojs/css/font/VideoJS.svg +150 -0
  40. data/assets/theme/j1/modules/videojs/css/font/video-js-cdn.css +2012 -0
  41. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.0.css +32 -0
  42. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.1.css +31 -0
  43. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.css +31 -0
  44. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.min.css +21 -0
  45. data/assets/theme/j1/modules/videojs/css/themes/uno.css +14 -3
  46. data/assets/theme/j1/modules/videojs/css/themes/uno.min.css +1 -1
  47. data/assets/theme/j1/modules/videojs/css/videojs.css +1 -0
  48. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/LICENSE +13 -0
  49. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/README.md +75 -0
  50. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/autocaption.js +149 -0
  51. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/autocaption.min.js +21 -0
  52. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/README.md +76 -30
  53. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/hotkeys.js +64 -53
  54. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/hotkeys.min.js +1 -1
  55. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/README.md +133 -0
  56. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/skipbuttons.js +137 -0
  57. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/skipbuttons.min.js +21 -0
  58. data/assets/theme/j1/modules/videojs/js/plugins/controls/zoom/zoom.js +15 -12
  59. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.js +43 -16
  60. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.3/fastfilereaderext.so +0 -0
  61. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.3/rubyeventmachine.so +0 -0
  62. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.4/fastfilereaderext.so +0 -0
  63. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.4/rubyeventmachine.so +0 -0
  64. data/lib/j1/version.rb +1 -1
  65. data/lib/j1_app/j1_auth_manager/config.rb +0 -4
  66. data/lib/starter_web/Gemfile +45 -22
  67. data/lib/starter_web/README.md +5 -5
  68. data/lib/starter_web/_config.yml +4 -6
  69. data/lib/starter_web/_data/modules/amplitude.yml +9 -399
  70. data/lib/starter_web/_data/modules/defaults/gallery.yml +42 -0
  71. data/lib/starter_web/_data/modules/defaults/videojs.yml +107 -0
  72. data/lib/starter_web/_data/modules/gallery.yml +30 -14
  73. data/lib/starter_web/_data/modules/masonry.yml +15 -0
  74. data/lib/starter_web/_data/modules/videojs.yml +57 -0
  75. data/lib/starter_web/_data/resources.yml +9 -27
  76. data/lib/starter_web/_data/templates/feed.xml +1 -1
  77. data/lib/starter_web/_includes/tables/jekyll_variables.asciidoc +1 -0
  78. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +4 -1
  79. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +145 -24
  80. data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +4 -1
  81. data/lib/starter_web/_plugins/asciidoctor/wistia-block.rb +313 -0
  82. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +192 -17
  83. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  84. data/lib/starter_web/package.json +1 -1
  85. data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +20 -7
  86. data/lib/starter_web/pages/public/manuals/integrations/amplitudejs/amplitudejs-api.adoc +1 -1
  87. data/lib/starter_web/pages/public/manuals/integrations/videojs/youtube-api.adoc +1638 -0
  88. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +5 -6
  89. data/lib/starter_web/pages/public/tools/previewer/preview_videojs.adoc +203 -0
  90. data/lib/starter_web/pages/{tour → public/tour}/play_audio.adoc +3 -10
  91. data/lib/starter_web/pages/{tour → public/tour}/play_video.adoc +49 -40
  92. metadata +61 -41
  93. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/_pause.svg +0 -19
  94. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/_play.svg +0 -18
  95. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/show-playlist.svg +0 -15
  96. data/assets/theme/j1/modules/jqueryScrollbar/LICENSE +0 -20
  97. data/assets/theme/j1/modules/jqueryScrollbar/README.md +0 -28
  98. data/assets/theme/j1/modules/jqueryScrollbar/css/scrollbar.css +0 -939
  99. data/assets/theme/j1/modules/jqueryScrollbar/css/scrollbar.min.css +0 -20
  100. data/assets/theme/j1/modules/jqueryScrollbar/js/scrollbar.js +0 -851
  101. data/assets/theme/j1/modules/jqueryScrollbar/js/scrollbar.min.js +0 -36
  102. data/assets/theme/j1/modules/jqueryScrollbar/sass/scrollbar.scss +0 -806
  103. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +0 -794
  104. /data/lib/starter_web/pages/{tour → public/tour}/_includes/attributes.asciidoc +0 -0
  105. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/100_gistblock.asciidoc +0 -0
  106. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_bottom_info.asciidoc +0 -0
  107. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  108. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  109. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_central_success.asciidoc +0 -0
  110. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  111. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  112. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  113. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_top_info.asciidoc +0 -0
  114. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_top_left_info.asciidoc +0 -0
  115. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/410_top_right_success.asciidoc +0 -0
  116. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
  117. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  118. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/themes_bootstrap.asciidoc +0 -0
  119. /data/lib/starter_web/pages/{tour → public/tour}/_includes/documents/themes_rouge.asciidoc +0 -0
  120. /data/lib/starter_web/pages/{tour → public/tour}/asciidoc_extensions.adoc +0 -0
  121. /data/lib/starter_web/pages/{tour → public/tour}/bootstrap_themes.adoc +0 -0
  122. /data/lib/starter_web/pages/{tour → public/tour}/highlghter_rouge.adoc +0 -0
  123. /data/lib/starter_web/pages/{tour → public/tour}/icon_fonts.adoc +0 -0
  124. /data/lib/starter_web/pages/{tour → public/tour}/modal_extentions.adoc +0 -0
  125. /data/lib/starter_web/pages/{tour → public/tour}/present_images.adoc +0 -0
  126. /data/lib/starter_web/pages/{tour → public/tour}/quicksearch.adoc +0 -0
  127. /data/lib/starter_web/pages/{tour → public/tour}/responsive_tables.adoc +0 -0
  128. /data/lib/starter_web/pages/{tour → public/tour}/typography.adoc +0 -0
@@ -1,794 +0,0 @@
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
- })));