j1-template 2024.3.14 → 2024.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/amplitude.html +111 -58
  3. data/assets/data/cookieconsent.html +8 -8
  4. data/assets/data/panel.html +4 -3
  5. data/assets/data/speak2me.html +11 -11
  6. data/assets/data/translator.html +29 -29
  7. data/assets/theme/j1/adapter/js/amplitude.js +112 -88
  8. data/assets/theme/j1/adapter/js/j1.js +4 -4
  9. data/assets/theme/j1/adapter/js/masonry.js +2 -2
  10. data/assets/theme/j1/adapter/js/themes.js +42 -4
  11. data/assets/theme/j1/adapter/js/videojs.js +212 -0
  12. data/assets/theme/j1/core/css/icon-fonts/mdib.css +24 -4
  13. data/assets/theme/j1/core/css/icon-fonts/mdib.css.map +1 -1
  14. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css +1 -1
  15. data/assets/theme/j1/core/css/icon-fonts/mdib.min.css.map +1 -1
  16. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css +9 -6
  17. data/assets/theme/j1/core/css/themes/unolight/bootstrap.css.map +1 -1
  18. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  19. data/assets/theme/j1/core/css/themes/unolight/bootstrap.min.css.map +1 -1
  20. data/assets/theme/j1/core/js/template.js +262 -275
  21. data/assets/theme/j1/core/js/template.min.js +7 -7
  22. data/assets/theme/j1/core/js/template.min.js.map +1 -1
  23. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.css +131 -24
  24. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/amplitude.min.css +1 -1
  25. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.css +102 -76
  26. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/compact.min.css +1 -1
  27. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.css +109 -78
  28. data/assets/theme/j1/modules/amplitudejs/css/theme/uno/dark/player/large.min.css +1 -1
  29. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/artist.svg +78 -0
  30. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/mute.svg +52 -20
  31. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/next.svg +20 -39
  32. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/now-playing.svg +24 -38
  33. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-hide.svg +85 -0
  34. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-music.svg +85 -0
  35. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist-show.svg +85 -0
  36. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/playlist.svg +85 -0
  37. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/previous.svg +18 -37
  38. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-backward.svg +33 -30
  39. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/skip-forward.svg +33 -29
  40. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/small/next.svg +55 -14
  41. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/small/previous.svg +56 -14
  42. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/volume.svg +38 -21
  43. data/assets/theme/j1/modules/amplitudejs/js/amplitude.map +20 -20
  44. data/assets/theme/j1/modules/amplitudejs/js/tech/youtube_example.js +211 -0
  45. data/assets/theme/j1/modules/gemini/js/gemini.js.map +1 -1
  46. data/assets/theme/j1/modules/jquery/js/jquery.min.map +1 -1
  47. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +206 -122
  48. data/assets/theme/j1/modules/videojs/assets/icons/custom-icons/next.svg +82 -0
  49. data/assets/theme/j1/modules/videojs/css/font/README.md +151 -0
  50. data/assets/theme/j1/modules/videojs/css/font/VideoJS.svg +150 -0
  51. data/assets/theme/j1/modules/videojs/css/font/video-js-cdn.css +2012 -0
  52. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.0.css +32 -0
  53. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.1.css +31 -0
  54. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.css +31 -0
  55. data/assets/theme/j1/modules/videojs/css/plugins/controls/skipbuttons.min.css +21 -0
  56. data/assets/theme/j1/modules/videojs/css/themes/uno.css +14 -3
  57. data/assets/theme/j1/modules/videojs/css/themes/uno.min.css +1 -1
  58. data/assets/theme/j1/modules/videojs/css/videojs.css +1 -0
  59. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/LICENSE +13 -0
  60. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/README.md +75 -0
  61. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/autocaption.js +149 -0
  62. data/assets/theme/j1/modules/videojs/js/plugins/controls/autocaption/autocaption.min.js +21 -0
  63. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/README.md +76 -30
  64. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/hotkeys.js +64 -53
  65. data/assets/theme/j1/modules/videojs/js/plugins/controls/hotkeys/hotkeys.min.js +1 -1
  66. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/README.md +133 -0
  67. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/skipbuttons.js +137 -0
  68. data/assets/theme/j1/modules/videojs/js/plugins/controls/skipbuttons/skipbuttons.min.js +21 -0
  69. data/assets/theme/j1/modules/videojs/js/plugins/controls/zoom/zoom.js +15 -12
  70. data/assets/theme/j1/modules/videojs/js/plugins/players/dm/dailymotion.js +2 -2
  71. data/assets/theme/j1/modules/videojs/js/plugins/players/yt/youtube.js +43 -16
  72. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.3/fastfilereaderext.so +0 -0
  73. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.3/rubyeventmachine.so +0 -0
  74. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.4/fastfilereaderext.so +0 -0
  75. data/lib/j1/patches/rubygems/eventmachine-1.2.7-x64-mingw32/lib/3.4/rubyeventmachine.so +0 -0
  76. data/lib/j1/version.rb +1 -1
  77. data/lib/j1_app/j1_auth_manager/config.rb +0 -4
  78. data/lib/starter_web/Gemfile +45 -22
  79. data/lib/starter_web/README.md +5 -5
  80. data/lib/starter_web/_config.yml +4 -6
  81. data/lib/starter_web/_data/modules/amplitude.yml +67 -37
  82. data/lib/starter_web/_data/modules/defaults/amplitude.yml +1 -0
  83. data/lib/starter_web/_data/modules/defaults/gallery.yml +42 -0
  84. data/lib/starter_web/_data/modules/defaults/videojs.yml +107 -0
  85. data/lib/starter_web/_data/modules/gallery.yml +30 -14
  86. data/lib/starter_web/_data/modules/lazyLoader.yml +8 -8
  87. data/lib/starter_web/_data/modules/masonry.yml +15 -0
  88. data/lib/starter_web/_data/modules/masterslider.yml +6 -6
  89. data/lib/starter_web/_data/modules/videojs.yml +57 -0
  90. data/lib/starter_web/_data/resources.yml +9 -26
  91. data/lib/starter_web/_data/templates/feed.xml +1 -1
  92. data/lib/starter_web/_includes/tables/jekyll_variables.asciidoc +1 -0
  93. data/lib/starter_web/_plugins/asciidoctor/carousel-block.rb +2 -1
  94. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +4 -1
  95. data/lib/starter_web/_plugins/asciidoctor/lightbox-block.rb +1 -1
  96. data/lib/starter_web/_plugins/asciidoctor/masterslider-block.rb +1 -1
  97. data/lib/starter_web/_plugins/asciidoctor/slick-block.rb +2 -1
  98. data/lib/starter_web/_plugins/asciidoctor/videojs-block.rb +145 -24
  99. data/lib/starter_web/_plugins/asciidoctor/vimeo-block.rb +4 -1
  100. data/lib/starter_web/_plugins/asciidoctor/wistia-block.rb +313 -0
  101. data/lib/starter_web/_plugins/asciidoctor/youtube-block.rb +192 -17
  102. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  103. data/lib/starter_web/assets/audio/cover/spontanorama/spontanorama.jpg +0 -0
  104. data/lib/starter_web/assets/audio/cover/spontanorama/src/spontanorama.png +0 -0
  105. data/lib/starter_web/assets/audio/cover/spontanorama/src/spontanorama.psd +0 -0
  106. data/lib/starter_web/package.json +1 -1
  107. data/lib/starter_web/pages/public/amplitude_yt_tester.adoc +20 -7
  108. data/lib/starter_web/pages/public/manuals/integrations/amplitudejs/amplitudejs-api.adoc +1 -1
  109. data/lib/starter_web/pages/public/manuals/integrations/videojs/youtube-api.adoc +1638 -0
  110. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +5 -6
  111. data/lib/starter_web/pages/public/tools/previewer/preview_videojs.adoc +203 -0
  112. data/lib/starter_web/pages/public/tour/asciidoc_extensions.adoc +1 -1
  113. data/lib/starter_web/pages/public/tour/bootstrap_themes.adoc +1 -1
  114. data/lib/starter_web/pages/public/tour/highlghter_rouge.adoc +1 -1
  115. data/lib/starter_web/pages/public/tour/modal_extentions.adoc +1 -1
  116. data/lib/starter_web/pages/public/tour/play_audio.adoc +30 -29
  117. data/lib/starter_web/pages/public/tour/play_video.adoc +65 -39
  118. data/lib/starter_web/pages/public/tour/present_images.adoc +17 -16
  119. data/lib/starter_web/pages/public/tour/quicksearch.adoc +1 -1
  120. data/lib/starter_web/pages/public/tour/responsive_tables.adoc +1 -1
  121. data/lib/starter_web/pages/public/tour/typography.adoc +1 -1
  122. metadata +37 -20
  123. data/assets/data/amplitude.28.html +0 -887
  124. data/assets/data/amplitude.29.html +0 -923
  125. data/assets/theme/j1/adapter/js/amplitude.23.js +0 -1165
  126. data/assets/theme/j1/adapter/js/amplitude.24.js +0 -1164
  127. data/assets/theme/j1/adapter/js/amplitude.25.js +0 -1268
  128. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/_pause.svg +0 -19
  129. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/_play.svg +0 -18
  130. data/assets/theme/j1/modules/amplitudejs/icons/player/dark/show-playlist.svg +0 -15
  131. data/assets/theme/j1/modules/jqueryScrollbar/LICENSE +0 -20
  132. data/assets/theme/j1/modules/jqueryScrollbar/README.md +0 -28
  133. data/assets/theme/j1/modules/jqueryScrollbar/css/scrollbar.css +0 -939
  134. data/assets/theme/j1/modules/jqueryScrollbar/css/scrollbar.min.css +0 -20
  135. data/assets/theme/j1/modules/jqueryScrollbar/js/scrollbar.js +0 -851
  136. data/assets/theme/j1/modules/jqueryScrollbar/js/scrollbar.min.js +0 -36
  137. data/assets/theme/j1/modules/jqueryScrollbar/sass/scrollbar.scss +0 -806
  138. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.0.js +0 -794
  139. data/lib/starter_web/_data/modules/lazyLoader.0.yml +0 -118
