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.
- checksums.yaml +4 -4
- data/_includes/themes/j1/layouts/content_generator_news_panel_posts.html +1 -1
- data/_includes/themes/j1/layouts/layout_resource_generator.html +1 -4
- data/_includes/themes/j1/procedures/blocks/footer/boxes/social_media_icons.proc +24 -23
- data/_includes/themes/j1/procedures/layouts/content_writer.proc +4 -3
- data/_includes/themes/j1/procedures/layouts/default_writer.proc +37 -6
- data/_includes/themes/j1/procedures/layouts/module_writer.proc +31 -95
- data/_includes/themes/j1/procedures/layouts/resource_writer.proc +51 -29
- data/assets/data/amplitude.28.html +887 -0
- data/assets/data/amplitude.29.html +923 -0
- data/assets/data/amplitude.html +311 -46
- data/assets/data/banner.html +9 -7
- data/assets/data/masterslider.html +128 -7
- data/assets/data/panel.html +16 -65
- data/assets/theme/j1/adapter/js/amplitude.23.js +1165 -0
- data/assets/theme/j1/adapter/js/amplitude.24.js +1164 -0
- data/assets/theme/j1/adapter/js/amplitude.25.js +1268 -0
- data/assets/theme/j1/adapter/js/amplitude.js +294 -117
- data/assets/theme/j1/adapter/js/attic.js +14 -11
- data/assets/theme/j1/adapter/js/docsearch.js +2 -2
- data/assets/theme/j1/adapter/js/fab.js +2 -2
- data/assets/theme/j1/adapter/js/j1.js +8 -8
- data/assets/theme/j1/adapter/js/lazyLoader.js +60 -10
- data/assets/theme/j1/adapter/js/masonry.js +1 -1
- data/assets/theme/j1/adapter/js/masterslider.js +2 -2
- data/assets/theme/j1/adapter/js/particles.js +2 -2
- data/assets/theme/j1/adapter/js/scroller.js +2 -2
- data/assets/theme/j1/adapter/js/slick.js +2 -2
- data/assets/theme/j1/adapter/js/themes.js +1 -1
- data/assets/theme/j1/adapter/js/translator.js +2 -2
- data/assets/theme/j1/adapter/js/waves.js +1 -1
- data/assets/theme/j1/core/css/animate.css +1634 -1070
- data/assets/theme/j1/core/css/animate.css.map +1 -0
- data/assets/theme/j1/core/css/animate.min.css +2 -1
- data/assets/theme/j1/core/css/animate.min.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/fontawesome.css +3060 -1538
- data/assets/theme/j1/core/css/icon-fonts/fontawesome.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css +2 -1
- data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/iconify.css +2308 -1153
- data/assets/theme/j1/core/css/icon-fonts/iconify.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/iconify.min.css +2 -1
- data/assets/theme/j1/core/css/icon-fonts/iconify.min.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdi.css +16716 -8423
- data/assets/theme/j1/core/css/icon-fonts/mdi.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdi.min.css +2 -1
- data/assets/theme/j1/core/css/icon-fonts/mdi.min.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdib.css +5554 -2766
- data/assets/theme/j1/core/css/icon-fonts/mdib.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdib.min.css +2 -1
- data/assets/theme/j1/core/css/icon-fonts/mdib.min.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdil.css +742 -441
- data/assets/theme/j1/core/css/icon-fonts/mdil.css.map +1 -0
- data/assets/theme/j1/core/css/icon-fonts/mdil.min.css +2 -1
- data/assets/theme/j1/core/css/icon-fonts/mdil.min.css.map +1 -0
- data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css +6552 -3980
- data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css.map +1 -0
- data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -5
- data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css.map +1 -0
- data/assets/theme/j1/core/css/themes/unodark/bootstrap.css +6818 -4131
- data/assets/theme/j1/core/css/themes/unodark/bootstrap.css.map +1 -0
- data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css +2 -5
- data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css.map +1 -0
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +18568 -11577
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -0
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +2 -35
- data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -0
- data/assets/theme/j1/core/css/vendor.css +1771 -1043
- data/assets/theme/j1/core/css/vendor.css.map +1 -0
- data/assets/theme/j1/core/css/vendor.min.css +2 -1
- data/assets/theme/j1/core/css/vendor.min.css.map +1 -0
- data/assets/theme/j1/core/js/template.js +399 -447
- data/assets/theme/j1/core/js/template.min.js +7 -7
- data/assets/theme/j1/core/js/template.min.js.map +1 -1
- data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +4 -2
- data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +39 -4
- data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
- data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +57 -17
- data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
- data/assets/theme/j1/modules/amplitudejs/icons/player/blue/pause.png +0 -0
- data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.png +0 -0
- data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.svg +87 -0
- data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +60 -0
- data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +59 -0
- data/assets/theme/j1/modules/amplitudejs/js/amplitude.js +65 -21
- data/assets/theme/j1/modules/amplitudejs/js/amplitude.min.js +1 -1
- data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +113 -0
- data/assets/theme/j1/modules/iconPicker/js/universal-icon-picker.js +471 -471
- data/assets/theme/j1/modules/j1LazyLoader/LICENSE +21 -0
- data/assets/theme/j1/modules/j1LazyLoader/js/j1Lazy.js +870 -0
- data/assets/theme/j1/modules/js-cookies/js/js.cookie.js +3 -3
- data/assets/theme/j1/modules/lazyCssLoader/js/main.0.js +166 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/main.1.js +65 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/main.js +66 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/plugins/examplePlugin.js +13 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/plugins/my-plugin.js +25 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/plugins/plugin-interface.js +9 -0
- data/assets/theme/j1/modules/lazyCssLoader/js/plugins/pluginA.js +46 -0
- data/assets/theme/j1/modules/lazyLoader/js/plugins/README.md +324 -0
- data/assets/theme/j1/modules/lazyLoader/js/plugins/jquery.lazy.picture.js +188 -0
- data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +1 -1
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +794 -0
- data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +151 -67
- data/assets/theme/j1/modules/slimSelect/js/select.js +1 -1
- data/assets/theme/j1/modules/slimSelect/js/select.min.js +3 -3
- data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +2 -1
- data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.min.js +1 -1
- data/assets/theme/j1/modules/videojs/js/plugins/players/dm/icon/scalable/dailymotion.svg +62 -0
- data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.js +832 -0
- data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.min.js +17 -0
- data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.min.js +1 -1
- data/assets/theme/j1/modules/videojs/js/video.js +2 -2
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/README.md +577 -560
- data/lib/starter_web/_config.yml +2 -2
- data/lib/starter_web/_data/blocks/footer.yml +10 -5
- data/lib/starter_web/_data/blocks/panel.yml +2 -2
- data/lib/starter_web/_data/layouts/default.yml +14 -3
- data/lib/starter_web/_data/modules/amplitude.yml +145 -0
- data/lib/starter_web/_data/modules/defaults/amplitude.yml +29 -7
- data/lib/starter_web/_data/modules/defaults/lazyLoader.yml +2 -2
- data/lib/starter_web/_data/modules/gallery.yml +136 -0
- data/lib/starter_web/_data/modules/lazyLoader.0.yml +118 -0
- data/lib/starter_web/_data/modules/lazyLoader.yml +68 -31
- data/lib/starter_web/_data/modules/masonry.yml +4 -4
- data/lib/starter_web/_data/modules/masterslider.yml +118 -12
- data/lib/starter_web/_data/modules/navigator_menu.yml +831 -803
- data/lib/starter_web/_data/resources.yml +154 -190
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_includes/attributes.asciidoc +1 -0
- data/lib/starter_web/_plugins/asciidoctor/amplitude-block.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/gallery-block.rb +4 -2
- data/lib/starter_web/_plugins/asciidoctor/masonry-block.rb +1 -1
- data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +58 -46
- data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +26 -19
- data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +30 -40
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/assets/image/icons/lanus/favicon.ico +0 -0
- data/lib/starter_web/assets/image/icons/lanus/lanus-512x512.png +0 -0
- data/lib/starter_web/assets/image/icons/lanus/lanus.ico +0 -0
- data/lib/starter_web/assets/image/icons/lanus/lanus.png +0 -0
- data/lib/starter_web/assets/image/icons/lanus/scalable/lanus.svg +76 -0
- data/lib/starter_web/assets/image/icons/lanus/scalable/lanus_sw.svg +62 -0
- data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28 - social.svg +86 -0
- data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28.svg +64 -0
- data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x.svg +1 -0
- data/lib/starter_web/assets/image/modules/icons/social/twitter_x.png +0 -0
- data/lib/starter_web/package.json +7 -18
- data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +218 -0
- data/lib/starter_web/pages/public/features/template.adoc +18 -8
- data/lib/starter_web/pages/public/features/template.asciidoc +758 -0
- data/lib/starter_web/pages/public/lazy_loader_tester.adoc +402 -0
- data/lib/starter_web/pages/public/manuals/ytdl/man.adoc +3020 -0
- data/lib/starter_web/pages/public/manuals/ytdl/man.md +2378 -0
- data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +0 -16
- data/lib/starter_web/pages/public/tools/previewer/_includes/documents/amplitudejs.large.css.asciidoc +505 -0
- data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.hover.html +69 -0
- data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.nested.html +75 -0
- data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.textarea.html +57 -0
- data/lib/starter_web/pages/public/tools/previewer/_includes/documents/my.content.html +112 -0
- data/lib/starter_web/pages/public/tools/previewer/preview_amplitudejs.adoc +172 -0
- data/lib/starter_web/pages/public/tour/_includes/attributes.asciidoc +2 -2
- data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +16 -16
- data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +13 -3
- data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +12 -3
- data/lib/starter_web/pages/public/tour/highlghter_rouge.adoc +13 -3
- data/lib/starter_web/pages/public/tour/icon_fonts.adoc +12 -3
- data/lib/starter_web/pages/public/tour/modal_extentions.adoc +12 -6
- data/lib/starter_web/pages/public/tour/{playback_audio.adoc → play_audio.adoc} +207 -188
- data/lib/starter_web/pages/public/tour/{playback_video.adoc → play_video.adoc} +49 -51
- data/lib/starter_web/pages/public/tour/present_images.adoc +27 -5
- data/lib/starter_web/pages/public/tour/quicksearch.adoc +13 -3
- data/lib/starter_web/pages/public/tour/responsive_tables.adoc +13 -4
- data/lib/starter_web/pages/public/tour/typography.adoc +12 -3
- metadata +90 -22
- /data/assets/theme/j1/modules/{lazyLoader → j1LazyLoader/js}/plugins/README.md +0 -0
- /data/assets/theme/j1/modules/{lazyLoader/plugins/jquery.lazy.picture.js → j1LazyLoader/js/plugins/picture.js} +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.picture.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.min.js +0 -0
- /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.js +0 -0
- /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
|
+
})));
|