j1-template 2024.3.13 → 2024.3.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) 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.html +403 -85
  10. data/assets/data/banner.html +9 -7
  11. data/assets/data/cookieconsent.html +8 -8
  12. data/assets/data/masterslider.html +128 -7
  13. data/assets/data/panel.html +16 -65
  14. data/assets/data/speak2me.html +11 -11
  15. data/assets/data/translator.html +29 -29
  16. data/assets/theme/j1/adapter/js/amplitude.js +310 -128
  17. data/assets/theme/j1/adapter/js/attic.js +14 -11
  18. data/assets/theme/j1/adapter/js/docsearch.js +2 -2
  19. data/assets/theme/j1/adapter/js/fab.js +2 -2
  20. data/assets/theme/j1/adapter/js/j1.js +12 -12
  21. data/assets/theme/j1/adapter/js/lazyLoader.js +60 -10
  22. data/assets/theme/j1/adapter/js/masonry.js +1 -1
  23. data/assets/theme/j1/adapter/js/masterslider.js +2 -2
  24. data/assets/theme/j1/adapter/js/particles.js +2 -2
  25. data/assets/theme/j1/adapter/js/scroller.js +2 -2
  26. data/assets/theme/j1/adapter/js/slick.js +2 -2
  27. data/assets/theme/j1/adapter/js/themes.js +43 -5
  28. data/assets/theme/j1/adapter/js/translator.js +2 -2
  29. data/assets/theme/j1/adapter/js/waves.js +1 -1
  30. data/assets/theme/j1/core/css/animate.css +1634 -1070
  31. data/assets/theme/j1/core/css/animate.css.map +1 -0
  32. data/assets/theme/j1/core/css/animate.min.css +2 -1
  33. data/assets/theme/j1/core/css/animate.min.css.map +1 -0
  34. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css +3060 -1538
  35. data/assets/theme/j1/core/css/icon-fonts/fontawesome.css.map +1 -0
  36. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css +2 -1
  37. data/assets/theme/j1/core/css/icon-fonts/fontawesome.min.css.map +1 -0
  38. data/assets/theme/j1/core/css/icon-fonts/iconify.css +2308 -1153
  39. data/assets/theme/j1/core/css/icon-fonts/iconify.css.map +1 -0
  40. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css +2 -1
  41. data/assets/theme/j1/core/css/icon-fonts/iconify.min.css.map +1 -0
  42. data/assets/theme/j1/core/css/icon-fonts/mdi.css +16716 -8423
  43. data/assets/theme/j1/core/css/icon-fonts/mdi.css.map +1 -0
  44. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css +2 -1
  45. data/assets/theme/j1/core/css/icon-fonts/mdi.min.css.map +1 -0
  46. data/assets/theme/j1/core/css/icon-fonts/mdib.css +5576 -2768
  47. data/assets/theme/j1/core/css/icon-fonts/mdib.css.map +1 -0
  48. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css +2 -1
  49. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css.map +1 -0
  50. data/assets/theme/j1/core/css/icon-fonts/mdil.css +742 -441
  51. data/assets/theme/j1/core/css/icon-fonts/mdil.css.map +1 -0
  52. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css +2 -1
  53. data/assets/theme/j1/core/css/icon-fonts/mdil.min.css.map +1 -0
  54. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css +6552 -3980
  55. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.css.map +1 -0
  56. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css +2 -5
  57. data/assets/theme/j1/core/css/themes/bootstrap/bootstrap.min.css.map +1 -0
  58. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css +6818 -4131
  59. data/assets/theme/j1/core/css/themes/unodark/bootstrap.css.map +1 -0
  60. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css +2 -5
  61. data/assets/theme/j1/core/css/themes/unodark/bootstrap.min.css.map +1 -0
  62. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +18568 -11577
  63. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -0
  64. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +2 -35
  65. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -0
  66. data/assets/theme/j1/core/css/vendor.css +1771 -1043
  67. data/assets/theme/j1/core/css/vendor.css.map +1 -0
  68. data/assets/theme/j1/core/css/vendor.min.css +2 -1
  69. data/assets/theme/j1/core/css/vendor.min.css.map +1 -0
  70. data/assets/theme/j1/core/js/template.js +132 -197
  71. data/assets/theme/j1/core/js/template.min.js +7 -7
  72. data/assets/theme/j1/core/js/template.min.js.map +1 -1
  73. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +53 -24
  74. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.min.css +1 -1
  75. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +138 -78
  76. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
  77. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +137 -81
  78. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
  79. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/pause.png +0 -0
  80. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.png +0 -0
  81. data/assets/theme/j1/modules/amplitudejs/icons/player/blue/play.svg +87 -0
  82. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +60 -0
  83. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +59 -0
  84. data/assets/theme/j1/modules/amplitudejs/js/amplitude.js +65 -21
  85. data/assets/theme/j1/modules/amplitudejs/js/amplitude.min.js +1 -1
  86. data/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js +113 -0
  87. data/assets/theme/j1/modules/gemini/js/gemini.js.map +1 -1
  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/jquery/js/jquery.min.map +1 -1
  92. data/assets/theme/j1/modules/js-cookies/js/js.cookie.js +3 -3
  93. data/assets/theme/j1/modules/lazyCssLoader/js/main.0.js +166 -0
  94. data/assets/theme/j1/modules/lazyCssLoader/js/main.1.js +65 -0
  95. data/assets/theme/j1/modules/lazyCssLoader/js/main.js +66 -0
  96. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/examplePlugin.js +13 -0
  97. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/my-plugin.js +25 -0
  98. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/plugin-interface.js +9 -0
  99. data/assets/theme/j1/modules/lazyCssLoader/js/plugins/pluginA.js +46 -0
  100. data/assets/theme/j1/modules/lazyLoader/js/plugins/README.md +324 -0
  101. data/assets/theme/j1/modules/lazyLoader/js/plugins/jquery.lazy.picture.js +188 -0
  102. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +1 -1
  103. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +794 -0
  104. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +151 -67
  105. data/assets/theme/j1/modules/slimSelect/js/select.js +1 -1
  106. data/assets/theme/j1/modules/slimSelect/js/select.min.js +3 -3
  107. data/assets/theme/j1/modules/themeSwitcher/js/switcher.js +2 -1
  108. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.js +2 -2
  109. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.min.js +1 -1
  110. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/icon/scalable/dailymotion.svg +62 -0
  111. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.js +832 -0
  112. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/v3.0.0/youtube.min.js +17 -0
  113. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.min.js +1 -1
  114. data/assets/theme/j1/modules/videojs/js/video.js +2 -2
  115. data/lib/j1/version.rb +1 -1
  116. data/lib/starter_web/README.md +577 -560
  117. data/lib/starter_web/_config.yml +2 -2
  118. data/lib/starter_web/_data/blocks/footer.yml +10 -5
  119. data/lib/starter_web/_data/blocks/panel.yml +2 -2
  120. data/lib/starter_web/_data/layouts/default.yml +14 -3
  121. data/lib/starter_web/_data/modules/amplitude.yml +595 -30
  122. data/lib/starter_web/_data/modules/defaults/amplitude.yml +30 -7
  123. data/lib/starter_web/_data/modules/defaults/lazyLoader.yml +2 -2
  124. data/lib/starter_web/_data/modules/gallery.yml +136 -0
  125. data/lib/starter_web/_data/modules/lazyLoader.yml +69 -32
  126. data/lib/starter_web/_data/modules/masonry.yml +4 -4
  127. data/lib/starter_web/_data/modules/masterslider.yml +124 -18
  128. data/lib/starter_web/_data/modules/navigator_menu.yml +831 -803
  129. data/lib/starter_web/_data/resources.yml +155 -190
  130. data/lib/starter_web/_data/templates/feed.xml +1 -1
  131. data/lib/starter_web/_includes/attributes.asciidoc +1 -0
  132. data/lib/starter_web/_plugins/asciidoctor/amplitude-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/carousel-block.rb +2 -1
  134. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +1 -1
  135. data/lib/starter_web/_plugins/asciidoctor/gallery-block.rb +4 -2
  136. data/lib/starter_web/_plugins/asciidoctor/lightbox-block.rb +1 -1
  137. data/lib/starter_web/_plugins/asciidoctor/masonry-block.rb +1 -1
  138. data/lib/starter_web/_plugins/asciidoctor/masterslider-block.rb +1 -1
  139. data/lib/starter_web/_plugins/asciidoctor/slick-block.rb +2 -1
  140. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +58 -46
  141. data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +26 -19
  142. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +30 -40
  143. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  144. data/lib/starter_web/assets/audio/cover/spontanorama/spontanorama.jpg +0 -0
  145. data/lib/starter_web/assets/audio/cover/spontanorama/src/spontanorama.png +0 -0
  146. data/lib/starter_web/assets/audio/cover/spontanorama/src/spontanorama.psd +0 -0
  147. data/lib/starter_web/assets/image/icons/lanus/favicon.ico +0 -0
  148. data/lib/starter_web/assets/image/icons/lanus/lanus-512x512.png +0 -0
  149. data/lib/starter_web/assets/image/icons/lanus/lanus.ico +0 -0
  150. data/lib/starter_web/assets/image/icons/lanus/lanus.png +0 -0
  151. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus.svg +76 -0
  152. data/lib/starter_web/assets/image/icons/lanus/scalable/lanus_sw.svg +62 -0
  153. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28 - social.svg +86 -0
  154. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x-28.svg +64 -0
  155. data/lib/starter_web/assets/image/modules/icons/social/scalable/icon-twitter-x.svg +1 -0
  156. data/lib/starter_web/assets/image/modules/icons/social/twitter_x.png +0 -0
  157. data/lib/starter_web/package.json +7 -18
  158. data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +218 -0
  159. data/lib/starter_web/pages/public/features/template.adoc +18 -8
  160. data/lib/starter_web/pages/public/features/template.asciidoc +758 -0
  161. data/lib/starter_web/pages/public/lazy_loader_tester.adoc +402 -0
  162. data/lib/starter_web/pages/public/manuals/ytdl/man.adoc +3020 -0
  163. data/lib/starter_web/pages/public/manuals/ytdl/man.md +2378 -0
  164. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +0 -16
  165. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/amplitudejs.large.css.asciidoc +505 -0
  166. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.hover.html +69 -0
  167. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.nested.html +75 -0
  168. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/frame.textarea.html +57 -0
  169. data/lib/starter_web/pages/public/tools/previewer/_includes/documents/my.content.html +112 -0
  170. data/lib/starter_web/pages/public/tools/previewer/preview_amplitudejs.adoc +172 -0
  171. data/lib/starter_web/pages/{public/tour → tour}/_includes/attributes.asciidoc +2 -2
  172. data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/419_advanced_modals_demo.asciidoc +16 -16
  173. data/lib/starter_web/pages/{public/tour → tour}/asciidoc_extensions.adoc +14 -4
  174. data/lib/starter_web/pages/{public/tour → tour}/bootstrap_themes.adoc +13 -4
  175. data/lib/starter_web/pages/{public/tour → tour}/highlghter_rouge.adoc +14 -4
  176. data/lib/starter_web/pages/{public/tour → tour}/icon_fonts.adoc +12 -3
  177. data/lib/starter_web/pages/{public/tour → tour}/modal_extentions.adoc +13 -7
  178. data/lib/starter_web/pages/{public/tour/playback_audio.adoc → tour/play_audio.adoc} +215 -188
  179. data/lib/starter_web/pages/{public/tour/playback_video.adoc → tour/play_video.adoc} +68 -53
  180. data/lib/starter_web/pages/{public/tour → tour}/present_images.adoc +42 -19
  181. data/lib/starter_web/pages/{public/tour → tour}/quicksearch.adoc +14 -4
  182. data/lib/starter_web/pages/{public/tour → tour}/responsive_tables.adoc +14 -5
  183. data/lib/starter_web/pages/{public/tour → tour}/typography.adoc +13 -4
  184. metadata +112 -47
  185. /data/assets/theme/j1/modules/{lazyLoader → j1LazyLoader/js}/plugins/README.md +0 -0
  186. /data/assets/theme/j1/modules/{lazyLoader/plugins/jquery.lazy.picture.js → j1LazyLoader/js/plugins/picture.js} +0 -0
  187. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.js +0 -0
  188. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.ajax.min.js +0 -0
  189. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.js +0 -0
  190. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.av.min.js +0 -0
  191. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.js +0 -0
  192. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.iframe.min.js +0 -0
  193. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.js +0 -0
  194. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.noop.min.js +0 -0
  195. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.picture.min.js +0 -0
  196. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.js +0 -0
  197. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.script.min.js +0 -0
  198. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.js +0 -0
  199. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.vimeo.min.js +0 -0
  200. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.js +0 -0
  201. /data/assets/theme/j1/modules/lazyLoader/{plugins → js/plugins}/jquery.lazy.youtube.min.js +0 -0
  202. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/100_gistblock.asciidoc +0 -0
  203. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_bottom_info.asciidoc +0 -0
  204. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  205. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  206. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_central_success.asciidoc +0 -0
  207. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  208. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  209. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  210. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_top_info.asciidoc +0 -0
  211. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_top_left_info.asciidoc +0 -0
  212. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/410_top_right_success.asciidoc +0 -0
  213. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  214. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/themes_bootstrap.asciidoc +0 -0
  215. /data/lib/starter_web/pages/{public/tour → tour}/_includes/documents/themes_rouge.asciidoc +0 -0