@@ -1,1165 +0,0 @@
1
- ---
2
- regenerate: true
3
- ---
4
-
5
- {%- capture cache -%}
6
-
7
- {% comment %}
8
- # -----------------------------------------------------------------------------
9
- # ~/assets/theme/j1/adapter/js/amplitude.js
10
- # Liquid template to adapt the AmplitudeJS v4 module
11
- #
12
- # Product/Info:
13
- # https://jekyll.one
14
- # Copyright (C) 2023, 2024 Juergen Adams
15
- #
16
- # J1 Template is licensed under the MIT License.
17
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
18
- # -----------------------------------------------------------------------------
19
- # Test data:
20
- # {{ liquid_var | debug }}
21
- # amplitude_options: {{ amplitude_options | debug }}
22
- # -----------------------------------------------------------------------------
23
- {% endcomment %}
24
-
25
- {% comment %} Liquid procedures
26
- -------------------------------------------------------------------------------- {% endcomment %}
27
-
28
- {% comment %} Set global settings
29
- -------------------------------------------------------------------------------- {% endcomment %}
30
- {% assign environment = site.environment %}
31
- {% assign asset_path = "/assets/theme/j1" %}
32
-
33
- {% comment %} Process YML config data
34
- ================================================================================ {% endcomment %}
35
-
36
- {% comment %} Set config files
37
- -------------------------------------------------------------------------------- {% endcomment %}
38
- {% assign template_config = site.data.j1_config %}
39
- {% assign blocks = site.data.blocks %}
40
- {% assign modules = site.data.modules %}
41
-
42
- {% comment %} Set config data (settings only)
43
- -------------------------------------------------------------------------------- {% endcomment %}
44
- {% assign amplitude_defaults = modules.defaults.amplitude.defaults %}
45
- {% assign amplitude_settings = modules.amplitude.settings %}
46
-
47
- {% comment %} Set config options (settings only)
48
- -------------------------------------------------------------------------------- {% endcomment %}
49
- {% assign amplitude_options = amplitude_defaults | merge: amplitude_settings %}
50
-
51
- {% comment %} Variables
52
- -------------------------------------------------------------------------------- {% endcomment %}
53
- {% assign comments = amplitude_options.enabled %}
54
-
55
- {% comment %} Detect prod mode
56
- -------------------------------------------------------------------------------- {% endcomment %}
57
- {% assign production = false %}
58
- {% if environment == 'prod' or environment == 'production' %}
59
- {% assign production = true %}
60
- {% endif %}
61
-
62
- /*
63
- # -----------------------------------------------------------------------------
64
- # ~/assets/theme/j1/adapter/js/amplitude.js
65
- # J1 Adapter for the amplitude module
66
- #
67
- # Product/Info:
68
- # https://jekyll.one
69
- #
70
- # Copyright (C) 2023, 2024 Juergen Adams
71
- #
72
- # J1 Template is licensed under the MIT License.
73
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
74
- # -----------------------------------------------------------------------------
75
- # Adapter generated: {{site.time}}
76
- # -----------------------------------------------------------------------------
77
- */
78
-
79
- // -----------------------------------------------------------------------------
80
- // ESLint shimming
81
- // -----------------------------------------------------------------------------
82
- /* eslint indent: "off" */
83
- // -----------------------------------------------------------------------------
84
-
85
- "use strict";
86
- j1.adapter.amplitude = ((j1, window) => {
87
-
88
- // göobal settings
89
- // ---------------------------------------------------------------------------
90
- var environment = '{{environment}}';
91
- var cookie_names = j1.getCookieNames();
92
- var user_state = j1.readCookie(cookie_names.user_state);
93
- var state = 'not_started';
94
-
95
- // module settings
96
- // ---------------------------------------------------------------------------
97
-
98
- // control|logging
99
- // ---------------
100
- var _this;
101
- var logger;
102
- var logText;
103
- var toJSON;
104
- var toText;
105
-
106
- // date|time monitoring
107
- //---------------------
108
- var startTime;
109
- var endTime;
110
- var startTimeModule;
111
- var endTimeModule;
112
- var timeSeconds;
113
-
114
- // amplitude api settings
115
- // ----------------------
116
- var ytpSongIndex = "0";
117
- var ytpAutoPlay = false;
118
- var ytpLoop = true;
119
- var playLists = {};
120
- var playersUILoaded = { state: false };
121
- var apiInitialized = { state: false };
122
- var playList;
123
- var playerID;
124
- var playerType;
125
- var playListTitle;
126
- var playListName;
127
- var amplitudePlayerState;
128
- var amplitudeDefaults;
129
- var amplitudeSettings;
130
- var amplitudeOptions;
131
- var ytPlayer;
132
-
133
- // amplitude player (instance) settings
134
- // NOTE: slider VALUE is set by Adapter|Amplitude API
135
- // ------------------------------------
136
- var xhrLoadState;
137
- var dependency;
138
- var playerCounter = 0;
139
- var load_dependencies = {};
140
- var playersProcessed = [];
141
- var playersHtmlLoaded = false;
142
- var processingPlayersFinished = false;
143
- var playerAudioInfo = ('{{amplitude_defaults.playlist.audio_info}}' === 'true') ? true : false;
144
- var playerDefaultType = '{{amplitude_defaults.player.type}}';
145
- var playerVolumeValue = '{{amplitude_defaults.player.volume_slider.preset_value}}';
146
- var playerVolumeSliderStep = '{{amplitude_defaults.player.volume_slider.slider_step}}';
147
- var playerRepeat = ('{{amplitude_defaults.player.repeat}}' === 'true') ? true : false;
148
- var playerShuffle = ('{{amplitude_defaults.player.shuffle}}' === 'true') ? true : false;
149
- var playerPlayNextTitle = ('{{amplitude_defaults.player.play_next_title}}' === 'true') ? true : false;
150
- var playerPauseNextTitle = ('{{amplitude_defaults.player.pause_next_title}}' === 'true') ? true : false;
151
- var playerDelayNextTitle = '{{amplitude_defaults.player.delay_next_title}}';
152
- var playerForwardBackwardSkipSeconds = '{{amplitude_defaults.player.forward_backward_skip_seconds}}';
153
-
154
- // unused settings
155
- // ---------------------------------------------------------------------------
156
- // var playerWaveformSampleRate = '{{amplitude_defaults.player.waveform_sample_rate}}';
157
-
158
- // ---------------------------------------------------------------------------
159
- // main
160
- // ---------------------------------------------------------------------------
161
- return {
162
-
163
- // -------------------------------------------------------------------------
164
- // adapter initializer
165
- // -------------------------------------------------------------------------
166
- init: (options) => {
167
-
168
- // -----------------------------------------------------------------------
169
- // default module settings
170
- // -----------------------------------------------------------------------
171
- var settings = $.extend({
172
- module_name: 'j1.adapter.amplitude',
173
- generated: '{{site.time}}'
174
- }, options);
175
-
176
- // -----------------------------------------------------------------------
177
- // global variable settings
178
- // -----------------------------------------------------------------------
179
- amplitudeDefaults = $.extend({}, {{amplitude_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
180
- amplitudeSettings = $.extend({}, {{amplitude_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
181
- amplitudeOptions = $.extend(true, {}, amplitudeDefaults, amplitudeSettings);
182
-
183
- // -----------------------------------------------------------------------
184
- // control|logging settings
185
- // -----------------------------------------------------------------------
186
- _this = j1.adapter.amplitude;
187
- logger = log4javascript.getLogger('j1.adapter.amplitude');
188
-
189
-
190
- // -----------------------------------------------------------------------
191
- // module initializer
192
- // -----------------------------------------------------------------------
193
- var dependencies_met_page_ready = setInterval (() => {
194
- var pageState = $('#content').css("display");
195
- var pageVisible = (pageState === 'block') ? true : false;
196
- var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
197
- // var atticFinished = (j1.adapter.attic.getState() == 'finished') ? true : false;
198
-
199
- if (j1CoreFinished && pageVisible) {
200
- startTimeModule = Date.now();
201
-
202
- _this.setState('started');
203
- logger.debug('\n' + 'module state: ' + _this.getState());
204
- logger.info('\n' + 'module is being initialized');
205
-
206
- // jQuery('.scrollbar-rail').scrollbar();
207
-
208
- // -------------------------------------------------------------------
209
- // create global playlist (songs)
210
- // -------------------------------------------------------------------
211
- var songs = [];
212
- _this.songLoader(songs);
213
-
214
- // -------------------------------------------------------------------
215
- // load all players (HTML|UI)
216
- // -------------------------------------------------------------------
217
- _this.playerHtmlLoader(playersUILoaded);
218
- // _this.ytpAudioInit("bla");
219
-
220
- // -------------------------------------------------------------------
221
- // inititialize amplitude api
222
- // -------------------------------------------------------------------
223
- var dependencies_met_players_loaded = setInterval (() => {
224
- if (playersUILoaded.state) {
225
- _this.initApi(songs);
226
- _this.ytpAudioInit({
227
- ytpVideoID: "qEhzpBJpUq0",
228
- ytpAutoPlay: ytpAutoPlay,
229
- ytpLoop: ytpLoop
230
- });
231
-
232
- clearInterval(dependencies_met_players_loaded);
233
- } // END if playersUILoaded
234
- }, 10); // END dependencies_met_players_loaded
235
-
236
- // -------------------------------------------------------------------
237
- // initialize player specific UI events
238
- // -------------------------------------------------------------------
239
- var dependencies_met_api_initialized = setInterval (() => {
240
- if (apiInitialized.state) {
241
- _this.initPlayerUiEvents();
242
-
243
- clearInterval(dependencies_met_api_initialized);
244
- } // END if apiInitialized
245
- }, 10); // END dependencies_met_api_initialized
246
-
247
- clearInterval(dependencies_met_page_ready);
248
- } // END pageVisible
249
- }, 10); // END dependencies_met_page_ready
250
- }, // END init
251
-
252
- // -------------------------------------------------------------------------
253
- // Create global playlist|songs (API)
254
- // -------------------------------------------------------------------------
255
- songLoader: (songs) => {
256
-
257
- logger.info('\n' + 'creating global playlist (API): started');
258
-
259
- // -----------------------------------------------------------------------
260
- // initialize amplitude songs
261
- // -----------------------------------------------------------------------
262
- {% for playlist in amplitude_settings.playlists %} {% if playlist.enabled %}
263
- var song_items = $.extend({}, {{playlist.items | replace: 'nil', 'null' | replace: '=>', ':' }});
264
-
265
- for (var i = 0; i < Object.keys(song_items).length; i++) {
266
- if (song_items[i].enabled) {
267
- var item = song_items[i];
268
- var song = {};
269
-
270
- // map config settings|amplitude song items
271
- // -----------------------------------------------------------------
272
- for (const key in item) {
273
- // skip properties NOT needed for a song
274
- if (key === 'item' || key === 'audio_base' || key === 'enabled') {
275
- continue;
276
- } else if (key === 'audio') {
277
- song.url = item.audio_base + '/' + item[key];
278
- continue;
279
- } else if (key === 'title') {
280
- song.name = item[key];
281
- continue;
282
- } else if (key === 'name') {
283
- song.album = item[key];
284
- continue;
285
- } else if (key === 'cover_image') {
286
- song.cover_art_url = item[key];
287
- continue;
288
- } else if (key === 'audio_info') {
289
- if (playerAudioInfo) {
290
- song.audio_info = item[key];
291
- } else {
292
- song.audio_info = '';
293
- } // END if playerAudioInfo
294
- continue;
295
- } else {
296
- song[key] = item[key];
297
- } // END if key
298
- } // END for item
299
- } // END id enabled
300
-
301
- songs.push(song);
302
- } // END for song_items
303
-
304
- {% endif %} {% endfor %}
305
-
306
- logger.info('\n' + 'creating global playlist (API): finished');
307
- }, // END songLoader
308
-
309
- // -------------------------------------------------------------------------
310
- // load players HTML portion (UI)
311
- // -------------------------------------------------------------------------
312
- playerHtmlLoader: (playersLoaded) => {
313
- var playerExistsInPage;
314
-
315
- // -----------------------------------------------------------------------
316
- // initialize HTML portion (UI) for all players configured|enabled
317
- // -----------------------------------------------------------------------
318
- logger.info('\n' + 'loading player HTML components (UI): started');
319
-
320
- {% for player in amplitude_options.players %} {% if player.enabled %}
321
- {% assign xhr_data_path = amplitude_options.xhr_data_path %}
322
- {% capture xhr_container_id %}{{player.id}}_parent{% endcapture %}
323
-
324
- // load players only that are configured in current page
325
- //
326
- playerExistsInPage = ($('#' + '{{xhr_container_id}}')[0] !== undefined) ? true : false;
327
- if (playerExistsInPage) {
328
- playerCounter++;
329
- logger.debug('\n' + 'load player UI on ID #{{player.id}}: started');
330
-
331
- j1.loadHTML({
332
- xhr_container_id: '{{xhr_container_id}}',
333
- xhr_data_path: '{{xhr_data_path}}',
334
- xhr_data_element: '{{player.id}}'
335
- },
336
- 'j1.adapter.amplitude',
337
- 'data_loaded'
338
- );
339
-
340
- // dynamic loader variable to setup the player on ID {{player.id}}
341
- dependency = 'dependencies_met_html_loaded_{{player.id}}';
342
- load_dependencies[dependency] = '';
343
-
344
- // ---------------------------------------------------------------------
345
- // initialize amplitude instance (when player UI loaded)
346
- // ---------------------------------------------------------------------
347
- load_dependencies['dependencies_met_html_loaded_{{player.id}}'] = setInterval (() => {
348
- // check if HTML portion of the player is loaded successfully
349
- xhrLoadState = j1.xhrDOMState['#' + '{{xhr_container_id}}'];
350
-
351
- if (xhrLoadState === 'success') {
352
- playersProcessed.push('{{xhr_container_id}}');
353
- logger.debug('\n' + 'load player UI on ID #{{player.id}}: finished');
354
-
355
- clearInterval(load_dependencies['dependencies_met_html_loaded_{{player.id}}']);
356
- }
357
- }, 10); // END dependencies_met_html_loaded
358
- } // END if playerExistsInPage
359
-
360
- {% endif %} {% endfor %}
361
-
362
- load_dependencies['dependencies_met_players_loaded'] = setInterval (() => {
363
-
364
- if (playersProcessed.length === playerCounter) {
365
- processingPlayersFinished = true;
366
- }
367
-
368
- if (processingPlayersFinished) {
369
- logger.info('\n' + 'loading player HTML components (UI): finished');
370
-
371
- clearInterval(load_dependencies['dependencies_met_players_loaded']);
372
- playersLoaded.state = true;
373
- }
374
- }, 10); // END dependencies_met_players_loaded
375
-
376
- }, // END playerHtmlLoader
377
-
378
- // -------------------------------------------------------------------------
379
- // initApi
380
- // -------------------------------------------------------------------------
381
- initApi: (songlist) => {
382
-
383
- logger.info('\n' + 'initialze API: started');
384
-
385
- {% comment %} collect playlists
386
- -------------------------------------------------------------------------- {% endcomment %}
387
- {% assign playlists_enabled = 0 %}
388
- {% for list in amplitude_settings.playlists %} {% if list.enabled %}
389
- {% assign playlists_enabled = playlists_enabled | plus: 1 %}
390
- {% endif %} {% endfor %}
391
-
392
- {% assign playlists_processed = 0 %}
393
- {% for list in amplitude_settings.playlists %} {% if list.enabled %}
394
- {% assign playlist_items = list.items %}
395
- {% assign playlist_name = list.name %}
396
- {% assign playlist_title = list.title %}
397
-
398
- {% comment %} collect song items
399
- ------------------------------------------------------------------------ {% endcomment %}
400
- {% for item in playlist_items %} {% if item.enabled %}
401
- {% capture song_item %}
402
- {
403
- "name": "{{item.title}}",
404
- "artist": "{{item.artist}}",
405
- "album": "{{item.name}}",
406
- "url": "{{item.audio_base}}/{{item.audio}}",
407
- "cover_art_url": "{{item.cover_image}}"
408
- }{% if forloop.last %}{% else %},{% endif %}
409
- {% endcapture %}
410
- {% capture song_items %}{{song_items}} {{song_item}}{% endcapture %}
411
-
412
- {% comment %} create playlist
413
- ---------------------------------------------------------------------- {% endcomment %}
414
- {% if forloop.last %}
415
- {% capture playlist %}
416
- "{{playlist_name}}": {
417
- "title": "{{playlist_title}}",
418
- "songs": [
419
- {{song_items}}
420
- ]
421
- }
422
- {% endcapture %}
423
- {% assign playlists_processed = playlists_processed | plus: 1 %}
424
-
425
- {% comment %} reset song_items
426
- -------------------------------------------------------------------- {% endcomment %}
427
- {% capture song_items %}{% endcapture %}
428
- {% endif %}
429
- {% endif %} {% endfor %}
430
-
431
- {% comment %} collect playlists players enabled
432
- ------------------------------------------------------------------------ {% endcomment %}
433
- {% capture playlists %}
434
- {{playlists}} {{playlist}} {% if playlists_processed == playlists_enabled %}{% else %},{% endif %}
435
- {% endcapture %}
436
-
437
- {% endif %} {% endfor %}
438
-
439
- // See: https://521dimensions.com/open-source/amplitudejs/docs
440
- // NOTE: slider VALUE (volume) is set by DEFAULT settings (player)
441
- Amplitude.init({
442
- bindings: {
443
- 33: 'play_pause',
444
- 37: 'prev',
445
- 39: 'next'
446
- },
447
- songs: songlist,
448
- playlists: {
449
- {{playlists}}
450
- },
451
- callbacks: {
452
- initialized: function() {
453
- var amplitudeConfig = Amplitude.getConfig();
454
- logger.info('\n' + 'initialze API: finished');
455
- // indicate api successfully initialized
456
- apiInitialized.state = true;
457
- },
458
- onInitError: function() {
459
- // indicate api failed on initialization
460
- apiInitialized.state = false;
461
- console.error('\n' + 'Amplitude API failed on initialization');
462
- },
463
- play: function() {
464
- var songMetaData = Amplitude.getActiveSongMetadata();
465
- logger.debug('\n' + 'playing title: ' + songMetaData.name);
466
- document.getElementById('album-art').style.visibility = 'hidden';
467
- document.getElementById('large-visualization').style.visibility = 'visible';
468
- },
469
- pause: function() {
470
- var songMetaData = Amplitude.getActiveSongMetadata();
471
- logger.debug('\n' + 'pause title: ' + songMetaData.name);
472
- document.getElementById('album-art').style.visibility = 'visible';
473
- document.getElementById('large-visualization').style.visibility = 'hidden';
474
- },
475
- song_change: function() {
476
- var songMetaData = Amplitude.getActiveSongMetadata();
477
- logger.debug('\n' + 'changed to title: ' + songMetaData.name + ' with titleIndex ' + songMetaData.index);
478
- },
479
- next: function() {
480
- var songMetaData = Amplitude.getActiveSongMetadata();
481
-
482
- if (playerDelayNextTitle) {
483
- logger.debug('\n' + 'delay on next title: ' + songMetaData.name + ' with titleIndex ' + songMetaData.index);
484
- }
485
-
486
- if (playerPauseNextTitle) {
487
- amplitudePlayerState = Amplitude.getPlayerState();
488
- if (amplitudePlayerState === 'playing' || amplitudePlayerState === 'stopped' ) {
489
- setTimeout(() => {
490
- // pause playback of next title
491
- logger.debug('\n' + 'paused on next title: ' + songMetaData.name);
492
- Amplitude.pause();
493
- }, 150);
494
- } // END if playing
495
- } // END if pause on next title
496
- },
497
- prev: function() {
498
- var songMetaData = Amplitude.getActiveSongMetadata();
499
-
500
- if (playerDelayNextTitle) {
501
- logger.debug('\n' + 'delay on previous title: ' + songMetaData.name + ' with titleIndex ' + songMetaData.index);
502
- }
503
-
504
- if (playerPauseNextTitle) {
505
- amplitudePlayerState = Amplitude.getPlayerState();
506
- if (amplitudePlayerState === 'playing' || amplitudePlayerState === 'stopped' ) {
507
- setTimeout(() => {
508
- // pause playback of next title
509
- logger.debug('\n' + 'paused on next title: ' + songMetaData.name);
510
- Amplitude.pause();
511
- }, 150);
512
- } // END if playing
513
- } // END if pause on next title
514
- }
515
- }, // END callbacks
516
- // waveforms: {
517
- // sample_rate: playerWaveformSampleRate
518
- // },
519
- continue_next: playerPlayNextTitle,
520
- volume: playerVolumeValue,
521
- volume_decrement: playerVolumeSliderStep,
522
- volume_increment: playerVolumeSliderStep
523
- }); // END Amplitude init
524
-
525
- }, // END initApi
526
-
527
- // -------------------------------------------------------------------------
528
- // initPlayerUiEvents
529
- // -------------------------------------------------------------------------
530
- initPlayerUiEvents: () => {
531
-
532
- var dependencies_met_player_instances_initialized = setInterval (() => {
533
- if (apiInitialized.state) {
534
- logger.info('\n' + 'initialize player specific UI events: started');
535
-
536
- {% for player in amplitude_options.players %} {% if player.enabled %}
537
- {% assign xhr_data_path = amplitude_options.xhr_data_path %}
538
- {% capture xhr_container_id %}{{player.id}}_parent{% endcapture %}
539
-
540
- playerID = '{{player.id}}';
541
- playerType = '{{player.type}}';
542
- playList = '{{player.playlist}}';
543
- playListName = '{{player.playlist.name}}'
544
- playListTitle = '{{player.playlist.title}}';
545
-
546
- logger.debug('\n' + 'set playlist {{player.playlist}} on id #{{player.id}} with title: ' + playListTitle);
547
-
548
- // dynamic loader variable to setup the player on ID {{player.id}}
549
- dependency = 'dependencies_met_player_loaded_{{player.id}}';
550
- load_dependencies[dependency] = '';
551
-
552
- // -----------------------------------------------------------------
553
- // initialize player instance (when player UI is loaded)
554
- // -----------------------------------------------------------------
555
- load_dependencies['dependencies_met_player_loaded_{{player.id}}'] = setInterval (() => {
556
- // check if HTML portion of the player is loaded successfully
557
- var xhrLoadState = j1.xhrDOMState['#' + '{{xhr_container_id}}'];
558
-
559
- if (xhrLoadState === 'success') {
560
-
561
- // set song (title) specific audio info links
562
- // -------------------------------------------------------------
563
- if (playerAudioInfo) {
564
- var infoLinks = document.getElementsByClassName('audio-info-link');
565
- _this.setAudioInfo(infoLinks);
566
- }
567
-
568
- // jadams, 2024-10-19: (song) events DISABLED
569
- // set song (title) specific UI events
570
- // -------------------------------------------------------------
571
- // var songElements = document.getElementsByClassName('song');
572
- // _this.songEvents(songElements);
573
-
574
- // player specific UI events
575
- // -------------------------------------------------------------
576
- logger.debug('\n' + 'setup player specific UI events on ID #{{player.id}}: started');
577
-
578
- var dependencies_met_api_initialized = setInterval (() => {
579
- if (apiInitialized.state) {
580
- amplitudePlayerState = Amplitude.getPlayerState();
581
-
582
- {% if player.id contains 'mini' %}
583
- // ---------------------------------------------------------
584
- // START mini player UI events
585
- //
586
- if (document.getElementById('{{player.id}}') !== null) {
587
-
588
- // click on progress bar
589
- // -------------------------------------------------------
590
-
591
- // getElementsByClassName returns an Array-like object
592
- var progressBars = document.getElementsByClassName("mini-player-progress");
593
-
594
- // add listeners to all progress bars found
595
- for (var i=0; i<progressBars.length; i++) {
596
- progressBars[i].addEventListener('click', function(event) {
597
- var offset = this.getBoundingClientRect();
598
- var xpos = event.pageX - offset.left;
599
-
600
- Amplitude.setSongPlayedPercentage(
601
- (parseFloat(xpos)/parseFloat(this.offsetWidth))*100);
602
- });
603
- }
604
-
605
- } // END mini player UI events
606
- {% endif %}
607
-
608
- {% if player.id contains 'compact' %}
609
- // ---------------------------------------------------------
610
- // START compact player UI events
611
- //
612
- if (document.getElementById('{{player.id}}') !== null) {
613
-
614
- // show|hide scrollbar in playlist
615
- // -------------------------------------------------------
616
- const songsInPlaylist = Amplitude.getSongsInPlaylist(playListName);
617
- if (songsInPlaylist.length <= 8) {
618
- const titleListCompactPlayer = document.getElementById('compact_player_title_list_' + playListName);
619
- if (titleListCompactPlayer !== null) {
620
- titleListCompactPlayer.classList.add('hide-scrollbar');
621
- }
622
- }
623
-
624
- // show|hide playlist
625
- // -------------------------------------------------------
626
-
627
- // show playlist
628
- var showPlaylist = document.getElementById("show_playlist_{{player.id}}");
629
- if (showPlaylist !== null) {
630
- showPlaylist.addEventListener('click', function(event) {
631
- var scrollOffset = (window.innerWidth >= 720) ? -130 : -110;
632
-
633
- // scroll player to top position
634
- const targetDiv = document.getElementById("show_playlist_{{player.id}}");
635
- const targetDivPosition = targetDiv.offsetParent.offsetTop;
636
- window.scrollTo(0, targetDivPosition + scrollOffset);
637
-
638
- // open playlist
639
- var playlistScreen = document.getElementById("playlist_screen_{{player.id}}");
640
-
641
- playlistScreen.classList.remove('slide-out-top');
642
- playlistScreen.classList.add('slide-in-top');
643
- playlistScreen.style.display = "block";
644
- playlistScreen.style.zIndex = "999";
645
-
646
- // disable scrolling (if window viewport >= BS Medium and above)
647
- if (window.innerWidth >= 720) {
648
- if ($('body').hasClass('stop-scrolling')) {
649
- return false;
650
- } else {
651
- $('body').addClass('stop-scrolling');
652
- }
653
- }
654
- }); // END EventListener 'click' (compact player|show playlist)
655
- }
656
-
657
- // hide playlist
658
- var hidePlaylist = document.getElementById("hide_playlist_{{player.id}}");
659
- if (hidePlaylist !== null) {
660
- hidePlaylist.addEventListener('click', function(event) {
661
- var playlistScreen = document.getElementById("playlist_screen_{{player.id}}");
662
-
663
- playlistScreen.classList.remove('slide-in-top');
664
- playlistScreen.classList.add('slislide-out-top');
665
- playlistScreen.style.display = "none";
666
- playlistScreen.style.zIndex = "1";
667
-
668
- // enable scrolling
669
- if ($('body').hasClass('stop-scrolling')) {
670
- $('body').removeClass('stop-scrolling');
671
- }
672
- }); // END EventListener 'click' (compact player|show playlist)
673
- }
674
-
675
- // click on progress bar
676
- // -------------------------------------------------------
677
-
678
- // getElementsByClassName returns an Array-like object
679
- var progressBars = document.getElementsByClassName("compact-player-progress");
680
-
681
- // add listeners to all progress bars found
682
- for (var i=0; i<progressBars.length; i++) {
683
- progressBars[i].addEventListener('click', function(event) {
684
- var offset = this.getBoundingClientRect();
685
- var xpos = event.pageX - offset.left;
686
-
687
- Amplitude.setSongPlayedPercentage(
688
- (parseFloat(xpos)/parseFloat(this.offsetWidth))*100);
689
- }); // END EventListener 'click'
690
- }
691
-
692
- // click on skip forward|backward (compact player)
693
- // See: https://github.com/serversideup/amplitudejs/issues/384
694
- // -------------------------------------------------------
695
-
696
- // add listeners to all SkipForwardButtons found
697
- var compactPlayerSkipForwardButtons = document.getElementsByClassName("compact-player-skip-forward");
698
- for (var i=0; i<compactPlayerSkipForwardButtons.length; i++) {
699
- if (compactPlayerSkipForwardButtons[i].id === 'skip-forward_{{player.id}}') {
700
- compactPlayerSkipForwardButtons[i].addEventListener('click', function(event) {
701
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
702
- const duration = Amplitude.getSongDuration();
703
- const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
704
- const targetTime = parseFloat(currentTime + skipOffset);
705
-
706
- if (currentTime > 0) {
707
- Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
708
- } // END EventListener 'click'
709
- });
710
- } // END if ID
711
- } // END for SkipForwardButtons
712
-
713
- // add listeners to all SkipBackwardButtons found
714
- var compactPlayerSkipBackwardButtons = document.getElementsByClassName("compact-player-skip-backward");
715
- for (var i=0; i<compactPlayerSkipBackwardButtons.length; i++) {
716
- if (compactPlayerSkipBackwardButtons[i].id === 'skip-backward_{{player.id}}') {
717
- compactPlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
718
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
719
- const duration = Amplitude.getSongDuration();
720
- const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
721
- const targetTime = parseFloat(currentTime - skipOffset);
722
-
723
- if (currentTime > 0) {
724
- Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
725
- } // END EventListener 'click'
726
- });
727
- } // END if ID
728
- } // END for SkipBackwardButtons
729
-
730
- // click on shuffle button
731
- var compactPlayerShuffleButton = document.getElementById('compact_player_shuffle');
732
- if (compactPlayerShuffleButton) {
733
- compactPlayerShuffleButton.addEventListener('click', function(event) {
734
- var shuffleState = (document.getElementById('compact_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
735
- Amplitude.setShuffle(shuffleState)
736
- }); // END EventListener 'click'
737
- } // END compactPlayerShuffleButton
738
-
739
- // click on repeat button
740
- var compactPlayerRepeatButton = document.getElementById('compact_player_repeat');
741
- if (compactPlayerRepeatButton) {
742
- compactPlayerRepeatButton.addEventListener('click', function(event) {
743
- var repeatState = (document.getElementById('compact_player_repeat').className.includes('amplitude-repeat-on')) ? true : false;
744
- Amplitude.setRepeat(repeatState)
745
- }); // END EventListener 'click'
746
- } // END compactPlayerRepeatButton
747
-
748
- } // END compact player UI events
749
- {% endif %}
750
-
751
- {% if player.id contains 'large' %}
752
- // START large player UI events
753
- //
754
- if (document.getElementById('{{player.id}}') !== null) {
755
-
756
- // listener overloads for Youtube video (large player)
757
- // -------------------------------------------------------
758
-
759
- // click on prev button
760
- var largePlayerPreviousButton = document.getElementById('large_player_previous');
761
- if (largePlayerPreviousButton && largePlayerPreviousButton.getAttribute("data-amplitude-source") === 'youtube') {
762
- largePlayerPreviousButton.addEventListener('click', function(event) {
763
- var playlist = this.getAttribute("data-amplitude-playlist");
764
- var songIndex = ytpSongIndex; // Amplitude.getActiveIndex();
765
-
766
- }); // END EventListener 'click'
767
- }
768
-
769
- // click on play_pause button
770
- var largePlayerPlayButton = document.getElementById('large_player_play_pause');
771
- if (largePlayerPlayButton && largePlayerPlayButton.getAttribute("data-amplitude-source") === 'youtube') {
772
- largePlayerPlayButton.addEventListener('click', function(event) {
773
- var playlist = this.getAttribute("data-amplitude-playlist");
774
- var songMetaData = Amplitude.getSongAtIndex(ytpSongIndex);
775
- var songURL = songMetaData.url;
776
- // Amplitude.getActiveIndex();
777
- var songIndex = ytpSongIndex;
778
- }); // END EventListener 'click'
779
- }
780
-
781
- // click on next button
782
- var largePlayerNextButton = document.getElementById('large_player_next');
783
- if (largePlayerNextButton && largePlayerPlayButton.getAttribute("data-amplitude-source") === 'youtube') {
784
- largePlayerNextButton.addEventListener('click', function(event) {
785
- var playlist = this.getAttribute("data-amplitude-playlist");
786
- var songIndex = ytpSongIndex; // Amplitude.getActiveIndex();
787
- }); // END EventListener 'click'
788
- }
789
-
790
- // click on song container
791
- var largetPlayerSongContainer = document.getElementsByClassName("song amplitude-song-container");
792
- for (var i=0; i<largetPlayerSongContainer.length; i++) {
793
- if (largetPlayerSongContainer[i].dataset.amplitudeSource === 'youtube') {
794
- largetPlayerSongContainer[i].addEventListener('click', function(event) {
795
- var playlist = this.getAttribute("data-amplitude-playlist");
796
- var playlistLength = largetPlayerSongContainer.length;
797
- ytpSongIndex = this.getAttribute("data-amplitude-song-index");
798
- });
799
- } // END if Attribute
800
- } // END for
801
-
802
- // add listeners to all progress bars found
803
- // -------------------------------------------------------
804
- var progressBars = document.getElementsByClassName("large-player-progress");
805
- for (var i=0; i<progressBars.length; i++) {
806
- progressBars[i].addEventListener('click', function(event) {
807
- var offset = this.getBoundingClientRect();
808
- var xpos = event.pageX - offset.left;
809
-
810
- Amplitude.setSongPlayedPercentage(
811
- (parseFloat(xpos)/parseFloat(this.offsetWidth))*100);
812
- }); // END EventListener 'click'
813
- }
814
-
815
- // click on skip forward|backward (large player)
816
- // See: https://github.com/serversideup/amplitudejs/issues/384
817
- // -------------------------------------------------------
818
-
819
- // add listeners to all SkipForwardButtons found
820
- var largePlayerSkipForwardButtons = document.getElementsByClassName("large-player-skip-forward");
821
- for (var i=0; i<largePlayerSkipForwardButtons.length; i++) {
822
- if (largePlayerSkipForwardButtons[i].id === 'skip-forward_{{player.id}}') {
823
- if (largePlayerSkipForwardButtons[i].dataset.amplitudeSource === 'youtube') {
824
- largePlayerSkipForwardButtons[i].addEventListener('click', function(event) {
825
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
826
- //const duration = Amplitude.getSongDuration();
827
- //const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
828
- //const targetTime = parseFloat(currentTime + skipOffset);
829
-
830
- // if (currentTime > 0) {
831
- // Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
832
- // }
833
- }); // END EventListener 'click
834
- } else {
835
- largePlayerSkipForwardButtons[i].addEventListener('click', function(event) {
836
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
837
- const duration = Amplitude.getSongDuration();
838
- const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
839
- const targetTime = parseFloat(currentTime + skipOffset);
840
-
841
- if (currentTime > 0) {
842
- Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
843
- }
844
- }); // END EventListener 'click
845
- }
846
-
847
- } // END if ID
848
- } // END for SkipForwardButtons
849
-
850
- // add listeners to all SkipBackwardButtons found
851
- var largePlayerSkipBackwardButtons = document.getElementsByClassName("large-player-skip-backward");
852
- for (var i=0; i<largePlayerSkipBackwardButtons.length; i++) {
853
- if (largePlayerSkipBackwardButtons[i].id === 'skip-backward_{{player.id}}') {
854
- if (largePlayerSkipBackwardButtons[i].dataset.amplitudeSource === 'youtube') {
855
- largePlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
856
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
857
- }); // END EventListener 'click'
858
- } else {
859
- largePlayerSkipBackwardButtons[i].addEventListener('click', function(event) {
860
- const skipOffset = parseFloat(playerForwardBackwardSkipSeconds);
861
- const duration = Amplitude.getSongDuration();
862
- const currentTime = parseFloat(Amplitude.getSongPlayedSeconds());
863
- const targetTime = parseFloat(currentTime - skipOffset);
864
-
865
- if (currentTime > 0) {
866
- Amplitude.setSongPlayedPercentage((targetTime / duration) * 100);
867
- }
868
- }); // END EventListener 'click'
869
- }
870
-
871
- } // END if ID
872
- } // END for SkipBackwardButtons
873
-
874
- // click on shuffle button
875
- var largePlayerShuffleButton = document.getElementById('large_player_shuffle');
876
- if (largePlayerShuffleButton) {
877
- largePlayerShuffleButton.addEventListener('click', function(event) {
878
- var shuffleState = (document.getElementById('large_player_shuffle').className.includes('amplitude-shuffle-on')) ? true : false;
879
- Amplitude.setShuffle(shuffleState)
880
- }); // END EventListener 'click'
881
- } // END largePlayerShuffleButton
882
-
883
- // click on repeat button
884
- var largePlayerRepeatButton = document.getElementById('large_player_repeat');
885
- if (largePlayerShuffleButton) {
886
- largePlayerRepeatButton.addEventListener('click', function(event) {
887
- var repeatState = (document.getElementById('large_player_repeat').className.includes('amplitude-repeat-on')) ? true : false;
888
- Amplitude.setRepeat(repeatState)
889
- }); // END EventListener 'click'
890
- } // END largePlayerRepeatButton
891
-
892
- // enable|disable scrolling on playlist
893
- // -------------------------------------------------------
894
- if (document.getElementById('large_player_right') !== null) {
895
-
896
- // show|hide scrollbar in playlist
897
- // -------------------------------------------------------
898
- const songsInPlaylist = Amplitude.getSongsInPlaylist(playListName);
899
-
900
- if (songsInPlaylist.length <= 8) {
901
- const titleListLargePlayer = document.getElementById('large_player_title_list_' + playListName);
902
- if (titleListLargePlayer !== null) {
903
- titleListLargePlayer.classList.add('hide-scrollbar');
904
- }
905
- }
906
-
907
- // scroll to player top position
908
- // -------------------------------------------------------
909
- var playlistHeader = document.getElementById("playlist_header_{{player.id}}");
910
-
911
- playlistHeader.addEventListener('click', function(event) {
912
- var scrollOffset = (window.innerWidth >= 720) ? -130 : -110;
913
-
914
- // scroll player to top position
915
- const targetDiv = document.getElementById("playlist_header_{{player.id}}");
916
- const targetDivPosition = targetDiv.offsetTop;
917
- window.scrollTo(0, targetDivPosition + scrollOffset);
918
- }); // END EventListener 'click'
919
-
920
- // disable scrolling (if window viewport >= BS Medium and above)
921
- document.getElementById('large_player_right').addEventListener('mouseenter', function() {
922
- if (window.innerWidth >= 720) {
923
- if ($('body').hasClass('stop-scrolling')) {
924
- return false;
925
- } else {
926
- $('body').addClass('stop-scrolling');
927
- }
928
- }
929
- }); // END EventListener 'mouseenter'
930
-
931
- // enable scrolling
932
- document.getElementById('large_player_right').addEventListener('mouseleave', function() {
933
- if ($('body').hasClass('stop-scrolling')) {
934
- $('body').removeClass('stop-scrolling');
935
- }
936
- }); // END EventListener 'mouseleave'
937
-
938
- } // END enable|disable scrolling on playlist
939
-
940
- } // END large player UI events
941
- {% endif %}
942
-
943
- // ---------------------------------------------------------
944
- // START configured player features
945
-
946
- logger.debug('\n' + 'set play next title: ' + playerPlayNextTitle);
947
- logger.debug('\n' + 'set delay between titles: ' + playerDelayNextTitle + 'ms');
948
- logger.debug('\n' + 'set repeat (album): ' + playerRepeat);
949
- logger.debug('\n' + 'set shuffle (album): ' + playerShuffle);
950
-
951
- // set delay between titles (songs)
952
- Amplitude.setDelay(playerDelayNextTitle);
953
- // set repeat (album)
954
- Amplitude.setRepeat(playerRepeat);
955
- // set shuffle (album)
956
- Amplitude.setShuffle(playerShuffle);
957
-
958
- // ---------------------------------------------------------
959
- // END configured player features
960
-
961
- // finished messages
962
- // ---------------------------------------------------------
963
- logger.debug('\n' + 'current player state: ' + amplitudePlayerState);
964
- logger.debug('\n' + 'setup player specific UI events on ID #{{player.id}}: finished');
965
-
966
- clearInterval(dependencies_met_api_initialized);
967
- } // END if apiInitialized
968
- }, 10); // END dependencies_met_api_initialized
969
-
970
- clearInterval(load_dependencies['dependencies_met_player_loaded_{{player.id}}']);
971
- } // END if xhrLoadState success
972
- }, 10); // END dependencies_met_html_loaded
973
-
974
- {% endif %} {% endfor %}
975
-
976
- logger.info('\n' + 'initialize player specific UI events: finished');
977
-
978
- _this.setState('finished');
979
- logger.debug('\n' + 'module state: ' + _this.getState());
980
- logger.info('\n' + 'module initialized successfully');
981
-
982
- endTimeModule = Date.now();
983
- logger.info('\n' + 'module initializing time: ' + (endTimeModule-startTimeModule) + 'ms');
984
-
985
- clearInterval(dependencies_met_player_instances_initialized);
986
- } // END if apiInitialized
987
- }, 10); // END initialize player specific UI events
988
- }, // END initPlayerUiEvents
989
-
990
- // -------------------------------------------------------------------------
991
- // START setAudioInfo
992
- setAudioInfo: (audioInfo) => {
993
- // jadams: ??? new config setting 'pause_on_audio_info' ???
994
- // when the audioInfo link is clicked, stop all propagation so
995
- // AmplitudeJS doesn't play the song.
996
- for (var i=0; i<audioInfo.length; i++) {
997
- audioInfo[i].addEventListener('click', function (event) {
998
- event.stopPropagation();
999
- });
1000
- }
1001
- }, // END setAudioInfo
1002
-
1003
- // -------------------------------------------------------------------------
1004
- // songEvents
1005
- // -------------------------------------------------------------------------
1006
- songEvents: (songs) => {
1007
- logger.debug('\n' + 'initializing title events for player on ID ' + '#' + playerID + ': started');
1008
-
1009
- for (var i = 0; i < songs.length; i++) {
1010
- // ensure that on mouseover, CSS styles don't get messed up for active songs
1011
- songs[i].addEventListener('mouseover', function() {
1012
- // active song indicator (mini play button) in playlist
1013
- if (!this.classList.contains('amplitude-active-song-container')) {
1014
- if (this.querySelectorAll('.play-button-container')[0] !== undefined) {
1015
- this.querySelectorAll('.play-button-container')[0].style.display = 'block';
1016
- }
1017
- } // END mini play button in playlist
1018
- }); // END EventListener 'mouseover' (songlist)
1019
-
1020
- // ensure that on mouseout, CSS styles don't get messed up for active songs
1021
- songs[i].addEventListener('mouseout', function() {
1022
- if (this.querySelectorAll('.play-button-container')[0] !== undefined) {
1023
- this.querySelectorAll('.play-button-container')[0].style.display = 'none';
1024
- }
1025
- }); // END EventListener 'mouseout' (songlist)
1026
-
1027
- // show|hide the (mini) play button when the song is clicked
1028
- songs[i].addEventListener('click', function () {
1029
- if (this.querySelectorAll('.play-button-container')[0] !== undefined) {
1030
- this.querySelectorAll('.play-button-container')[0].style.display = 'none';
1031
- }
1032
- }); // END EventListener 'click' (songlist)
1033
- }
1034
-
1035
- logger.debug('\n' + 'initializing title events for player on ID ' + '#' + playerID + ': finished');
1036
- }, // END songEvents
1037
-
1038
- // -------------------------------------------------------------------------
1039
- // Init YT Player
1040
- // -------------------------------------------------------------------------
1041
- ytpAudioInit: (options) => {
1042
- var ytpSettings = options;
1043
- var firstScriptTag;
1044
-
1045
- // load the IFrame Player API code asynchronously
1046
- //
1047
- var tag = document.createElement('script');
1048
- tag.id = 'iframe_api';
1049
- tag.src = '//youtube.com/iframe_api';
1050
- firstScriptTag = document.getElementsByTagName('script')[0];
1051
-
1052
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1053
-
1054
- // Create an <iframe> (and the YouTube player) after the YT API code
1055
- // has been downloaded
1056
- function onYouTubeIframeAPIReady() {
1057
-
1058
- logger.debug('\n' + 'YouTube IframeAPI: ready');
1059
-
1060
- var ytCtrl = document.getElementById("youtube_player_container");
1061
- ytCtrl.innerHTML = '<img id="youtube-icon1 src=""/> <div id="ytPlayer"></div>';
1062
- ytCtrl.style.cssText = 'width:150px;margin:2em auto;cursor:pointer;cursor:hand;display:none';
1063
- // ytCtrl.onclick = toggleAudio1;
1064
-
1065
- ytPlayer = new YT.Player('ytPlayer', {
1066
- height: 0,
1067
- width: 0,
1068
- videoId: ytpSettings.ytpVideoID,
1069
- playerVars: {
1070
- autoplay: ytpSettings.ytpAutoPlay,
1071
- loop: ytpSettings.ytpLoop
1072
- },
1073
- events: {
1074
- onReady: onPlayerReady,
1075
- onStateChange: onPlayerStateChange
1076
- }
1077
- });
1078
- } // END onYouTubeIframeAPIReady
1079
-
1080
- function onPlayerReady(event) {
1081
- ytPlayer.setPlaybackQuality("small");
1082
- // document.getElementById("youtube-audio").style.display = "block";
1083
- // togglePlayButton1(ytPlayer.getPlayerState() !== 5);
1084
- } // END event onPlayerReady
1085
-
1086
- function onPlayerStateChange(event) {
1087
- if (event.data === 0) {
1088
- var bla = 'blupp'
1089
- // togglePlayButton1(false);
1090
- }
1091
- } // END event onPlayerStateChange
1092
-
1093
- // Create a new div element
1094
- const ytpContainer = document.createElement('div');
1095
-
1096
- // Set attributes for the div container
1097
- ytpContainer.id = 'youtube_player_container';
1098
- // ytpContainer.className = 'container';
1099
- // ytpContainer.setAttribute("data-video", "WxcWO9O4DSM");
1100
- // ytpContainer.setAttribute("data-autoplay", "0");
1101
- // ytpContainer.setAttribute("data-loop", "1");
1102
- // ytpContainer.innerHTML = 'data-video="WxcWO9O4DSM" data-autoplay="0" data-loop="1"';
1103
-
1104
- // Append the div container to the end of the body
1105
- document.body.appendChild(ytpContainer);
1106
-
1107
- }, // END ytpAudioInit
1108
-
1109
- // -------------------------------------------------------------------------
1110
- // messageHandler()
1111
- // manage messages send from other J1 modules
1112
- // -------------------------------------------------------------------------
1113
- messageHandler: (sender, message) => {
1114
- var json_message = JSON.stringify(message, undefined, 2);
1115
-
1116
- logText = '\n' + 'received message from ' + sender + ': ' + json_message;
1117
- logger.debug(logText);
1118
-
1119
- // -----------------------------------------------------------------------
1120
- // process commands|actions
1121
- // -----------------------------------------------------------------------
1122
- if (message.type === 'command' && message.action === 'module_initialized') {
1123
-
1124
- //
1125
- // place handling of command|action here
1126
- //
1127
-
1128
- logger.info('\n' + message.text);
1129
- }
1130
-
1131
- //
1132
- // place handling of other command|action here
1133
- //
1134
-
1135
- return true;
1136
- }, // END messageHandler
1137
-
1138
- // -------------------------------------------------------------------------
1139
- // setState()
1140
- // sets the current (processing) state of the module
1141
- // -------------------------------------------------------------------------
1142
- setState: (stat) => {
1143
- _this.state = stat;
1144
- }, // END setState
1145
-
1146
- // -------------------------------------------------------------------------
1147
- // getState()
1148
- // Returns the current (processing) state of the module
1149
- // -------------------------------------------------------------------------
1150
- getState: () => {
1151
- return _this.state;
1152
- } // END getState
1153
-
1154
- }; // END main (return)
1155
- })(j1, window);
1156
-
1157
- {%- endcapture -%}
1158
-
1159
- {%- if production -%}
1160
- {{ cache|minifyJS }}
1161
- {%- else -%}
1162
- {{ cache|strip_empty_lines }}
1163
- {%- endif -%}
1164
-
1165
- {%- assign cache = false -%}