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,832 @@
1
+ /*
2
+ # -----------------------------------------------------------------------------
3
+ # ~/assets/theme/j1/modules/videojs/js/yt/youtube.js
4
+ # Provides YiuTube Playback Technology (Tech) for Video.js V8 and newer
5
+ #
6
+ # Product/Info:
7
+ # http://jekyll.one
8
+ #
9
+ # Copyright (C) 2023, 2024 Juergen Adams
10
+ # Copyright (C) 2014-2015 Benoit Tremblay
11
+ #
12
+ # J1 Theme is licensed under MIT License.
13
+ # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
14
+ # -----------------------------------------------------------------------------
15
+ */
16
+
17
+ /*
18
+ The MIT License (MIT)
19
+
20
+ Copyright (c) 2014-2015 Benoit Tremblay <trembl.ben@gmail.com>
21
+
22
+ Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ of this software and associated documentation files (the "Software"), to deal
24
+ in the Software without restriction, including without limitation the rights
25
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ copies of the Software, and to permit persons to whom the Software is
27
+ furnished to do so, subject to the following conditions:
28
+
29
+ The above copyright notice and this permission notice shall be included in
30
+ all copies or substantial portions of the Software.
31
+
32
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
38
+ THE SOFTWARE.
39
+ */
40
+
41
+ /*global define, YT*/
42
+ (function (root, factory) {
43
+ if(typeof exports==='object' && typeof module!=='undefined') {
44
+ var videojs = require('video.js');
45
+ module.exports = factory(videojs.default || videojs);
46
+ } else if(typeof define === 'function' && define.amd) {
47
+ define(['videojs'], function(videojs){
48
+ return (root.Youtube = factory(videojs));
49
+ });
50
+ } else {
51
+ root.Youtube = factory(root.videojs);
52
+ }
53
+ }(this, function(videojs) {
54
+ 'use strict';
55
+
56
+ var _isOnMobile = videojs.browser.IS_IOS || videojs.browser.IS_ANDROID;
57
+ var Tech = videojs.getTech('Tech');
58
+
59
+ class Youtube extends Tech {
60
+
61
+ constructor(options, ready) {
62
+ super(options, ready);
63
+
64
+ this.setPoster(options.poster);
65
+ this.setSrc(this.options_.source, true);
66
+
67
+ // Set the vjs-youtube class to the player
68
+ // Parent is not set yet so we have to wait a tick
69
+ this.setTimeout(function() {
70
+ if (this.el_) {
71
+ this.el_.parentNode.className += ' vjs-youtube';
72
+
73
+ if (_isOnMobile) {
74
+ this.el_.parentNode.className += ' vjs-youtube-mobile';
75
+ }
76
+
77
+ if (Youtube.isApiReady) {
78
+ this.initYTPlayer();
79
+ } else {
80
+ Youtube.apiReadyQueue.push(this);
81
+ }
82
+ }
83
+ }.bind(this));
84
+ }
85
+
86
+ dispose() {
87
+ if (this.ytPlayer) {
88
+ //Dispose of the YouTube Player
89
+ if (this.ytPlayer.stopVideo) {
90
+ this.ytPlayer.stopVideo();
91
+ }
92
+ if (this.ytPlayer.destroy) {
93
+ this.ytPlayer.destroy();
94
+ }
95
+ } else {
96
+ //YouTube API hasn't finished loading or the player is already disposed
97
+ var index = Youtube.apiReadyQueue.indexOf(this);
98
+ if (index !== -1) {
99
+ Youtube.apiReadyQueue.splice(index, 1);
100
+ }
101
+ }
102
+ this.ytPlayer = null;
103
+
104
+ this.el_.parentNode.className = this.el_.parentNode.className
105
+ .replace(' vjs-youtube', '')
106
+ .replace(' vjs-youtube-mobile', '');
107
+ this.el_.parentNode.removeChild(this.el_);
108
+
109
+ //Needs to be called after the YouTube player is destroyed, otherwise there will be a null reference exception
110
+ Tech.prototype.dispose.call(this);
111
+ }
112
+
113
+ createEl() {
114
+ var div = document.createElement('div');
115
+ div.setAttribute('id', this.options_.techId);
116
+ div.setAttribute('style', 'width:100%;height:100%;top:0;left:0;position:absolute');
117
+ div.setAttribute('class', 'vjs-tech');
118
+
119
+ var divWrapper = document.createElement('div');
120
+ divWrapper.appendChild(div);
121
+
122
+ if (!_isOnMobile && !this.options_.ytControls) {
123
+ var divBlocker = document.createElement('div');
124
+ divBlocker.setAttribute('class', 'vjs-iframe-blocker');
125
+ divBlocker.setAttribute('style', 'position:absolute;top:0;left:0;width:100%;height:100%');
126
+
127
+ // In case the blocker is still there and we want to pause
128
+ divBlocker.onclick = function() {
129
+ this.pause();
130
+ }.bind(this);
131
+
132
+ divWrapper.appendChild(divBlocker);
133
+ }
134
+
135
+ return divWrapper;
136
+ }
137
+
138
+ // prevent "Failed to execute 'postMessage' on 'DOMWindow'"
139
+ // by setting "origin" with "playerVars"
140
+ // see: https://stackoverflow.com/questions/27573017/failed-to-execute-postmessage-on-domwindow-https-www-youtube-com-http
141
+ //
142
+ initYTPlayer() {
143
+ const origin = window.location.origin;
144
+ var playerVars = {
145
+ origin: origin,
146
+ controls: 0,
147
+ modestbranding: 1,
148
+ rel: 0,
149
+ showinfo: 0,
150
+ loop: this.options_.loop ? 1 : 0
151
+ };
152
+
153
+ // Let the user set any YouTube parameter
154
+ // https://developers.google.com/youtube/player_parameters?playerVersion=HTML5#Parameters
155
+ // To use YouTube controls, you must use ytControls instead
156
+ // To use the loop or autoplay, use the video.js settings
157
+
158
+ if (typeof this.options_.autohide !== 'undefined') {
159
+ playerVars.autohide = this.options_.autohide;
160
+ }
161
+
162
+ if (typeof this.options_['cc_load_policy'] !== 'undefined') {
163
+ playerVars['cc_load_policy'] = this.options_['cc_load_policy'];
164
+ }
165
+
166
+ if (typeof this.options_.ytControls !== 'undefined') {
167
+ playerVars.controls = this.options_.ytControls;
168
+ }
169
+
170
+ if (typeof this.options_.disablekb !== 'undefined') {
171
+ playerVars.disablekb = this.options_.disablekb;
172
+ }
173
+
174
+ if (typeof this.options_.color !== 'undefined') {
175
+ playerVars.color = this.options_.color;
176
+ }
177
+
178
+ if (!playerVars.controls) {
179
+ // Let video.js handle the fullscreen unless it is the YouTube native controls
180
+ playerVars.fs = 0;
181
+ } else if (typeof this.options_.fs !== 'undefined') {
182
+ playerVars.fs = this.options_.fs;
183
+ }
184
+
185
+ if (this.options_.source.src.indexOf('end=') !== -1) {
186
+ var srcEndTime = this.options_.source.src.match(/end=([0-9]*)/);
187
+ this.options_.end = parseInt(srcEndTime[1]);
188
+ }
189
+
190
+ if (typeof this.options_.end !== 'undefined') {
191
+ playerVars.end = this.options_.end;
192
+ }
193
+
194
+ if (typeof this.options_.hl !== 'undefined') {
195
+ playerVars.hl = this.options_.hl;
196
+ } else if (typeof this.options_.language !== 'undefined') {
197
+ // Set the YouTube player on the same language than video.js
198
+ playerVars.hl = this.options_.language.substr(0, 2);
199
+ }
200
+
201
+ if (typeof this.options_['iv_load_policy'] !== 'undefined') {
202
+ playerVars['iv_load_policy'] = this.options_['iv_load_policy'];
203
+ }
204
+
205
+ if (typeof this.options_.list !== 'undefined') {
206
+ playerVars.list = this.options_.list;
207
+ } else if (this.url && typeof this.url.listId !== 'undefined') {
208
+ playerVars.list = this.url.listId;
209
+ }
210
+
211
+ if (typeof this.options_.listType !== 'undefined') {
212
+ playerVars.listType = this.options_.listType;
213
+ }
214
+
215
+ if (typeof this.options_.modestbranding !== 'undefined') {
216
+ playerVars.modestbranding = this.options_.modestbranding;
217
+ }
218
+
219
+ if (typeof this.options_.playlist !== 'undefined') {
220
+ playerVars.playlist = this.options_.playlist;
221
+ }
222
+
223
+ if (typeof this.options_.playsinline !== 'undefined') {
224
+ playerVars.playsinline = this.options_.playsinline;
225
+ }
226
+
227
+ if (typeof this.options_.rel !== 'undefined') {
228
+ playerVars.rel = this.options_.rel;
229
+ }
230
+
231
+ if (typeof this.options_.showinfo !== 'undefined') {
232
+ playerVars.showinfo = this.options_.showinfo;
233
+ }
234
+
235
+ if (this.options_.source.src.indexOf('start=') !== -1) {
236
+ var srcStartTime = this.options_.source.src.match(/start=([0-9]*)/);
237
+ this.options_.start = parseInt(srcStartTime[1]);
238
+ }
239
+
240
+ if (typeof this.options_.start !== 'undefined') {
241
+ playerVars.start = this.options_.start;
242
+ }
243
+
244
+ if (typeof this.options_.theme !== 'undefined') {
245
+ playerVars.theme = this.options_.theme;
246
+ }
247
+
248
+ // Allow undocumented options to be passed along via customVars
249
+ if (typeof this.options_.customVars !== 'undefined') {
250
+ var customVars = this.options_.customVars;
251
+ Object.keys(customVars).forEach(function(key) {
252
+ playerVars[key] = customVars[key];
253
+ });
254
+ }
255
+
256
+ this.activeVideoId = this.url ? this.url.videoId : null;
257
+ this.activeList = playerVars.list;
258
+
259
+ var playerConfig = {
260
+ videoId: this.activeVideoId,
261
+ playerVars: playerVars,
262
+
263
+ events: {
264
+ onReady: this.onPlayerReady.bind(this),
265
+ onPlaybackQualityChange: this.onPlayerPlaybackQualityChange.bind(this),
266
+ onPlaybackRateChange: this.onPlayerPlaybackRateChange.bind(this),
267
+ onStateChange: this.onPlayerStateChange.bind(this),
268
+ onVolumeChange: this.onPlayerVolumeChange.bind(this),
269
+ onError: this.onPlayerError.bind(this)
270
+ }
271
+ };
272
+
273
+ if (typeof this.options_.enablePrivacyEnhancedMode !== 'undefined' && this.options_.enablePrivacyEnhancedMode) {
274
+ playerConfig.host = 'https://www.youtube-nocookie.com';
275
+ }
276
+
277
+ this.ytPlayer = new YT.Player(this.options_.techId, playerConfig);
278
+ }
279
+
280
+ onPlayerReady() {
281
+ if (this.options_.muted) {
282
+ this.ytPlayer.mute();
283
+ }
284
+
285
+ var playbackRates = this.ytPlayer.getAvailablePlaybackRates();
286
+ if (playbackRates.length > 1) {
287
+ this.featuresPlaybackRate = true;
288
+ }
289
+
290
+ this.playerReady_ = true;
291
+ this.triggerReady();
292
+
293
+ if (this.playOnReady) {
294
+ this.play();
295
+ } else if (this.cueOnReady) {
296
+ this.cueVideoById_(this.url.videoId);
297
+ this.activeVideoId = this.url.videoId;
298
+ }
299
+ }
300
+
301
+ onPlayerPlaybackQualityChange() {
302
+
303
+ }
304
+
305
+ onPlayerPlaybackRateChange() {
306
+ this.trigger('ratechange');
307
+ }
308
+
309
+ onPlayerStateChange(e) {
310
+ var state = e.data;
311
+
312
+ if (state === this.lastState || this.errorNumber) {
313
+ return;
314
+ }
315
+
316
+ this.lastState = state;
317
+
318
+ switch (state) {
319
+ case -1:
320
+ this.trigger('loadstart');
321
+ this.trigger('loadedmetadata');
322
+ this.trigger('durationchange');
323
+ this.trigger('ratechange');
324
+ break;
325
+
326
+ case YT.PlayerState.ENDED:
327
+ this.trigger('ended');
328
+ break;
329
+
330
+ case YT.PlayerState.PLAYING:
331
+ this.trigger('timeupdate');
332
+ this.trigger('durationchange');
333
+ this.trigger('playing');
334
+ this.trigger('play');
335
+
336
+ if (this.isSeeking) {
337
+ this.onSeeked();
338
+ }
339
+ break;
340
+
341
+ case YT.PlayerState.PAUSED:
342
+ this.trigger('canplay');
343
+ if (this.isSeeking) {
344
+ this.onSeeked();
345
+ } else {
346
+ this.trigger('pause');
347
+ }
348
+ break;
349
+
350
+ case YT.PlayerState.BUFFERING:
351
+ this.player_.trigger('timeupdate');
352
+ this.player_.trigger('waiting');
353
+ break;
354
+ }
355
+ }
356
+
357
+ onPlayerVolumeChange() {
358
+ this.trigger('volumechange');
359
+ }
360
+
361
+ onPlayerError(e) {
362
+ this.errorNumber = e.data;
363
+ this.trigger('pause');
364
+ this.trigger('error');
365
+ }
366
+
367
+ error() {
368
+ var code = 1000 + this.errorNumber; // as smaller codes are reserved
369
+ switch (this.errorNumber) {
370
+ case 5:
371
+ return { code: code, message: 'Error while trying to play the video' };
372
+
373
+ case 2:
374
+ case 100:
375
+ return { code: code, message: 'Unable to find the video' };
376
+
377
+ case 101:
378
+ case 150:
379
+ return {
380
+ code: code,
381
+ message: 'Playback on other Websites has been disabled by the video owner.'
382
+ };
383
+ }
384
+
385
+ return { code: code, message: 'YouTube unknown error (' + this.errorNumber + ')' };
386
+ }
387
+
388
+ loadVideoById_(id) {
389
+ var options = {
390
+ videoId: id
391
+ };
392
+ if (this.options_.start) {
393
+ options.startSeconds = this.options_.start;
394
+ }
395
+ if (this.options_.end) {
396
+ options.endSeconds = this.options_.end;
397
+ }
398
+ this.ytPlayer.loadVideoById(options);
399
+ }
400
+
401
+ cueVideoById_(id) {
402
+ var options = {
403
+ videoId: id
404
+ };
405
+ if (this.options_.start) {
406
+ options.startSeconds = this.options_.start;
407
+ }
408
+ if (this.options_.end) {
409
+ options.endSeconds = this.options_.end;
410
+ }
411
+ this.ytPlayer.cueVideoById(options);
412
+ }
413
+
414
+ src(src) {
415
+ if (src) {
416
+ this.setSrc({ src: src });
417
+ }
418
+
419
+ return this.source;
420
+ }
421
+
422
+ poster() {
423
+ // You can't start programmaticlly a video with a mobile
424
+ // through the iframe so we hide the poster and the play button (with CSS)
425
+ if (_isOnMobile) {
426
+ return null;
427
+ }
428
+
429
+ return this.poster_;
430
+ }
431
+
432
+ setPoster(poster) {
433
+ this.poster_ = poster;
434
+ }
435
+
436
+ setSrc(source) {
437
+ if (!source || !source.src) {
438
+ return;
439
+ }
440
+
441
+ delete this.errorNumber;
442
+ this.source = source;
443
+ this.url = Youtube.parseUrl(source.src);
444
+
445
+ if (!this.options_.poster) {
446
+ if (this.url.videoId) {
447
+ // Set the low resolution first
448
+ this.poster_ = 'https://img.youtube.com/vi/' + this.url.videoId + '/0.jpg';
449
+ this.trigger('posterchange');
450
+
451
+ // Check if their is a high res
452
+ this.checkHighResPoster();
453
+ }
454
+ }
455
+
456
+ if (this.options_.autoplay && !_isOnMobile) {
457
+ if (this.isReady_) {
458
+ this.play();
459
+ } else {
460
+ this.playOnReady = true;
461
+ }
462
+ } else if (this.activeVideoId !== this.url.videoId) {
463
+ if (this.isReady_) {
464
+ this.cueVideoById_(this.url.videoId);
465
+ this.activeVideoId = this.url.videoId;
466
+ } else {
467
+ this.cueOnReady = true;
468
+ }
469
+ }
470
+ }
471
+
472
+ autoplay() {
473
+ return this.options_.autoplay;
474
+ }
475
+
476
+ setAutoplay(val) {
477
+ this.options_.autoplay = val;
478
+ }
479
+
480
+ loop() {
481
+ return this.options_.loop;
482
+ }
483
+
484
+ setLoop(val) {
485
+ this.options_.loop = val;
486
+ }
487
+
488
+ play() {
489
+ if (!this.url || !this.url.videoId) {
490
+ return;
491
+ }
492
+
493
+ this.wasPausedBeforeSeek = false;
494
+
495
+ if (this.isReady_) {
496
+ if (this.url.listId) {
497
+ if (this.activeList === this.url.listId) {
498
+ this.ytPlayer.playVideo();
499
+ } else {
500
+ this.ytPlayer.loadPlaylist(this.url.listId);
501
+ this.activeList = this.url.listId;
502
+ }
503
+ }
504
+
505
+ if (this.activeVideoId === this.url.videoId) {
506
+ this.ytPlayer.playVideo();
507
+ } else {
508
+ this.loadVideoById_(this.url.videoId);
509
+ this.activeVideoId = this.url.videoId;
510
+ }
511
+ } else {
512
+ this.trigger('waiting');
513
+ this.playOnReady = true;
514
+ }
515
+ }
516
+
517
+ pause() {
518
+ if (this.ytPlayer) {
519
+ this.ytPlayer.pauseVideo();
520
+ }
521
+ }
522
+
523
+ paused() {
524
+ return (this.ytPlayer) ?
525
+ (this.lastState !== YT.PlayerState.PLAYING && this.lastState !== YT.PlayerState.BUFFERING)
526
+ : true;
527
+ }
528
+
529
+ currentTime() {
530
+ return this.ytPlayer ? this.ytPlayer.getCurrentTime() : 0;
531
+ }
532
+
533
+ setCurrentTime(seconds) {
534
+ if (this.lastState === YT.PlayerState.PAUSED) {
535
+ this.timeBeforeSeek = this.currentTime();
536
+ }
537
+
538
+ if (!this.isSeeking) {
539
+ this.wasPausedBeforeSeek = this.paused();
540
+ }
541
+
542
+ this.ytPlayer.seekTo(seconds, true);
543
+ this.trigger('timeupdate');
544
+ this.trigger('seeking');
545
+ this.isSeeking = true;
546
+
547
+ // A seek event during pause does not return an event to trigger a seeked event,
548
+ // so run an interval timer to look for the currentTime to change
549
+ if (this.lastState === YT.PlayerState.PAUSED && this.timeBeforeSeek !== seconds) {
550
+ clearInterval(this.checkSeekedInPauseInterval);
551
+ this.checkSeekedInPauseInterval = setInterval(function() {
552
+ if (this.lastState !== YT.PlayerState.PAUSED || !this.isSeeking) {
553
+ // If something changed while we were waiting for the currentTime to change,
554
+ // clear the interval timer
555
+ clearInterval(this.checkSeekedInPauseInterval);
556
+ } else if (this.currentTime() !== this.timeBeforeSeek) {
557
+ this.trigger('timeupdate');
558
+ this.onSeeked();
559
+ }
560
+ }.bind(this), 250);
561
+ }
562
+ }
563
+
564
+ seeking() {
565
+ return this.isSeeking;
566
+ }
567
+
568
+ // jadams, 2023-10-01: videojs.createTimeRange() deprecated in VideoJS 9
569
+ //
570
+ seekable() {
571
+ if(!this.ytPlayer) {
572
+ // return videojs.createTimeRange();
573
+ return videojs.time.createTimeRanges();
574
+ }
575
+ // return videojs.createTimeRange(0, this.ytPlayer.getDuration());
576
+ return videojs.time.createTimeRanges(0, this.ytPlayer.getDuration());
577
+ }
578
+
579
+ onSeeked() {
580
+ clearInterval(this.checkSeekedInPauseInterval);
581
+ this.isSeeking = false;
582
+
583
+ if (this.wasPausedBeforeSeek) {
584
+ this.pause();
585
+ }
586
+
587
+ this.trigger('seeked');
588
+ }
589
+
590
+ playbackRate() {
591
+ return this.ytPlayer ? this.ytPlayer.getPlaybackRate() : 1;
592
+ }
593
+
594
+ setPlaybackRate(suggestedRate) {
595
+ if (!this.ytPlayer) {
596
+ return;
597
+ }
598
+
599
+ this.ytPlayer.setPlaybackRate(suggestedRate);
600
+ }
601
+
602
+ duration() {
603
+ return this.ytPlayer ? this.ytPlayer.getDuration() : 0;
604
+ }
605
+
606
+ currentSrc() {
607
+ return this.source && this.source.src;
608
+ }
609
+
610
+ ended() {
611
+ return this.ytPlayer ? (this.lastState === YT.PlayerState.ENDED) : false;
612
+ }
613
+
614
+ volume() {
615
+ return this.ytPlayer ? this.ytPlayer.getVolume() / 100.0 : 1;
616
+ }
617
+
618
+ setVolume(percentAsDecimal) {
619
+ if (!this.ytPlayer) {
620
+ return;
621
+ }
622
+
623
+ this.ytPlayer.setVolume(percentAsDecimal * 100.0);
624
+ }
625
+
626
+ muted() {
627
+ return this.ytPlayer ? this.ytPlayer.isMuted() : false;
628
+ }
629
+
630
+ setMuted(mute) {
631
+ if (!this.ytPlayer) {
632
+ return;
633
+ }
634
+ else{
635
+ this.muted(true);
636
+ }
637
+
638
+ if (mute) {
639
+ this.ytPlayer.mute();
640
+ } else {
641
+ this.ytPlayer.unMute();
642
+ }
643
+ this.setTimeout( function(){
644
+ this.trigger('volumechange');
645
+ }, 50);
646
+ }
647
+
648
+ // jadams, 2023-10-01: videojs.createTimeRange() deprecated in VideoJS 9
649
+ //
650
+ buffered() {
651
+ if(!this.ytPlayer || !this.ytPlayer.getVideoLoadedFraction) {
652
+ // return videojs.createTimeRange();
653
+ return videojs.time.createTimeRanges();
654
+ }
655
+
656
+ var bufferedEnd = this.ytPlayer.getVideoLoadedFraction() * this.ytPlayer.getDuration();
657
+
658
+ // return videojs.createTimeRange(0, bufferedEnd);
659
+ return videojs.time.createTimeRanges(0, bufferedEnd);
660
+ }
661
+
662
+ // TODO: Can we really do something with this on YouTUbe?
663
+ preload() {}
664
+ load() {}
665
+ reset() {}
666
+ networkState() {
667
+ if (!this.ytPlayer) {
668
+ return 0; //NETWORK_EMPTY
669
+ }
670
+ switch (this.ytPlayer.getPlayerState()) {
671
+ case -1: //unstarted
672
+ return 0; //NETWORK_EMPTY
673
+ case 3: //buffering
674
+ return 2; //NETWORK_LOADING
675
+ default:
676
+ return 1; //NETWORK_IDLE
677
+ }
678
+ }
679
+ readyState() {
680
+ if (!this.ytPlayer) {
681
+ return 0; //HAVE_NOTHING
682
+ }
683
+ switch (this.ytPlayer.getPlayerState()) {
684
+ case -1: //unstarted
685
+ return 0; //HAVE_NOTHING
686
+ case 5: //video cued
687
+ return 1; //HAVE_METADATA
688
+ case 3: //buffering
689
+ return 2; //HAVE_CURRENT_DATA
690
+ default:
691
+ return 4; //HAVE_ENOUGH_DATA
692
+ }
693
+ }
694
+
695
+ supportsFullScreen() {
696
+ return document.fullscreenEnabled ||
697
+ document.webkitFullscreenEnabled ||
698
+ document.mozFullScreenEnabled ||
699
+ document.msFullscreenEnabled;
700
+ }
701
+
702
+ // Tries to get the highest resolution thumbnail available for the video
703
+ checkHighResPoster(){
704
+ var uri = 'https://img.youtube.com/vi/' + this.url.videoId + '/maxresdefault.jpg';
705
+
706
+ try {
707
+ var image = new Image();
708
+ image.onload = function(){
709
+ // Onload may still be called if YouTube returns the 120x90 error thumbnail
710
+ if('naturalHeight' in image){
711
+ if (image.naturalHeight <= 90 || image.naturalWidth <= 120) {
712
+ return;
713
+ }
714
+ } else if(image.height <= 90 || image.width <= 120) {
715
+ return;
716
+ }
717
+
718
+ this.poster_ = uri;
719
+ this.trigger('posterchange');
720
+ }.bind(this);
721
+ image.onerror = function(){};
722
+ image.src = uri;
723
+ }
724
+ catch(e){}
725
+ }
726
+ }
727
+
728
+ Youtube.isSupported = function() {
729
+ return true;
730
+ };
731
+
732
+ Youtube.canPlaySource = function(e) {
733
+ return Youtube.canPlayType(e.type);
734
+ };
735
+
736
+ Youtube.canPlayType = function(e) {
737
+ return (e === 'video/youtube');
738
+ };
739
+
740
+ Youtube.parseUrl = function(url) {
741
+ var result = {
742
+ videoId: null
743
+ };
744
+
745
+ var regex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
746
+ var match = url.match(regex);
747
+
748
+ if (match && match[2].length === 11) {
749
+ result.videoId = match[2];
750
+ }
751
+
752
+ var regPlaylist = /[?&]list=([^#\&\?]+)/;
753
+ match = url.match(regPlaylist);
754
+
755
+ if(match && match[1]) {
756
+ result.listId = match[1];
757
+ }
758
+
759
+ return result;
760
+ };
761
+
762
+ function apiLoaded() {
763
+ YT.ready(function() {
764
+ Youtube.isApiReady = true;
765
+
766
+ for (var i = 0; i < Youtube.apiReadyQueue.length; ++i) {
767
+ Youtube.apiReadyQueue[i].initYTPlayer();
768
+ }
769
+ });
770
+ }
771
+
772
+ function loadScript(src, callback) {
773
+ var loaded = false;
774
+ var tag = document.createElement('script');
775
+ var firstScriptTag = document.getElementsByTagName('script')[0];
776
+ if (!firstScriptTag) {
777
+ // when loaded in jest without jsdom setup it doesn't get any element.
778
+ // In jest it doesn't really make sense to do anything, because no one is watching youtube in jest
779
+ return;
780
+ }
781
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
782
+ tag.onload = function () {
783
+ if (!loaded) {
784
+ loaded = true;
785
+ callback();
786
+ }
787
+ };
788
+ tag.onreadystatechange = function () {
789
+ if (!loaded && (this.readyState === 'complete' || this.readyState === 'loaded')) {
790
+ loaded = true;
791
+ callback();
792
+ }
793
+ };
794
+ tag.src = src;
795
+ }
796
+
797
+ function injectCss() {
798
+ var css = // iframe blocker to catch mouse events
799
+ '.vjs-youtube .vjs-iframe-blocker { display: none; }' +
800
+ '.vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }' +
801
+ '.vjs-youtube .vjs-poster { background-size: cover; }' +
802
+ '.vjs-youtube-mobile .vjs-big-play-button { display: none; }';
803
+
804
+ var head = document.head || document.getElementsByTagName('head')[0];
805
+
806
+ var style = document.createElement('style');
807
+ style.type = 'text/css';
808
+
809
+ if (style.styleSheet){
810
+ style.styleSheet.cssText = css;
811
+ } else {
812
+ style.appendChild(document.createTextNode(css));
813
+ }
814
+
815
+ head.appendChild(style);
816
+ }
817
+
818
+ Youtube.apiReadyQueue = [];
819
+
820
+ if (typeof document !== 'undefined'){
821
+ // loadScript('/assets/theme/j1/modules/videojs/js/plugins/yt/api/youtube.min.js', apiLoaded);
822
+ loadScript('//www.youtube.com/iframe_api', apiLoaded);
823
+ injectCss();
824
+ }
825
+
826
+ // Older versions of VJS5 doesn't have the registerTech function
827
+ if (typeof videojs.registerTech !== 'undefined') {
828
+ videojs.registerTech('Youtube', Youtube);
829
+ } else {
830
+ videojs.registerComponent('Youtube', Youtube);
831
+ }
832
+ }));