@@ -113,6 +113,9 @@ j1.adapter.amplitude = ((j1, window) => {
113
113
 
114
114
  // amplitude api settings
115
115
  // ----------------------
116
+ var ytpSongIndex = "0";
117
+ var ytpAutoPlay = false;
118
+ var ytpLoop = true;
116
119
  var playLists = {};
117
120
  var playersUILoaded = { state: false };
118
121
  var apiInitialized = { state: false };
@@ -125,30 +128,54 @@ j1.adapter.amplitude = ((j1, window) => {
125
128
  var amplitudeDefaults;
126
129
  var amplitudeSettings;
127
130
  var amplitudeOptions;
131
+ var ytPlayer;
132
+ var ytpPlaybackRate
128
133
 
129
134
  // amplitude player (instance) settings
135
+ // NOTE: slider VALUE is set by Adapter|Amplitude API
130
136
  // ------------------------------------
131
137
  var xhrLoadState;
132
138
  var dependency;
133
- var playerCounter = 0;
134
- var load_dependencies = {};
135
- var playersProcessed = [];
136
- var playersHtmlLoaded = false;
137
- var processingPlayersFinished = false;
138
- var playerAudioInfo = ('{{amplitude_defaults.playlist.audio_info}}' === 'true') ? true : false;
139
- var playerDefaultType = '{{amplitude_defaults.player.type}}';
140
- var playerVolumeValue = '{{amplitude_defaults.player.volume.value}}';
141
- var playerVolumeDecrement = '{{amplitude_defaults.player.volume.decrement}}';
142
- var playerVolumeIncrement = '{{amplitude_defaults.player.volume.increment}}';
143
- var playerRepeat = ('{{amplitude_defaults.player.repeat}}' === 'true') ? true : false;
144
- var playerShuffle = ('{{amplitude_defaults.player.shuffle}}' === 'true') ? true : false;
145
- var playerPlayNextTitle = ('{{amplitude_defaults.player.play_next_title}}' === 'true') ? true : false;
146
- var playerPauseNextTitle = ('{{amplitude_defaults.player.pause_next_title}}' === 'true') ? true : false;
147
- var playerDelayNextTitle = '{{amplitude_defaults.player.delay_next_title}}';
139
+ var playerCounter = 0;
140
+ var load_dependencies = {};
141
+ var playersProcessed = [];
142
+ var playersHtmlLoaded = false;
143
+ var processingPlayersFinished = false;
144
+ var playerAudioInfo = ('{{amplitude_defaults.playlist.audio_info}}' === 'true') ? true : false;
145
+ var playerDefaultType = '{{amplitude_defaults.player.type}}';
146
+ var playerVolumeValue = '{{amplitude_defaults.player.volume_slider.preset_value}}';
147
+ var playerVolumeSliderStep = '{{amplitude_defaults.player.volume_slider.slider_step}}';
148
+ var playerRepeat = ('{{amplitude_defaults.player.repeat}}' === 'true') ? true : false;
149
+ var playerShuffle = ('{{amplitude_defaults.player.shuffle}}' === 'true') ? true : false;
150
+ var playerPlayNextTitle = ('{{amplitude_defaults.player.play_next_title}}' === 'true') ? true : false;
151
+ var playerPauseNextTitle = ('{{amplitude_defaults.player.pause_next_title}}' === 'true') ? true : false;
152
+ var playerDelayNextTitle = '{{amplitude_defaults.player.delay_next_title}}';
153
+ var playerForwardBackwardSkipSeconds = '{{amplitude_defaults.player.forward_backward_skip_seconds}}';
148
154
 
149
155
  // unused settings
150
- // var playerWaveformSampleRate = '{{amplitude_defaults.player.waveform_sample_rate}}';
156
+ // ---------------------------------------------------------------------------
157
+ // var playerWaveformSampleRate = '{{amplitude_defaults.player.waveform_sample_rate}}';
158
+
159
+ // ---------------------------------------------------------------------------
160
+ // YouTube Player Tech (loaded early, runs on Document Ready)
161
+ // ---------------------------------------------------------------------------
162
+ //
163
+ // $(function() {
164
+ // // Load YTP API code asynchronously and create a player for later use
165
+ // var techScript;
166
+ // var tech = document.createElement('script');
167
+ //
168
+ // tech.id = 'yt_player_init';
169
+ // tech.src = "/assets/theme/j1/modules/amplitudejs/js/tech/ytp.js";
170
+ // techScript = document.getElementsByTagName('script')[0];
171
+ //
172
+ // // Append Tech script
173
+ // techScript.parentNode.insertBefore(tech, techScript);
174
+ // });
151
175
 
176
+ // ---------------------------------------------------------------------------
177
+ // helper functions
178
+ // ---------------------------------------------------------------------------
152
179
 
153
180
  // ---------------------------------------------------------------------------
154
181
  // main
@@ -189,9 +216,8 @@ j1.adapter.amplitude = ((j1, window) => {
189
216
  var pageState = $('#content').css("display");
190
217
  var pageVisible = (pageState === 'block') ? true : false;
191
218
  var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
192
- var atticFinished = (j1.adapter.attic.getState() == 'finished') ? true : false;
193
219
 
194
- if (j1CoreFinished && pageVisible && atticFinished) {
220
+ if (j1CoreFinished && pageVisible) {
195
221
  startTimeModule = Date.now();
196
222
 
197
223
  _this.setState('started');
@@ -217,6 +243,7 @@ j1.adapter.amplitude = ((j1, window) => {
217
243
  var dependencies_met_players_loaded = setInterval (() => {
218
244
  if (playersUILoaded.state) {
219
245
  _this.initApi(songs);
246
+ // var playbackRate = ytPlayer.getPlaybackRate();
220
247
 
221
248
  clearInterval(dependencies_met_players_loaded);
222
249
  } // END if playersUILoaded
@@ -227,38 +254,6 @@ j1.adapter.amplitude = ((j1, window) => {
227
254
  // -------------------------------------------------------------------
228
255
  var dependencies_met_api_initialized = setInterval (() => {
229
256
  if (apiInitialized.state) {
230
-
231
- // click on next button
232
- // -------------------------------------------------------
233
- // var nextButtons = document.getElementsByClassName("amplitude-next");
234
- //
235
- // // add listeners to all next buttonn found
236
- // for (var i=0; i<nextButtons.length; i++) {
237
- // nextButtons[i].addEventListener('click', function(event) {
238
- // event.stopPropagation();
239
- //
240
- // var activeTitleIndex = Amplitude.getActiveIndex();
241
- // var playerState = Amplitude.getPlayerState();
242
- // logger.debug('\n' + 'next player state: ' + playerState + ' on index=' + activeTitleIndex);
243
- // });
244
- // }
245
-
246
- // click on previous button
247
- // -------------------------------------------------------
248
- // var previousButtons = document.getElementsByClassName("amplitude-prev");
249
- //
250
- // // add listeners to all previous buttonn found
251
- // for (var i=0; i<previousButtons.length; i++) {
252
- // previousButtons[i].addEventListener('click', function(event) {
253
- // event.stopPropagation();
254
- //
255
- // var activeTitleIndex = Amplitude.getActiveIndex();
256
- // var playerState = Amplitude.getPlayerState();
257
- // logger.debug('\n' + 'previous player state: ' + playerState + ' on index=' + activeTitleIndex);
258
- //
259
- // });
260
- // }
261
-
262
257
  _this.initPlayerUiEvents();
263
258
 
264
259
  clearInterval(dependencies_met_api_initialized);
@@ -268,6 +263,7 @@ j1.adapter.amplitude = ((j1, window) => {
268
263
  clearInterval(dependencies_met_page_ready);
269
264
  } // END pageVisible
270
265
  }, 10); // END dependencies_met_page_ready
266
+
271
267
  }, // END init
272
268
 
273
269
  // -------------------------------------------------------------------------
@@ -339,42 +335,41 @@ j1.adapter.amplitude = ((j1, window) => {
339
335
  logger.info('\n' + 'loading player HTML components (UI): started');
340
336
 
341
337
  {% for player in amplitude_options.players %} {% if player.enabled %}
342
- {% assign player_id = player.id %}
343
338
  {% assign xhr_data_path = amplitude_options.xhr_data_path %}
344
- {% capture xhr_container_id %}{{player_id}}_parent{% endcapture %}
339
+ {% capture xhr_container_id %}{{player.id}}_parent{% endcapture %}
345
340
 
346
341
  // load players only that are configured in current page
347
342
  //
348
343
  playerExistsInPage = ($('#' + '{{xhr_container_id}}')[0] !== undefined) ? true : false;
349
344
  if (playerExistsInPage) {
350
345
  playerCounter++;
351
- logger.debug('\n' + 'load player UI on ID #{{player_id}}: started');
346
+ logger.debug('\n' + 'load player UI on ID #{{player.id}}: started');
352
347
 
353
348
  j1.loadHTML({
354
349
  xhr_container_id: '{{xhr_container_id}}',
355
350
  xhr_data_path: '{{xhr_data_path}}',
356
- xhr_data_element: '{{player_id}}'
351
+ xhr_data_element: '{{player.id}}'
357
352
  },
358
353
  'j1.adapter.amplitude',
359
354
  'data_loaded'
360
355
  );
361
356
 
362
- // dynamic loader variable to setup the player on ID {{player_id}}
363
- dependency = 'dependencies_met_html_loaded_{{player_id}}';
357
+ // dynamic loader variable to setup the player on ID {{player.id}}
358
+ dependency = 'dependencies_met_html_loaded_{{player.id}}';
364
359
  load_dependencies[dependency] = '';
365
360
 
366
361
  // ---------------------------------------------------------------------
367
362
  // initialize amplitude instance (when player UI loaded)
368
363
  // ---------------------------------------------------------------------
369
- load_dependencies['dependencies_met_html_loaded_{{player_id}}'] = setInterval (() => {
364
+ load_dependencies['dependencies_met_html_loaded_{{player.id}}'] = setInterval (() => {
370
365
  // check if HTML portion of the player is loaded successfully
371
366
  xhrLoadState = j1.xhrDOMState['#' + '{{xhr_container_id}}'];
372
367
 
373
368
  if (xhrLoadState === 'success') {
374
369
  playersProcessed.push('{{xhr_container_id}}');
375
- logger.debug('\n' + 'load player UI on ID #{{player_id}}: finished');
370
+ logger.debug('\n' + 'load player UI on ID #{{player.id}}: finished');
376
371
 
377
- clearInterval(load_dependencies['dependencies_met_html_loaded_{{player_id}}']);
372
+ clearInterval(load_dependencies['dependencies_met_html_loaded_{{player.id}}']);
378
373
  }
379
374
  }, 10); // END dependencies_met_html_loaded
380
375
  } // END if playerExistsInPage
@@ -458,7 +453,8 @@ j1.adapter.amplitude = ((j1, window) => {
458
453
 
459
454
  {% endif %} {% endfor %}
460
455
 
461
- // See: https://521dimensions.com/open-source/amplitudejs/docs
456
+ // See: https://521dimensions.com/open-source/amplitudejs/docs
457
+ // NOTE: slider VALUE (volume) is set by DEFAULT settings (player)
462
458
  Amplitude.init({
463
459
  bindings: {
464
460
  33: 'play_pause',
@@ -539,9 +535,10 @@ j1.adapter.amplitude = ((j1, window) => {
539
535
  // },
540
536
  continue_next: playerPlayNextTitle,
541
537
  volume: playerVolumeValue,
542
- volume_decrement: playerVolumeDecrement,
543
- volume_increment: playerVolumeIncrement
538
+ volume_decrement: playerVolumeSliderStep,
539
+ volume_increment: playerVolumeSliderStep
544
540
  }); // END Amplitude init
541
+
545
542
  }, // END initApi
546
543
 
547
544
  // -------------------------------------------------------------------------
@@ -553,31 +550,35 @@ j1.adapter.amplitude = ((j1, window) => {
553
550
  if (apiInitialized.state) {
554
551
  logger.info('\n' + 'initialize player specific UI events: started');
555
552
 
553
+ var parentContainer = (document.getElementById('{{xhr_container_id}}') !== null) ? true : false;
554
+ var parentContainerExist = ($('#' + '{{xhr_container_id}}')[0] !== undefined) ? true : false;
555
+
556
556
  {% for player in amplitude_options.players %} {% if player.enabled %}
557
- {% assign player_id = player.id %}
558
557
  {% assign xhr_data_path = amplitude_options.xhr_data_path %}
559
- {% capture xhr_container_id %}{{player_id}}_parent{% endcapture %}
560
-
561
- playerID = '{{player.id}}';
562
- playerType = '{{player.type}}';
563
- playList = '{{player.playlist}}';
564
- playListName = '{{player.playlist.name}}'
565
- playListTitle = '{{player.playlist.title}}';
566
-
567
- logger.debug('\n' + 'set playlist {{player.playlist}} on id #{{player_id}} with title: ' + playListTitle);
568
-
569
- // dynamic loader variable to setup the player on ID {{player_id}}
570
- dependency = 'dependencies_met_player_loaded_{{player_id}}';
558
+ {% capture xhr_container_id %}{{player.id}}_parent{% endcapture %}
559
+
560
+ playerID = '{{player.id}}';
561
+ playerType = '{{player.type}}';
562
+ playList = '{{player.playlist}}';
563
+ playListName = '{{player.playlist.name}}'
564
+ playListTitle = '{{player.playlist.title}}';
565
+
566
+ logger.debug('\n' + 'set playlist {{player.playlist}} on id #{{player.id}} with title: ' + playListTitle);
567
+
568
+ // dynamic loader variable to setup the player on ID {{player.id}}
569
+ dependency = 'dependencies_met_player_loaded_{{player.id}}';
571
570
  load_dependencies[dependency] = '';
572
571
 
573
572
  // -----------------------------------------------------------------
574
573
  // initialize player instance (when player UI is loaded)
575
574
  // -----------------------------------------------------------------
576
- load_dependencies['dependencies_met_player_loaded_{{player_id}}'] = setInterval (() => {
575
+ load_dependencies['dependencies_met_player_loaded_{{player.id}}'] = setInterval (() => {
577
576
  // check if HTML portion of the player is loaded successfully
578
- var xhrLoadState = j1.xhrDOMState['#' + '{{xhr_container_id}}'];
577
+ var xhrLoadState = j1.xhrDOMState['#' + '{{xhr_container_id}}'];
578
+ var playerExistsInPage = ($('#' + '{{xhr_container_id}}')[0] !== undefined) ? true : false;
579
579
 
580
- if (xhrLoadState === 'success') {
580
+ if (xhrLoadState === 'success' && playerExistsInPage) {
581
+ // if (xhrLoadState === 'success') {
581
582
 
582
583
  // set song (title) specific audio info links
583
584
  // -------------------------------------------------------------
@@ -586,14 +587,15 @@ j1.adapter.amplitude = ((j1, window) => {
586
587
  _this.setAudioInfo(infoLinks);
587
588
  }
588
589
 
590
+ // jadams, 2024-10-19: (song) events DISABLED
589
591
  // set song (title) specific UI events
590
592
  // -------------------------------------------------------------
591
- var songElements = document.getElementsByClassName('song');
592
- _this.songEvents(songElements);
593
+ // var songElements = document.getElementsByClassName('song');
594
+ // _this.songEvents(songElements);
593
595
 
594
596
  // player specific UI events
595
597
  // -------------------------------------------------------------
596
- logger.debug('\n' + 'setup player specific UI events on ID #{{player_id}}: started');
598
+ logger.debug('\n' + 'setup player specific UI events on ID #{{player.id}}: started');
597
599
 
598
600
  var dependencies_met_api_initialized = setInterval (() => {
599
601
  if (apiInitialized.state) {
@@ -603,7 +605,7 @@ j1.adapter.amplitude = ((j1, window) => {
603
605
  // ---------------------------------------------------------
604
606
  // START mini player UI events
605
607
  //
606
- if (document.getElementById(playerID) !== null) {
608
+ if (document.getElementById('{{player.id}}') !== null) {
607
609
 
608
610
  // click on progress bar
609
611
  // -------------------------------------------------------
@@ -629,15 +631,16 @@ j1.adapter.amplitude = ((j1, window) => {
629
631
  // ---------------------------------------------------------
630
632
  // START compact player UI events
631
633
  //
632
- if (document.getElementById(playerID) !== null) {
634
+ if (document.getElementById('{{player.id}}') !== null) {
633
635
 
634
636
  // show|hide scrollbar in playlist
635
637
  // -------------------------------------------------------
636
638
  const songsInPlaylist = Amplitude.getSongsInPlaylist(playListName);
637
-
638
639
  if (songsInPlaylist.length <= 8) {
639
640
  const titleListCompactPlayer = document.getElementById('compact_player_title_list_' + playListName);
640
- titleListCompactPlayer.classList.add('hide-scrollbar');
641
+ if (titleListCompactPlayer !== null) {
642
+ titleListCompactPlayer.classList.add('hide-scrollbar');
643
+ }
641
644
  }
642
645
 
643
646
  // show|hide playlist
@@ -645,7 +648,7 @@ j1.adapter.amplitude = ((j1, window) => {
645
648
 
646
649
  // show playlist
647
650
  var showPlaylist = document.getElementById("show_playlist_{{player.id}}");
648
-
651
+ if (showPlaylist !== null) {
649
652
  showPlaylist.addEventListener('click', function(event) {
650
653
  var scrollOffset = (window.innerWidth >= 720) ? -130 : -110;
651
654
 
@@ -660,7 +663,7 @@ j1.adapter.amplitude = ((j1, window) => {
660
663
  playlistScreen.classList.remove('slide-out-top');
661
664
  playlistScreen.classList.add('slide-in-top');
662
665
  playlistScreen.style.display = "block";
663
- playlistScreen.style.zIndex = "999";
666
+ playlistScreen.style.zIndex = "199";
664
667
 
665
668
  // disable scrolling (if window viewport >= BS Medium and above)
666
669
  if (window.innerWidth >= 720) {
@@ -670,24 +673,26 @@ j1.adapter.amplitude = ((j1, window) => {
670
673
  $('body').addClass('stop-scrolling');
671
674
  }
672
675
  }
673
- }); // END EventListener 'click' (compact player|show playlist)
676
+ }); // END EventListener 'click' (compact player|show playlist)
677
+ }
674
678
 
675
679
  // hide playlist
676
680
  var hidePlaylist = document.getElementById("hide_playlist_{{player.id}}");
681
+ if (hidePlaylist !== null) {
682
+ hidePlaylist.addEventListener('click', function(event) {
683
+ var playlistScreen = document.getElementById("playlist_screen_{{player.id}}");
677
684
 
678
- hidePlaylist.addEventListener('click', function(event) {
679
- var playlistScreen = document.getElementById("playlist_screen_{{player.id}}");
680
-
681
- playlistScreen.classList.remove('slide-in-top');
682
- playlistScreen.classList.add('slislide-out-top');
683
- playlistScreen.style.display = "none";
684
- playlistScreen.style.zIndex = "1";
685
+ playlistScreen.classList.remove('slide-in-top');
686
+ playlistScreen.classList.add('slislide-out-top');
687
+ playlistScreen.style.display = "none";
688
+ playlistScreen.style.zIndex = "1";
685
689
 
686
- // enable scrolling
687
- if ($('body').hasClass('stop-scrolling')) {
688
- $('body').removeClass('stop-scrolling');
689
- }
690
- }); // END EventListener 'click' (compact player|show playlist)
690
+ // enable scrolling
691
+ if ($('body').hasClass('stop-scrolling')) {
692
+ $('body').removeClass('stop-scrolling');
693
+ }
694
+ }); // END EventListener 'click' (compact player|show playlist)
695
+ }
691
696
 
692
697
  // click on progress bar
693
698
  // -------------------------------------------------------
@@ -703,20 +708,64 @@ j1.adapter.amplitude = ((j1, window) => {
703
708
 
704
709
  Amplitude.setSongPlayedPercentage(
705
710
  (parseFloat(xpos)/parseFloat(this.offsetWidth))*100);
706
- });
711
+ }); // END EventListener 'click'
707
712
  }
708
713
 
709
- // click on shuffle icon
710
- document.getElementById('compact_player_shuffle').addEventListener('click', function(event) {
711
- var shuffleState = (document.getElementById('compact_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
712
- Amplitude.setShuffle(shuffleState)
713
- });
714
+ // click on skip forward|backward (compact player)
715
+ // See: https://github.com/serversideup/amplitudejs/issues/384
716
+ // -------------------------------------------------------
714
717
 
715
- // click on repeat icon
716
- document.getElementById('compact_player_repeat').addEventListener('click', function(event) {
717
- var repeatState = (document.getElementById('compact_player_repeat').className.includes('amplitude-repeat-on')) ? true : false;
718
- Amplitude.setRepeat(repeatState)
719
- });
718
+ // add listeners to all SkipForwardButtons found
719
+ var compactPlayerSkipForwardButtons = document.getElementsByClassName("compact-player-skip-forward");
720
+ for (var i=0; i<compactPlayerSkipForwardButtons.length; i++) {
721
+ if (compactPlayerSkipForwardButtons[i].id === 'skip-forward_{{player.id}}') {
722
+ compactPlayerSkipForwardButtons[i].addEventListener('click', function(event) {
723
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
724
+ const duration = Amplitude.getSongDuration();
725
+ const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
726
+ const targetTime = parseFloat(currentTime + skipOffset);
727
+
728
+ if (currentTime > 0) {
729
+ Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
730
+ } // END EventListener 'click'
731
+ });
732
+ } // END if ID
733
+ } // END for SkipForwardButtons
734
+
735
+ // add listeners to all SkipBackwardButtons found
736
+ var compactPlayerSkipBackwardButtons = document.getElementsByClassName("compact-player-skip-backward");
737
+ for (var i=0; i<compactPlayerSkipBackwardButtons.length; i++) {
738
+ if (compactPlayerSkipBackwardButtons[i].id === 'skip-backward_{{player.id}}') {
739
+ compactPlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
740
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
741
+ const duration = Amplitude.getSongDuration();
742
+ const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
743
+ const targetTime = parseFloat(currentTime - skipOffset);
744
+
745
+ if (currentTime > 0) {
746
+ Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
747
+ } // END EventListener 'click'
748
+ });
749
+ } // END if ID
750
+ } // END for SkipBackwardButtons
751
+
752
+ // click on shuffle button
753
+ var compactPlayerShuffleButton = document.getElementById('compact_player_shuffle');
754
+ if (compactPlayerShuffleButton) {
755
+ compactPlayerShuffleButton.addEventListener('click', function(event) {
756
+ var shuffleState = (document.getElementById('compact_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
757
+ Amplitude.setShuffle(shuffleState)
758
+ }); // END EventListener 'click'
759
+ } // END compactPlayerShuffleButton
760
+
761
+ // click on repeat button
762
+ var compactPlayerRepeatButton = document.getElementById('compact_player_repeat');
763
+ if (compactPlayerRepeatButton) {
764
+ compactPlayerRepeatButton.addEventListener('click', function(event) {
765
+ var repeatState = (document.getElementById('compact_player_repeat').className.includes('amplitude-repeat-on')) ? true : false;
766
+ Amplitude.setRepeat(repeatState)
767
+ }); // END EventListener 'click'
768
+ } // END compactPlayerRepeatButton
720
769
 
721
770
  } // END compact player UI events
722
771
  {% endif %}
@@ -724,13 +773,79 @@ j1.adapter.amplitude = ((j1, window) => {
724
773
  {% if player.id contains 'large' %}
725
774
  // START large player UI events
726
775
  //
727
- if (document.getElementById(playerID) !== null) {
776
+ if (document.getElementById('{{player.id}}') !== null) {
728
777
 
729
- // click on progress bar
778
+ // listener overloads for Youtube video (large player)
730
779
  // -------------------------------------------------------
731
- var progressBars = document.getElementsByClassName("large-player-progress");
780
+
781
+ // click on prev button
782
+ var largePlayerPreviousButton = document.getElementById('large_player_previous');
783
+ if (largePlayerPreviousButton && largePlayerPreviousButton.getAttribute("data-amplitude-source") === 'youtube') {
784
+ largePlayerPreviousButton.addEventListener('click', function(event) {
785
+ var playlist = this.getAttribute("data-amplitude-playlist");
786
+ var songIndex = ytpSongIndex; // Amplitude.getActiveIndex();
787
+
788
+ }); // END EventListener 'click'
789
+ }
790
+
791
+ // click on play_pause button
792
+ var largePlayerPlayButton = document.getElementById('large_player_play_pause');
793
+ if (largePlayerPlayButton && largePlayerPlayButton.getAttribute("data-amplitude-source") === 'youtube') {
794
+ largePlayerPlayButton.addEventListener('click', function(event) {
795
+ var playlist = this.getAttribute("data-amplitude-playlist");
796
+ var songMetaData = Amplitude.getSongAtIndex(ytpSongIndex);
797
+ var songURL = songMetaData.url;
798
+ var songIndex = ytpSongIndex;
799
+
800
+ var dependencies_met_ytIframeAPIReady = setInterval (() => {
801
+ if (j1.adapter.amplitude['iframeAPIReady']) {
802
+ ytPlayer = j1.adapter.amplitude['ytPlayer'];
803
+ ytpPlaybackRate = ytPlayer.getPlaybackRate()
804
+
805
+ // ytPlayer.loadVideoById({
806
+ // 'videoId': 'bHQqvYy5KYo',
807
+ // 'startSeconds': 5,
808
+ // 'endSeconds': 60
809
+ // });
810
+
811
+ // ytPlayer.loadVideoByUrl(
812
+ // mediaContentUrl: songURL,
813
+ // startSeconds: 10
814
+ // )
815
+
816
+ // ytPlayer.playVideo();
817
+
818
+ clearInterval(dependencies_met_ytIframeAPIReady);
819
+ } // END if playersUILoaded
820
+ }, 10); // END dependencies_met_ytIframeAPIReady
821
+
822
+ }); // END EventListener 'click'
823
+ }
824
+
825
+ // click on next button
826
+ var largePlayerNextButton = document.getElementById('large_player_next');
827
+ if (largePlayerNextButton && largePlayerPlayButton.getAttribute("data-amplitude-source") === 'youtube') {
828
+ largePlayerNextButton.addEventListener('click', function(event) {
829
+ var playlist = this.getAttribute("data-amplitude-playlist");
830
+ var songIndex = ytpSongIndex; // Amplitude.getActiveIndex();
831
+ }); // END EventListener 'click'
832
+ }
833
+
834
+ // click on song container
835
+ var largetPlayerSongContainer = document.getElementsByClassName("song amplitude-song-container");
836
+ for (var i=0; i<largetPlayerSongContainer.length; i++) {
837
+ if (largetPlayerSongContainer[i].dataset.amplitudeSource === 'youtube') {
838
+ largetPlayerSongContainer[i].addEventListener('click', function(event) {
839
+ var playlist = this.getAttribute("data-amplitude-playlist");
840
+ var playlistLength = largetPlayerSongContainer.length;
841
+ ytpSongIndex = this.getAttribute("data-amplitude-song-index");
842
+ });
843
+ } // END if Attribute
844
+ } // END for
732
845
 
733
846
  // add listeners to all progress bars found
847
+ // -------------------------------------------------------
848
+ var progressBars = document.getElementsByClassName("large-player-progress");
734
849
  for (var i=0; i<progressBars.length; i++) {
735
850
  progressBars[i].addEventListener('click', function(event) {
736
851
  var offset = this.getBoundingClientRect();
@@ -738,20 +853,85 @@ j1.adapter.amplitude = ((j1, window) => {
738
853
 
739
854
  Amplitude.setSongPlayedPercentage(
740
855
  (parseFloat(xpos)/parseFloat(this.offsetWidth))*100);
741
- });
856
+ }); // END EventListener 'click'
742
857
  }
743
858
 
744
- // click on shuffle icon
745
- document.getElementById('large_player_shuffle').addEventListener('click', function(event) {
746
- var shuffleState = (document.getElementById('large_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
747
- Amplitude.setShuffle(shuffleState)
748
- });
859
+ // click on skip forward|backward (large player)
860
+ // See: https://github.com/serversideup/amplitudejs/issues/384
861
+ // -------------------------------------------------------
862
+
863
+ // add listeners to all SkipForwardButtons found
864
+ var largePlayerSkipForwardButtons = document.getElementsByClassName("large-player-skip-forward");
865
+ for (var i=0; i<largePlayerSkipForwardButtons.length; i++) {
866
+ if (largePlayerSkipForwardButtons[i].id === 'skip-forward_{{player.id}}') {
867
+ if (largePlayerSkipForwardButtons[i].dataset.amplitudeSource === 'youtube') {
868
+ largePlayerSkipForwardButtons[i].addEventListener('click', function(event) {
869
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
870
+ //const duration = Amplitude.getSongDuration();
871
+ //const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
872
+ //const targetTime = parseFloat(currentTime + skipOffset);
873
+
874
+ // if (currentTime > 0) {
875
+ // Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
876
+ // }
877
+ }); // END EventListener 'click
878
+ } else {
879
+ largePlayerSkipForwardButtons[i].addEventListener('click', function(event) {
880
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
881
+ const duration = Amplitude.getSongDuration();
882
+ const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
883
+ const targetTime = parseFloat(currentTime + skipOffset);
884
+
885
+ if (currentTime > 0) {
886
+ Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
887
+ }
888
+ }); // END EventListener 'click
889
+ }
890
+
891
+ } // END if ID
892
+ } // END for SkipForwardButtons
893
+
894
+ // add listeners to all SkipBackwardButtons found
895
+ var largePlayerSkipBackwardButtons = document.getElementsByClassName("large-player-skip-backward");
896
+ for (var i=0; i<largePlayerSkipBackwardButtons.length; i++) {
897
+ if (largePlayerSkipBackwardButtons[i].id === 'skip-backward_{{player.id}}') {
898
+ if (largePlayerSkipBackwardButtons[i].dataset.amplitudeSource === 'youtube') {
899
+ largePlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
900
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
901
+ }); // END EventListener 'click'
902
+ } else {
903
+ largePlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
904
+ const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
905
+ const duration = Amplitude.getSongDuration();
906
+ const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
907
+ const targetTime = parseFloat(currentTime - skipOffset);
908
+
909
+ if (currentTime > 0) {
910
+ Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
911
+ }
912
+ }); // END EventListener 'click'
913
+ }
749
914
 
750
- // click on repeat icon
751
- document.getElementById('repeat_container_large_player').addEventListener('click', function(event) {
752
- var repeatState = (document.getElementById('repeat_container_large_player').className.includes('amplitude-repeat-on')) ? true : false;
753
- Amplitude.setRepeat(repeatState)
754
- });
915
+ } // END if ID
916
+ } // END for SkipBackwardButtons
917
+
918
+ // click on shuffle button
919
+ var largePlayerShuffleButton = document.getElementById('large_player_shuffle');
920
+ if (largePlayerShuffleButton) {
921
+ largePlayerShuffleButton.addEventListener('click', function(event) {
922
+ var shuffleState = (document.getElementById('large_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
923
+ Amplitude.setShuffle(shuffleState)
924
+ }); // END EventListener 'click'
925
+ } // END largePlayerShuffleButton
926
+
927
+ // click on repeat button
928
+ var largePlayerRepeatButton = document.getElementById('large_player_repeat');
929
+ if (largePlayerShuffleButton) {
930
+ largePlayerRepeatButton.addEventListener('click', function(event) {
931
+ var repeatState = (document.getElementById('large_player_repeat').className.includes('amplitude-repeat-on')) ? true : false;
932
+ Amplitude.setRepeat(repeatState)
933
+ }); // END EventListener 'click'
934
+ } // END largePlayerRepeatButton
755
935
 
756
936
  // enable|disable scrolling on playlist
757
937
  // -------------------------------------------------------
@@ -763,7 +943,9 @@ j1.adapter.amplitude = ((j1, window) => {
763
943
 
764
944
  if (songsInPlaylist.length <= 8) {
765
945
  const titleListLargePlayer = document.getElementById('large_player_title_list_' + playListName);
766
- titleListLargePlayer.classList.add('hide-scrollbar');
946
+ if (titleListLargePlayer !== null) {
947
+ titleListLargePlayer.classList.add('hide-scrollbar');
948
+ }
767
949
  }
768
950
 
769
951
  // scroll to player top position
@@ -823,13 +1005,13 @@ j1.adapter.amplitude = ((j1, window) => {
823
1005
  // finished messages
824
1006
  // ---------------------------------------------------------
825
1007
  logger.debug('\n' + 'current player state: ' + amplitudePlayerState);
826
- logger.debug('\n' + 'setup player specific UI events on ID #{{player_id}}: finished');
1008
+ logger.debug('\n' + 'setup player specific UI events on ID #{{player.id}}: finished');
827
1009
 
828
1010
  clearInterval(dependencies_met_api_initialized);
829
1011
  } // END if apiInitialized
830
1012
  }, 10); // END dependencies_met_api_initialized
831
1013
 
832
- clearInterval(load_dependencies['dependencies_met_player_loaded_{{player_id}}']);
1014
+ clearInterval(load_dependencies['dependencies_met_player_loaded_{{player.id}}']);
833
1015
  } // END if xhrLoadState success
834
1016
  }, 10); // END dependencies_met_html_loaded
835
1017