j1-template 2024.1.5 → 2024.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_page.html +0 -34
  3. data/_includes/themes/j1/modules/searcher/generator.html +4 -1
  4. data/_includes/themes/j1/modules/searcher/procedures/topsearch.proc +59 -56
  5. data/assets/data/authclient.html +1 -8
  6. data/assets/data/banner.html +1 -7
  7. data/assets/data/fab.html +2 -13
  8. data/assets/data/footer.html +0 -3
  9. data/assets/data/galeries.html +2 -13
  10. data/assets/data/gemini-ui.html +74 -21
  11. data/assets/data/iframes.html +1 -4
  12. data/assets/data/masonry.html +1 -13
  13. data/assets/data/masterslider.html +10 -21
  14. data/assets/data/menu.html +6 -14
  15. data/assets/data/mmenu.html +6 -5
  16. data/assets/data/mmenu_toc.html +2 -1
  17. data/assets/data/panel.html +4 -11
  18. data/assets/data/particles.yml +8 -8
  19. data/assets/data/quicklinks.html +4 -23
  20. data/assets/data/rtext_resizer.html +3 -1
  21. data/assets/data/slick.html +9 -11
  22. data/assets/data/translator.html +0 -1
  23. data/assets/themes/j1/adapter/js/advertising.js +141 -172
  24. data/assets/themes/j1/adapter/js/algolia.js +61 -54
  25. data/assets/themes/j1/adapter/js/analytics.js +67 -47
  26. data/assets/themes/j1/adapter/js/asciidoctor.js +32 -20
  27. data/assets/themes/j1/adapter/js/attic.js +75 -69
  28. data/assets/themes/j1/adapter/js/bmd.js +195 -177
  29. data/assets/themes/j1/adapter/js/carousel.js +786 -761
  30. data/assets/themes/j1/adapter/js/chatbot.js +77 -35
  31. data/assets/themes/j1/adapter/js/clipboard.js +66 -49
  32. data/assets/themes/j1/adapter/js/comments.js +92 -70
  33. data/assets/themes/j1/adapter/js/cookieConsent.js +466 -462
  34. data/assets/themes/j1/adapter/js/customFunctions.js +52 -35
  35. data/assets/themes/j1/adapter/js/customModule.js +56 -46
  36. data/assets/themes/j1/adapter/js/docsearch.js +54 -34
  37. data/assets/themes/j1/adapter/js/dropdowns.js +65 -52
  38. data/assets/themes/j1/adapter/js/fab.js +123 -109
  39. data/assets/themes/j1/adapter/js/gallery.js +494 -476
  40. data/assets/themes/j1/adapter/js/gemini.js +933 -299
  41. data/assets/themes/j1/adapter/js/iconPicker.js +255 -235
  42. data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -0
  43. data/assets/themes/j1/adapter/js/iframer.js +81 -61
  44. data/assets/themes/j1/adapter/js/j1.js +3285 -3222
  45. data/assets/themes/j1/adapter/js/lazyLoader.js +241 -222
  46. data/assets/themes/j1/adapter/js/lightbox.js +241 -241
  47. data/assets/themes/j1/adapter/js/logger.js +77 -66
  48. data/assets/themes/j1/adapter/js/lunr.js +688 -86
  49. data/assets/themes/j1/adapter/js/masonry.js +426 -411
  50. data/assets/themes/j1/adapter/js/masterslider.js +526 -527
  51. data/assets/themes/j1/adapter/js/mmenu.js +101 -66
  52. data/assets/themes/j1/adapter/js/navigator.js +291 -356
  53. data/assets/themes/j1/adapter/js/particles.js +61 -40
  54. data/assets/themes/j1/adapter/js/rangeSlider.js +65 -48
  55. data/assets/themes/j1/adapter/js/rouge.js +287 -269
  56. data/assets/themes/j1/adapter/js/rtable.js +309 -293
  57. data/assets/themes/j1/adapter/js/rtextResizer.js +57 -44
  58. data/assets/themes/j1/adapter/js/scroller.js +170 -133
  59. data/assets/themes/j1/adapter/js/slick.js +487 -485
  60. data/assets/themes/j1/adapter/js/slimSelect.js +290 -0
  61. data/assets/themes/j1/adapter/js/speak2me.js +124 -128
  62. data/assets/themes/j1/adapter/js/themeToggler.js +280 -260
  63. data/assets/themes/j1/adapter/js/{themer.js → themes.js} +145 -113
  64. data/assets/themes/j1/adapter/js/toccer.js +87 -54
  65. data/assets/themes/j1/adapter/js/translator.js +73 -70
  66. data/assets/themes/j1/adapter/js/waves.js +74 -58
  67. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +29 -11
  68. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  69. data/assets/themes/j1/core/js/template.js +474 -420
  70. data/assets/themes/j1/core/js/template.min.js +7 -7
  71. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  72. data/assets/themes/j1/modules/carousel/css/theme/uno.css +4 -4
  73. data/assets/themes/j1/modules/carousel/css/theme/uno.min.css +1 -1
  74. data/assets/themes/j1/modules/clipboard/js/clipboard.js +0 -1
  75. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +4 -4
  76. data/assets/themes/j1/modules/iconPicker/css/theme/uno.css +58 -0
  77. data/assets/themes/j1/modules/iconPicker/css/theme/uno.min.css +16 -0
  78. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.0.js +493 -0
  79. data/assets/themes/j1/modules/iconPicker/js/universal-icon-picker.js +7 -7
  80. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.js +4 -4
  81. data/assets/themes/j1/modules/lightGallery/js/plugins/lg-video.min.js +2 -10
  82. data/assets/themes/j1/modules/lunr/css/j1.css +12 -6
  83. data/assets/themes/j1/modules/lunr/css/j1.min.css +1 -1
  84. data/assets/themes/j1/modules/lunr/js/j1.js +46 -43
  85. data/assets/themes/j1/modules/lunr/js/j1.min.js +1 -1
  86. data/assets/themes/j1/modules/masterslider/js/masterslider.js +1 -1
  87. data/assets/themes/j1/modules/scroller/js/scroller.js +64 -74
  88. data/assets/themes/j1/modules/scroller/js/scroller.min.js +1 -1
  89. data/assets/themes/j1/modules/slick/slider/css/theme/uno.css +4 -4
  90. data/assets/themes/j1/modules/slick/slider/css/theme/uno.min.css +1 -1
  91. data/assets/themes/j1/modules/slimSelect/js/select.js +1865 -1821
  92. data/assets/themes/j1/modules/slimSelect/js/select.min.js +2 -1
  93. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +87 -89
  94. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  95. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/player.min.js +5 -7
  96. data/assets/themes/j1/modules/videojs/js/plugins/vm/api/v2.20.1/player.min.js +23 -0
  97. data/lib/j1/version.rb +1 -1
  98. data/lib/starter_web/Gemfile +2 -2
  99. data/lib/starter_web/README.md +5 -5
  100. data/lib/starter_web/_config.yml +1 -1
  101. data/lib/starter_web/_data/blocks/_panel.yml +775 -0
  102. data/lib/starter_web/_data/blocks/panel.yml +53 -53
  103. data/lib/starter_web/_data/j1_config.yml +3 -2
  104. data/lib/starter_web/_data/layouts/default.yml +0 -2
  105. data/lib/starter_web/_data/modules/_scroller.yml +102 -0
  106. data/lib/starter_web/_data/modules/carousel.yml +3 -3
  107. data/lib/starter_web/_data/modules/defaults/attics.yml +5 -5
  108. data/lib/starter_web/_data/modules/defaults/docsearch.yml +1 -1
  109. data/lib/starter_web/_data/modules/defaults/gemini.yml +204 -46
  110. data/lib/starter_web/_data/modules/defaults/{iconPicker.yml → icon_picker.yml} +6 -12
  111. data/lib/starter_web/_data/modules/defaults/lunr.yml +20 -5
  112. data/lib/starter_web/_data/modules/defaults/masterslider.yml +4 -4
  113. data/lib/starter_web/_data/modules/defaults/navigator.yml +20 -24
  114. data/lib/starter_web/_data/modules/defaults/particles.yml +3 -3
  115. data/lib/starter_web/_data/modules/defaults/slim_select.yml +54 -0
  116. data/lib/starter_web/_data/modules/defaults/{themer.yml → themes.yml} +171 -171
  117. data/lib/starter_web/_data/modules/defaults/toccer.yml +1 -1
  118. data/lib/starter_web/_data/modules/gallery.yml +33 -38
  119. data/lib/starter_web/_data/modules/gemini.yml +42 -3
  120. data/lib/starter_web/_data/modules/{iconPicker.yml → icon_picker.yml} +31 -3
  121. data/lib/starter_web/_data/modules/lunr.yml +12 -1
  122. data/lib/starter_web/_data/modules/masonry.yml +37 -38
  123. data/lib/starter_web/_data/modules/masterslider.yml +78 -95
  124. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -20
  125. data/lib/starter_web/_data/modules/particles.yml +3 -3
  126. data/lib/starter_web/_data/modules/scroller.yml +3 -3
  127. data/lib/starter_web/_data/modules/slim_select.yml +110 -0
  128. data/lib/starter_web/_data/modules/{themer.yml → themes.yml} +4 -4
  129. data/lib/starter_web/_data/resources.yml +57 -47
  130. data/lib/starter_web/_data/templates/feed.xml +1 -1
  131. data/lib/starter_web/_includes/attributes.asciidoc +354 -355
  132. data/lib/starter_web/_plugins/asciidoctor/gemini-ui-block.rb +1 -1
  133. data/lib/starter_web/_plugins/asciidoctor/slim-select-block.rb +45 -0
  134. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  135. data/lib/starter_web/collections/asciidoc_skeletons/simple-post/_posts/yyyy-mm-dd-your-post-name.asciidoc +5 -2
  136. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  137. data/lib/starter_web/collections/posts/public/featured/_posts/2021-01-01-about-cookies.adoc +9 -9
  138. data/lib/starter_web/collections/posts/public/featured/_posts/2021-02-01-static-site-generators.adoc +4 -4
  139. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +3 -2
  140. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +12 -12
  141. data/lib/starter_web/package.json +1 -1
  142. data/lib/starter_web/pages/public/about/features.adoc +1 -1
  143. data/lib/starter_web/pages/public/about/reporting_issues.adoc +1 -0
  144. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/_includes/attributes.asciidoc +44 -44
  145. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -0
  146. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/_includes/attributes.asciidoc +12 -12
  147. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  148. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/attributes.asciidoc +42 -28
  149. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/highlghter_rouge.adoc +1 -0
  150. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/lunr_search.adoc +1 -0
  151. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_audio_video.adoc +18 -2
  152. data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/present_images.adoc +500 -507
  153. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +6 -11
  154. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +4 -11
  155. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +5 -12
  156. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +5 -10
  157. data/lib/starter_web/pages/public/tools/previewer/_includes/attributes.asciidoc +10 -9
  158. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +77 -75
  159. metadata +50 -46
  160. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/attributes.asciidoc +0 -47
  161. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/preview_google_adsense.asciidoc +0 -448
  162. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/documents/readme +0 -0
  163. data/lib/starter_web/pages/public/manuals/integrations/gemini/_includes/tables/readme +0 -0
  164. data/lib/starter_web/pages/public/manuals/integrations/gemini/gemini.adoc +0 -525
  165. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.asccidoc +0 -274
  166. data/lib/starter_web/pages/public/manuals/integrations/gemini/security.hrml +0 -560
  167. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_biography.adoc +0 -0
  168. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_fantasy.adoc +0 -0
  169. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/article_previewer/viewer_romance.adoc +0 -0
  170. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/jekyll_collections.adoc +0 -0
  171. /data/lib/starter_web/pages/public/{legal/learn → learn}/bookshelf/viewer_all_books.adoc +0 -0
  172. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/100_gistblock.asciidoc +0 -0
  173. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_info.asciidoc +0 -0
  174. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_left_warning.asciidoc +0 -0
  175. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_bottom_right_danger.asciidoc +0 -0
  176. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_central_success.asciidoc +0 -0
  177. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_left_info.asciidoc +0 -0
  178. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_full_height_right_success.asciidoc +0 -0
  179. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_table_bs_modal_examples.asciidoc +0 -0
  180. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_info.asciidoc +0 -0
  181. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_left_info.asciidoc +0 -0
  182. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/410_top_right_success.asciidoc +0 -0
  183. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/419_advanced_modals_demo.asciidoc +0 -0
  184. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/tables/bs_modal_examples.asciidoc +0 -0
  185. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_bootstrap.asciidoc +0 -0
  186. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/_includes/documents/themes_rouge.asciidoc +0 -0
  187. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/asciidoc_extensions.adoc +0 -0
  188. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/bootstrap_themes.adoc +0 -0
  189. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/icon_fonts.adoc +0 -0
  190. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/modal_extentions.adoc +0 -0
  191. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/responsive_tables.adoc +0 -0
  192. /data/lib/starter_web/pages/public/{legal/learn → learn}/roundtrip/typography.adoc +0 -0
  193. /data/lib/starter_web/pages/public/{legal/learn → learn}/where_to_go.adoc +0 -0
@@ -1,485 +1,487 @@
1
- ---
2
- regenerate: true
3
- ---
4
-
5
- {% capture cache %}
6
-
7
- {% comment %}
8
- # -----------------------------------------------------------------------------
9
- # ~/assets/themes/j1/adapter/js/slick.js
10
- # Liquid template to create the Template Adapter for J1 Slick
11
- #
12
- # Product/Info:
13
- # http://jekyll.one
14
- #
15
- # Copyright (C) 2023, 2024 Juergen Adams
16
- #
17
- # J1 Template is licensed under the MIT License.
18
- # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
19
- # -----------------------------------------------------------------------------
20
- # Test data:
21
- # {{ liquid_var | debug }}
22
- # cookie_options: {{ cookie_options | debug }}
23
- # -----------------------------------------------------------------------------
24
- # See: https://github.com/kenwheeler/slick
25
- # -----------------------------------------------------------------------------
26
- {% endcomment %}
27
-
28
- {% comment %} Liquid var initialization
29
- -------------------------------------------------------------------------------- {% endcomment %}
30
-
31
- {% comment %} Set config files
32
- -------------------------------------------------------------------------------- {% endcomment %}
33
- {% assign environment = site.environment %}
34
- {% assign blocks = site.data.blocks %}
35
- {% assign modules = site.data.modules %}
36
- {% assign template_config = site.data.j1_config %}
37
-
38
- {% comment %} Set config data
39
- -------------------------------------------------------------------------------- {% endcomment
40
- {% assign attic_defaults = modules.defaults.attics.defaults %}
41
- {% assign attic_settings = modules.attics.settings %}
42
-
43
- {% assign slick_defaults = modules.defaults.slick.defaults %}
44
- {% assign slick_settings = modules.slick.settings %}
45
- {% assign slick_lightbox_defaults = modules.defaults.slick.defaults.lightbox %}
46
- {% assign slick_lightbox_settings = modules.slick.settings.lightbox %}
47
-
48
- {% comment %} Set config options
49
- -------------------------------------------------------------------------------- {% endcomment %}
50
-
51
- {% comment %} Set variables
52
- -------------------------------------------------------------------------------- {% endcomment %}
53
-
54
- {% comment %} Detect prod mode
55
- -------------------------------------------------------------------------------- {% endcomment %}
56
- {% assign production = false %}
57
- {% if environment == 'prod' or environment == 'production' %}
58
- {% assign production = true %}
59
- {% endif %}
60
-
61
- /*
62
- # -----------------------------------------------------------------------------
63
- # ~/assets/themes/j1/adapter/js/slick.js
64
- # JS Adapter for J1 Slick
65
- #
66
- # Product/Info:
67
- # http://jekyll.one
68
- #
69
- # Copyright (C) 2023, 2024 Juergen Adams
70
- #
71
- # J1 Theme is licensed under MIT License.
72
- # See: https://github.com/jekyll-one/J1 Theme/blob/master/LICENSE
73
- # -----------------------------------------------------------------------------
74
- # Adapter generated: {{site.time}}
75
- # -----------------------------------------------------------------------------
76
- */
77
-
78
- // -----------------------------------------------------------------------------
79
- // ESLint shimming
80
- // -----------------------------------------------------------------------------
81
- /* eslint indent: "off" */
82
- /* eslint quotes: "off" */
83
- // -----------------------------------------------------------------------------
84
- 'use strict';
85
- j1.adapter.slick = (function (j1, window) {
86
- var environment = '{{environment}}';
87
- var responsiveSettings = [];
88
- var carouselResponsiveSettings = [];
89
- var state = 'not_started';
90
- var _this;
91
- var logger;
92
- var logText;
93
- var atticDefaults;
94
- var atticSettings;
95
- var atticOptions;
96
- var slickDefaults;
97
- var slickSettings;
98
- var slickLightboxDefaults;
99
- var slickLightboxSettings;
100
- var slickLightboxOptions;
101
- var slickOptions;
102
- var carouselOptions;
103
- var carouselSettings;
104
-
105
- // ---------------------------------------------------------------------------
106
- // Helper functions
107
- // ---------------------------------------------------------------------------
108
-
109
- // ---------------------------------------------------------------------------
110
- // Main object
111
- // ---------------------------------------------------------------------------
112
- return {
113
-
114
- // -------------------------------------------------------------------------
115
- // Initializer
116
- // -------------------------------------------------------------------------
117
- init: function (options) {
118
- var xhrLoadState = 'pending'; // (initial) load state for the HTML portion of the carousel
119
- var load_dependencies = {}; // dynamic variable
120
- var carouselResponsiveSettingsOBJ = {}; // initial object for responsive settings
121
- var reload_on_resize = false;
122
- var dependency;
123
- var carouselResponsiveSettingsYAML;
124
- var carouselResponsiveSettingsSTRING;
125
- var slick_lightbox_enabled;
126
-
127
- // -----------------------------------------------------------------------
128
- // Default module settings
129
- // -----------------------------------------------------------------------
130
- var settings = $.extend({
131
- module_name: 'j1.adapter.cookieConsent',
132
- generated: '{{site.time}}'
133
- }, options);
134
-
135
- // Load module DEFAULTS|CONFIG
136
- atticDefaults = $.extend({}, {{attic_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
137
- atticSettings = $.extend({}, {{attic_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
138
- atticOptions = $.extend(true, {}, atticDefaults, atticSettings);
139
-
140
- slickDefaults = $.extend({}, {{slick_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
141
- slickSettings = $.extend({}, {{slick_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
142
- slickLightboxDefaults = $.extend({}, {{slick_lightbox_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
143
- slickLightboxSettings = $.extend({}, {{slick_lightbox_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
144
- slickLightboxOptions = $.extend(true, {}, slickLightboxDefaults, slickLightboxSettings);
145
- slickOptions = $.extend(true, {}, slickDefaults, slickSettings);
146
-
147
- // -----------------------------------------------------------------------
148
- // Global variable settings
149
- // -----------------------------------------------------------------------
150
- _this = j1.adapter.slick;
151
- logger = log4javascript.getLogger('j1.adapter.slick');
152
-
153
- _this.setState('started');
154
- logger.debug('\n' + 'state: ' + _this.getState());
155
- logger.info('\n' + 'module is being initialized');
156
-
157
- // load HTML portion for all carousels
158
- // console.debug('loading HTML portion for all carousels configured');
159
- _this.loadCarouselHTML(slickOptions, slickOptions.carousels);
160
-
161
- // Re-Init all carousels in a page if window is resized (if enabled)
162
- if (reload_on_resize) {
163
- window.onresize = function() {
164
- location.reload();
165
- }
166
- }
167
-
168
- // -----------------------------------------------------------------------
169
- // initializer
170
- // -----------------------------------------------------------------------
171
- // make sure the 'content' section is visible BEFORE setting-up sliders
172
- //
173
- var dependencies_met_page_ready = setInterval (function (options) {
174
- var contentState = $('#content').css("display");
175
- var contentVisible = (contentState == 'block') ? true: false;
176
-
177
- if (j1.getState() === 'finished' && contentVisible) {
178
- {% for carousel in slick_settings.carousels %} {% if carousel.enabled %}
179
- logger.info('\n' + 'carousel is being initialized on id: ' + '{{carousel.id}}');
180
-
181
- {% if carousel.options.responsive %}
182
- logger.info('\n' + 'collect responsive settings for carousel on id: ' + '{{carousel.id}}');
183
- // collect breakpoint settings from carousel config
184
- responsiveSettings = $.extend({}, {{carousel.responsive | replace: 'nil', 'null' | replace: '=>', ':' }});
185
- // generate carousel breakpoint settings as YAML data structure
186
- carouselResponsiveSettings = '[' ;
187
- for (const [obj_key, obj_value] of Object.entries(responsiveSettings)) {
188
- var length = Object.keys(obj_value.settings).length;
189
- var count = 0;
190
- for (const [key, value] of Object.entries(obj_value.settings)) {
191
- count++;
192
- if (key == 'breakOn' && count == 1) {
193
- carouselResponsiveSettings += ' {' ;
194
- carouselResponsiveSettings += ' breakpoint: ' + value + ',' ;
195
- carouselResponsiveSettings += ' settings: {' ;
196
- } else {
197
- carouselResponsiveSettings += ' ' + key + ': ' + value + ',' ;
198
- }
199
- // close current breakpoint element
200
- if (count == length) {
201
- carouselResponsiveSettings += ' }' ;
202
- carouselResponsiveSettings += ' },' ;
203
- }
204
- }
205
- } // End generate breakpoint YAML elements
206
-
207
- // close breakpoint YAML data
208
- carouselResponsiveSettings += ']';
209
- {% endif %}
210
-
211
- // create dynamic loader variable|s
212
- dependency = 'dependencies_met_html_loaded_{{carousel.id}}';
213
- load_dependencies[dependency] = '';
214
-
215
- // initialize carousel if HTML portion successfully loaded
216
- load_dependencies['dependencies_met_html_loaded_{{carousel.id}}'] = setInterval (function (options) {
217
- // check if HTML portion of the carousel is loaded successfully (loadcarouselHTML)
218
- xhrLoadState = j1.xhrDOMState['#{{carousel.id}}_parent'];
219
- if ( xhrLoadState === 'success' ) {
220
-
221
- // collect general carousel settings
222
- carouselOptions = $.extend({}, {{carousel.options | replace: 'nil', 'null' | replace: '=>', ':' }});
223
- carouselSettings = $.extend(true, {}, slickDefaults, carouselOptions );
224
-
225
- // convert carousel responsive settings to object (carouselResponsiveSettingsOBJ)
226
- carouselResponsiveSettingsYAML = yaml.loadAll(carouselResponsiveSettings, 'utf8');
227
- carouselResponsiveSettingsOBJ = carouselResponsiveSettingsYAML[0];
228
- carouselResponsiveSettingsSTRING = JSON.stringify(carouselResponsiveSettingsOBJ, null, 4);
229
- logger.debug('\n' + 'responsive settings on carousel id #{{carousel.id}}: ' + '\n' + carouselResponsiveSettingsSTRING);
230
-
231
- $('.{{carousel.id | replace: '_','-' }}').on('init', function(event, slick) {
232
- logger.info('\n' + 'carousel initialized on id: {{carousel.id}}');
233
-
234
- slick_lightbox_enabled = '{{carousel.lightbox.enabled}}';
235
-
236
- // check if a lightbox is used|enabled
237
- if ( slick_lightbox_enabled !== '' && slick_lightbox_enabled == 'true' ) {
238
- slick_lightbox_enabled = true;
239
- } else {
240
- slick_lightbox_enabled = false;
241
- }
242
-
243
- if (slick_lightbox_enabled) {
244
- logger.info('\n' + 'initialize lightbox on id: {{carousel.id}}');
245
-
246
- // See: http://mreq.github.io/slick-lightbox/demo/
247
- $('#{{carousel.id}}').slickLightbox({
248
- caption: slickLightboxOptions.caption,
249
- useHistoryApi: slickLightboxOptions.useHistoryApi,
250
- background: slickLightboxOptions.background,
251
- closeOnEscape: slickLightboxOptions.closeOnEscape,
252
- closeOnBackdropClick: slickLightboxOptions.closeOnBackdropClick,
253
- navigateByKeyboard: slickLightboxOptions.navigateByKeyboard,
254
- destroyTimeout: slickLightboxOptions.destroyTimeout,
255
- imageMaxHeight: slickLightboxOptions.imageMaxHeight,
256
- lazy: slickLightboxOptions.lazy,
257
- });
258
- } // END carousel lightbox enabled
259
-
260
- logger.info('\n' + 'adjust positions of slick lightbox arrows on id: {{carousel.id}}');
261
- var buttons = $("#{{carousel.id}} > button");
262
- var arrowTopPos = Math.round(document.documentElement.clientHeight/2)
263
-
264
- // jadams, 2023-09-01: not used anymore
265
- //
266
- // re-calculate right arrow position based on gutter settings
267
- // var percentage_right = 3 + carouselSettings.gutters;
268
- // $.each($(buttons), function(index, button) {
269
- //
270
- // if (button.textContent.includes("Next")) {
271
- // $(button).attr('style', 'right: ' + percentage_right + '%');
272
- // }
273
- // });
274
-
275
- // add CSS style for individual top position for all carousels
276
- //
277
- if ($('#{{carousel.id}}_caption')) {
278
- logger.info('\n' + 'adjust top position of arrows on id: {{carousel.id}}');
279
- var buttons = $("#{{carousel.id}} > button");
280
- $.each($(buttons), function(index, button) {
281
- $(button).addClass('slick-arrow-{{carousel.id}}');
282
- });
283
- }
284
-
285
- }); // END on carousel init
286
-
287
- function debounce(callback, timeout = 300) {
288
- let timer;
289
- var buttons = $("#{{carousel.id}} > button");
290
-
291
- $.each($(buttons), function(index, button) {
292
- $(button).addClass('slick-arrow-{{carousel.id}}');
293
- });
294
-
295
- return (...args) => {
296
- clearTimeout(timer);
297
- timer = setTimeout(() => { callback.apply(this, args); }, timeout);
298
- };
299
- }
300
-
301
- // calculate individual arrow positions for all carousels
302
- //
303
- function positionSlickArrows (e) {
304
- var dependencies_met_page_ready = setInterval (function (options) {
305
- var contentState = $('#content').css("display");
306
- var ContentVisible = (contentState == 'block') ? true: false;
307
- var slideImageHeight;
308
-
309
- if ( j1.getState() === 'finished' && ContentVisible ) {
310
- const carousel_type = '{{carousel.type}}';
311
- const $slick = $('.{{carousel.id | replace: '_','-' }}');
312
- const $slides = $slick.find('.slick-slide');
313
- const $currentSlide = $slides.filter((index, slide) => $(slide).hasClass('slick-current'));
314
-
315
- if (carousel_type == 'example') {
316
- slideImageHeight = ($currentSlide.find('{{carousel.style}}').height()/2) - 25;
317
- } else {
318
- slideImageHeight = ($currentSlide.find('img').height()/2) - 25;
319
- }
320
-
321
- logger.info('\n' + 'adjust top arrow position (centered) by ' + slideImageHeight + ' on id: {{carousel.id}}');
322
- $('.slick-arrow-{{carousel.id}}').css('top', slideImageHeight + 'px');
323
- clearInterval(dependencies_met_page_ready);
324
- }
325
- }, 10);
326
- }
327
-
328
- // set individual arrow positions for a carousel
329
- //
330
- $('.{{carousel.id | replace: '_','-' }}').on('init afterChange', positionSlickArrows);
331
-
332
- // setup the carousel
333
- logger.info('\n' + 'carousel is being setup on id: ' + '{{carousel.id}}');
334
- $('.{{carousel.id | replace: '_','-' }}').slick({
335
- accessibility: carouselSettings.accessibility,
336
- adaptiveHeight: carouselSettings.adaptiveHeight,
337
- arrows: carouselSettings.arrows,
338
- autoplay: carouselSettings.autoplay,
339
- autoplaySpeed: carouselSettings.autoplaySpeed,
340
- centerMode: carouselSettings.centerMode,
341
- centerPadding: carouselSettings.centerPadding,
342
- cssEase: carouselSettings.cssEase,
343
- dots: carouselSettings.dots,
344
- dotsClass: carouselSettings.dotsClass,
345
- draggable: carouselSettings.draggable,
346
- easing: carouselSettings.easing,
347
- edgeFriction: carouselSettings.edgeFriction,
348
- fade: carouselSettings.fade,
349
- focusOnSelect: carouselSettings.focusOnSelect,
350
- focusOnChange: carouselSettings.focusOnChange,
351
- infinite: carouselSettings.infinite,
352
- initialSlide: carouselSettings.initialSlide,
353
- lazyLoad: carouselSettings.lazyLoad,
354
- mobileFirst: carouselSettings.mobileFirst,
355
- pauseOnDotsHover: carouselSettings.pauseOnDotsHover,
356
- pauseOnFocus: carouselSettings.pauseOnFocus,
357
- pauseOnHover: carouselSettings.pauseOnHover,
358
- respondTo: carouselSettings.respondTo,
359
- rows: carouselSettings.rows,
360
- rtl: carouselSettings.rtl,
361
- slide: carouselSettings.slide,
362
- slidesPerRow: carouselSettings.slidesPerRow,
363
- slidesToScroll: carouselSettings.slidesToScroll,
364
- slidesToShow: carouselSettings.slidesToShow,
365
- speed: carouselSettings.speed,
366
- swipe: carouselSettings.swipe,
367
- swipeToSlide: carouselSettings.swipeToSlide,
368
- touchMove: carouselSettings.touchMove,
369
- touchThreshold: carouselSettings.touchThreshold,
370
- useCSS: carouselSettings.useCSS,
371
- useTransform: carouselSettings.useTransform,
372
- variableWidth: carouselSettings.variableWidth,
373
- vertical: carouselSettings.vertical,
374
- verticalSwiping: carouselSettings.verticalSwiping,
375
- waitForAnimate: carouselSettings.waitForAnimate,
376
- zIndex: carouselSettings.zIndex,
377
- responsive: carouselResponsiveSettingsOBJ
378
- });
379
-
380
- // NOT issued correctly (disabled for now)
381
- // $(window).resize(debounce(positionSlickArrows, 100));
382
-
383
- clearInterval(load_dependencies['dependencies_met_html_loaded_{{carousel.id}}']);
384
- }
385
- }, 10); // END
386
- {% endif %} {% endfor %} // ENDFOR (all) carousels
387
-
388
- _this.setState('finished');
389
- logger.debug('\n' + 'state: ' + _this.getState());
390
- logger.info('\n' + 'module initialization finished');
391
-
392
- clearInterval(dependencies_met_page_ready);
393
- }
394
- }, 10);
395
-
396
- }, // END init
397
-
398
- // -------------------------------------------------------------------------
399
- // loadcarouselHTML()
400
- // load all Slick carousels (HTML portion) dynanically configured
401
- // and enabled (AJAX) from YAMLdata file
402
- // NOTE: Make sure the placeholder is available in the content page
403
- // eg. using the asciidoc extension mastercarousel::
404
- // -------------------------------------------------------------------------
405
- loadCarouselHTML: function (options, carousel) {
406
- var numcarousels = Object.keys(carousel).length;
407
- var active_carousels = numcarousels;
408
- var xhr_data_path = options.xhr_data_path + '/index.html';
409
- var xhr_container_id;
410
-
411
- // console.debug('number of carousels found: ' + numcarousels);
412
-
413
- _this.setState('load_data');
414
- Object.keys(carousel).forEach(function(key) {
415
- if (carousel[key].enabled) {
416
- xhr_container_id = carousel[key].id + '_parent';
417
-
418
- // console.debug('load HTML data on carousel id: ' + carousel[key].id);
419
- j1.loadHTML({
420
- xhr_container_id: xhr_container_id,
421
- xhr_data_path: xhr_data_path,
422
- xhr_data_element: carousel[key].id
423
- });
424
- } else {
425
- // console.debug('carousel found disabled on id: ' + carousel[key].id);
426
- active_carousels--;
427
- }
428
- });
429
- // console.debug('carousels loaded in page enabled|all: ' + active_carousels + '|' + numcarousels);
430
- _this.setState('data_loaded');
431
- }, // END loadcarouselHTML
432
-
433
- // -------------------------------------------------------------------------
434
- // messageHandler: MessageHandler for J1 CookieConsent module
435
- // Manage messages send from other J1 modules
436
- // -------------------------------------------------------------------------
437
- messageHandler: function (sender, message) {
438
- var json_message = JSON.stringify(message, undefined, 2);
439
-
440
- logText = '\n' + 'received message from ' + sender + ': ' + json_message;
441
- logger.debug(logText);
442
-
443
- // -----------------------------------------------------------------------
444
- // Process commands|actions
445
- // -----------------------------------------------------------------------
446
- if (message.type === 'command' && message.action === 'module_initialized') {
447
- //
448
- // Place handling of command|action here
449
- //
450
- logger.info('\n' + message.text);
451
- }
452
-
453
- //
454
- // Place handling of other command|action here
455
- //
456
-
457
- return true;
458
- }, // END messageHandler
459
-
460
- // -------------------------------------------------------------------------
461
- // setState()
462
- // Sets the current (processing) state of the module
463
- // -------------------------------------------------------------------------
464
- setState: function (stat) {
465
- _this.state = stat;
466
- }, // END setState
467
-
468
- // -------------------------------------------------------------------------
469
- // getState()
470
- // Returns the current (processing) state of the module
471
- // -------------------------------------------------------------------------
472
- getState: function () {
473
- return _this.state;
474
- }, // END getState
475
-
476
- }; // END return
477
- })(j1, window);
478
-
479
- {% endcapture %}
480
- {% if production %}
481
- {{ cache | minifyJS }}
482
- {% else %}
483
- {{ cache | strip_empty_lines }}
484
- {% endif %}
485
- {% assign cache = nil %}
1
+ ---
2
+ regenerate: true
3
+ ---
4
+
5
+ {% capture cache %}
6
+
7
+ {% comment %}
8
+ # -----------------------------------------------------------------------------
9
+ # ~/assets/themes/j1/adapter/js/slick.js
10
+ # Liquid template to create the Template Adapter for J1 Slick
11
+ #
12
+ # Product/Info:
13
+ # http://jekyll.one
14
+ #
15
+ # Copyright (C) 2023, 2024 Juergen Adams
16
+ #
17
+ # J1 Template is licensed under the MIT License.
18
+ # For details, see: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
19
+ # -----------------------------------------------------------------------------
20
+ # Test data:
21
+ # {{ liquid_var | debug }}
22
+ # cookie_options: {{ cookie_options | debug }}
23
+ # -----------------------------------------------------------------------------
24
+ # See: https://github.com/kenwheeler/slick
25
+ # -----------------------------------------------------------------------------
26
+ {% endcomment %}
27
+
28
+ {% comment %} Liquid var initialization
29
+ -------------------------------------------------------------------------------- {% endcomment %}
30
+
31
+ {% comment %} Set config files
32
+ -------------------------------------------------------------------------------- {% endcomment %}
33
+ {% assign environment = site.environment %}
34
+ {% assign blocks = site.data.blocks %}
35
+ {% assign modules = site.data.modules %}
36
+ {% assign template_config = site.data.j1_config %}
37
+
38
+ {% comment %} Set config data
39
+ -------------------------------------------------------------------------------- {% endcomment
40
+ {% assign attic_defaults = modules.defaults.attics.defaults %}
41
+ {% assign attic_settings = modules.attics.settings %}
42
+
43
+ {% assign slick_defaults = modules.defaults.slick.defaults %}
44
+ {% assign slick_settings = modules.slick.settings %}
45
+ {% assign slick_lightbox_defaults = modules.defaults.slick.defaults.lightbox %}
46
+ {% assign slick_lightbox_settings = modules.slick.settings.lightbox %}
47
+
48
+ {% comment %} Set config options
49
+ -------------------------------------------------------------------------------- {% endcomment %}
50
+
51
+ {% comment %} Set variables
52
+ -------------------------------------------------------------------------------- {% endcomment %}
53
+
54
+ {% comment %} Detect prod mode
55
+ -------------------------------------------------------------------------------- {% endcomment %}
56
+ {% assign production = false %}
57
+ {% if environment == 'prod' or environment == 'production' %}
58
+ {% assign production = true %}
59
+ {% endif %}
60
+
61
+ /*
62
+ # -----------------------------------------------------------------------------
63
+ # ~/assets/themes/j1/adapter/js/slick.js
64
+ # JS Adapter for J1 Slick
65
+ #
66
+ # Product/Info:
67
+ # http://jekyll.one
68
+ #
69
+ # Copyright (C) 2023, 2024 Juergen Adams
70
+ #
71
+ # J1 Theme is licensed under MIT License.
72
+ # See: https://github.com/jekyll-one/J1 Theme/blob/master/LICENSE
73
+ # -----------------------------------------------------------------------------
74
+ # Adapter generated: {{site.time}}
75
+ # -----------------------------------------------------------------------------
76
+ */
77
+
78
+ // -----------------------------------------------------------------------------
79
+ // ESLint shimming
80
+ // -----------------------------------------------------------------------------
81
+ /* eslint indent: "off" */
82
+ /* eslint quotes: "off" */
83
+ // -----------------------------------------------------------------------------
84
+ 'use strict';
85
+ j1.adapter.slick = ((j1, window) => {
86
+
87
+ {% comment %} Set global variables
88
+ ------------------------------------------------------------------------------ {% endcomment %}
89
+ var responsiveSettings = [];
90
+ var carouselResponsiveSettings = [];
91
+
92
+ var atticDefaults;
93
+ var atticSettings;
94
+ var atticOptions;
95
+ var slickDefaults;
96
+ var slickSettings;
97
+ var slickLightboxDefaults;
98
+ var slickLightboxSettings;
99
+ var slickLightboxOptions;
100
+ var slickOptions;
101
+ var carouselOptions;
102
+ var carouselSettings;
103
+
104
+ var slideImageHeight;
105
+
106
+ var _this;
107
+ var logger;
108
+ var logText;
109
+
110
+ // date|time
111
+ var startTime;
112
+ var endTime;
113
+ var startTimeModule;
114
+ var endTimeModule;
115
+ var timeSeconds;
116
+
117
+ // ---------------------------------------------------------------------------
118
+ // helper functions
119
+ // ---------------------------------------------------------------------------
120
+
121
+ // ---------------------------------------------------------------------------
122
+ // main
123
+ // ---------------------------------------------------------------------------
124
+ return {
125
+
126
+ // -------------------------------------------------------------------------
127
+ // adapter initializer
128
+ // -------------------------------------------------------------------------
129
+ init: (options) => {
130
+ var xhrLoadState = 'pending'; // (initial) load state for the HTML portion of the carousel
131
+ var load_dependencies = {}; // dynamic variable
132
+ var carouselResponsiveSettingsOBJ = {}; // initial object for responsive settings
133
+ var reload_on_resize = false;
134
+ var dependency;
135
+ var carouselResponsiveSettingsYAML;
136
+ var carouselResponsiveSettingsSTRING;
137
+ var slick_lightbox_enabled;
138
+
139
+ // -----------------------------------------------------------------------
140
+ // default module settings
141
+ // -----------------------------------------------------------------------
142
+ var settings = $.extend({
143
+ module_name: 'j1.adapter.cookieConsent',
144
+ generated: '{{site.time}}'
145
+ }, options);
146
+
147
+ // Load module DEFAULTS|CONFIG
148
+ atticDefaults = $.extend({}, {{attic_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
149
+ atticSettings = $.extend({}, {{attic_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
150
+ atticOptions = $.extend(true, {}, atticDefaults, atticSettings);
151
+
152
+ slickDefaults = $.extend({}, {{slick_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
153
+ slickSettings = $.extend({}, {{slick_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
154
+ slickLightboxDefaults = $.extend({}, {{slick_lightbox_defaults | replace: 'nil', 'null' | replace: '=>', ':' }});
155
+ slickLightboxSettings = $.extend({}, {{slick_lightbox_settings | replace: 'nil', 'null' | replace: '=>', ':' }});
156
+ slickLightboxOptions = $.extend(true, {}, slickLightboxDefaults, slickLightboxSettings);
157
+ slickOptions = $.extend(true, {}, slickDefaults, slickSettings);
158
+
159
+ // -----------------------------------------------------------------------
160
+ // global variable settings
161
+ // -----------------------------------------------------------------------
162
+ _this = j1.adapter.slick;
163
+ logger = log4javascript.getLogger('j1.adapter.slick');
164
+
165
+ // load HTML portion for all carousels
166
+ _this.loadCarouselHTML(slickOptions, slickOptions.carousels);
167
+
168
+ // re-Init all carousels in a page if window is resized (if enabled)
169
+ if (reload_on_resize) {
170
+ window.onresize = () => {
171
+ location.reload();
172
+ }
173
+ }
174
+
175
+ // -----------------------------------------------------------------------
176
+ // module initializer
177
+ // -----------------------------------------------------------------------
178
+ var dependencies_met_page_ready = setInterval (() => {
179
+ var pageState = $('#content').css("display");
180
+ var pageVisible = (pageState == 'block') ? true : false;
181
+ var j1CoreFinished = (j1.getState() == 'finished') ? true : false;
182
+ var atticFinished = (j1.adapter.attic.getState() == 'finished') ? true : false;
183
+
184
+ if (j1CoreFinished && pageVisible && atticFinished) {
185
+ startTimeModule = Date.now();
186
+
187
+ _this.setState('started');
188
+ logger.debug('\n' + 'set module state to: ' + _this.getState());
189
+ logger.info('\n' + 'initializing module: started');
190
+
191
+ {% for carousel in slick_settings.carousels %} {% if carousel.enabled %}
192
+ logger.info ('\n' + 'initialize carousel on id: ' + '{{carousel.id}}');
193
+
194
+ {% if carousel.options.responsive %}
195
+ logger.debug ('\n' + 'collect responsive settings for carousel on id: ' + '{{carousel.id}}');
196
+ // collect breakpoint settings from carousel config
197
+ responsiveSettings = $.extend({}, {{carousel.responsive | replace: 'nil', 'null' | replace: '=>', ':' }});
198
+ // generate carousel breakpoint settings as YAML data structure
199
+ carouselResponsiveSettings = '[' ;
200
+ for (const [obj_key, obj_value] of Object.entries(responsiveSettings)) {
201
+ var length = Object.keys(obj_value.settings).length;
202
+ var count = 0;
203
+ for (const [key, value] of Object.entries(obj_value.settings)) {
204
+ count++;
205
+ if (key == 'breakOn' && count == 1) {
206
+ carouselResponsiveSettings += ' {' ;
207
+ carouselResponsiveSettings += ' breakpoint: ' + value + ',' ;
208
+ carouselResponsiveSettings += ' settings: {' ;
209
+ } else {
210
+ carouselResponsiveSettings += ' ' + key + ': ' + value + ',' ;
211
+ }
212
+ // close current breakpoint element
213
+ if (count == length) {
214
+ carouselResponsiveSettings += ' }' ;
215
+ carouselResponsiveSettings += ' },' ;
216
+ }
217
+ }
218
+ } // End generate breakpoint YAML elements
219
+
220
+ // close breakpoint YAML data
221
+ carouselResponsiveSettings += ']';
222
+ {% endif %}
223
+
224
+ // create dynamic loader variable|s
225
+ dependency = 'dependencies_met_html_loaded_{{carousel.id}}';
226
+ load_dependencies[dependency] = '';
227
+
228
+ // initialize carousel if HTML portion successfully loaded
229
+ load_dependencies['dependencies_met_html_loaded_{{carousel.id}}'] = setInterval (() => {
230
+ // check if HTML portion of the carousel is loaded successfully (loadcarouselHTML)
231
+ xhrLoadState = j1.xhrDOMState['#{{carousel.id}}_parent'];
232
+ if (xhrLoadState === 'success') {
233
+
234
+ // collect general carousel settings
235
+ carouselOptions = $.extend({}, {{carousel.options | replace: 'nil', 'null' | replace: '=>', ':' }});
236
+ carouselSettings = $.extend(true, {}, slickDefaults, carouselOptions );
237
+
238
+ // convert carousel responsive settings to object (carouselResponsiveSettingsOBJ)
239
+ carouselResponsiveSettingsYAML = yaml.loadAll(carouselResponsiveSettings, 'utf8');
240
+ carouselResponsiveSettingsOBJ = carouselResponsiveSettingsYAML[0];
241
+ carouselResponsiveSettingsSTRING = JSON.stringify(carouselResponsiveSettingsOBJ, null, 4);
242
+ logger.debug('\n' + 'responsive settings on carousel id #{{carousel.id}}: ' + '\n' + carouselResponsiveSettingsSTRING);
243
+
244
+ $('.{{carousel.id | replace: '_','-' }}').on('init', function (event, slick) {
245
+ logger.debug('\n' + 'carousel initialized on id: {{carousel.id}}');
246
+
247
+ slick_lightbox_enabled = '{{carousel.lightbox.enabled}}';
248
+
249
+ // check if a lightbox is used|enabled
250
+ if ( slick_lightbox_enabled !== '' && slick_lightbox_enabled == 'true' ) {
251
+ slick_lightbox_enabled = true;
252
+ } else {
253
+ slick_lightbox_enabled = false;
254
+ }
255
+
256
+ if (slick_lightbox_enabled) {
257
+ logger.debug('\n' + 'initialize lightbox on id: {{carousel.id}}');
258
+
259
+ // See: http://mreq.github.io/slick-lightbox/demo/
260
+ $('#{{carousel.id}}').slickLightbox ({
261
+ caption: slickLightboxOptions.caption,
262
+ useHistoryApi: slickLightboxOptions.useHistoryApi,
263
+ background: slickLightboxOptions.background,
264
+ closeOnEscape: slickLightboxOptions.closeOnEscape,
265
+ closeOnBackdropClick: slickLightboxOptions.closeOnBackdropClick,
266
+ navigateByKeyboard: slickLightboxOptions.navigateByKeyboard,
267
+ destroyTimeout: slickLightboxOptions.destroyTimeout,
268
+ imageMaxHeight: slickLightboxOptions.imageMaxHeight,
269
+ lazy: slickLightboxOptions.lazy,
270
+ });
271
+ } // END carousel lightbox enabled
272
+
273
+ logger.debug ('\n' + 'adjust positions of slick lightbox arrows on id: {{carousel.id}}');
274
+ var buttons = $("#{{carousel.id}} > button");
275
+ var arrowTopPos = Math.round (document.documentElement.clientHeight/2)
276
+
277
+ // add CSS style for individual top position for all carousels
278
+ if ($('#{{carousel.id}}_caption')) {
279
+ logger.debug ('\n' + 'adjust top position of arrows on id: {{carousel.id}}');
280
+ var buttons = $("#{{carousel.id}} > button");
281
+ $.each ($(buttons), function (index, button) {
282
+ $(button).addClass ('slick-arrow-{{carousel.id}}');
283
+ });
284
+ }
285
+ }); // END on carousel init
286
+
287
+ function debounce(callback, timeout = 300) {
288
+ let timer;
289
+ var buttons = $("#{{carousel.id}} > button");
290
+
291
+ $.each ($(buttons), (index, button) => {
292
+ $(button).addClass ('slick-arrow-{{carousel.id}}');
293
+ });
294
+
295
+ return (...args) => {
296
+ clearTimeout (timer);
297
+ timer = setTimeout (() => { callback.apply(this, args); }, timeout);
298
+ };
299
+ }
300
+
301
+ // calculate individual arrow positions for all carousels
302
+ function positionSlickArrows (e) {
303
+ var dependencies_met_page_ready = setInterval (() => {
304
+ var pageState = $('#content').css("display");
305
+ var pageVisible = (pageState === 'block') ? true : false;
306
+ var j1CoreFinished = (j1.getState() === 'finished') ? true : false;
307
+
308
+ if (j1CoreFinished && pageVisible) {
309
+ const carousel_type = '{{carousel.type}}';
310
+ const $slick = $('.{{carousel.id | replace: '_','-' }}');
311
+ const $slides = $slick.find('.slick-slide');
312
+ const $currentSlide = $slides.filter ((index, slide) => $(slide).hasClass ('slick-current'));
313
+
314
+ if (carousel_type === 'example') {
315
+ slideImageHeight = ($currentSlide.find ('{{carousel.style}}').height()/2) - 25;
316
+ } else {
317
+ slideImageHeight = ($currentSlide.find ('img').height()/2) - 25;
318
+ }
319
+
320
+ logger.debug ('\n' + 'adjust top arrow position (centered) by ' + slideImageHeight + ' on id: {{carousel.id}}');
321
+ $('.slick-arrow-{{carousel.id}}').css ('top', slideImageHeight + 'px');
322
+ clearInterval (dependencies_met_page_ready);
323
+ }
324
+ }, 10);
325
+ }
326
+
327
+ // set individual arrow positions for a carousel
328
+ $('.{{carousel.id | replace: '_','-' }}').on('init afterChange', positionSlickArrows);
329
+
330
+ // setup the carousel
331
+ logger.debug ('\n' + 'carousel is being setup on id: ' + '{{carousel.id}}');
332
+ $('.{{carousel.id | replace: '_','-' }}').slick ({
333
+ accessibility: carouselSettings.accessibility,
334
+ adaptiveHeight: carouselSettings.adaptiveHeight,
335
+ arrows: carouselSettings.arrows,
336
+ autoplay: carouselSettings.autoplay,
337
+ autoplaySpeed: carouselSettings.autoplaySpeed,
338
+ centerMode: carouselSettings.centerMode,
339
+ centerPadding: carouselSettings.centerPadding,
340
+ cssEase: carouselSettings.cssEase,
341
+ dots: carouselSettings.dots,
342
+ dotsClass: carouselSettings.dotsClass,
343
+ draggable: carouselSettings.draggable,
344
+ easing: carouselSettings.easing,
345
+ edgeFriction: carouselSettings.edgeFriction,
346
+ fade: carouselSettings.fade,
347
+ focusOnSelect: carouselSettings.focusOnSelect,
348
+ focusOnChange: carouselSettings.focusOnChange,
349
+ infinite: carouselSettings.infinite,
350
+ initialSlide: carouselSettings.initialSlide,
351
+ lazyLoad: carouselSettings.lazyLoad,
352
+ mobileFirst: carouselSettings.mobileFirst,
353
+ pauseOnDotsHover: carouselSettings.pauseOnDotsHover,
354
+ pauseOnFocus: carouselSettings.pauseOnFocus,
355
+ pauseOnHover: carouselSettings.pauseOnHover,
356
+ respondTo: carouselSettings.respondTo,
357
+ rows: carouselSettings.rows,
358
+ rtl: carouselSettings.rtl,
359
+ slide: carouselSettings.slide,
360
+ slidesPerRow: carouselSettings.slidesPerRow,
361
+ slidesToScroll: carouselSettings.slidesToScroll,
362
+ slidesToShow: carouselSettings.slidesToShow,
363
+ speed: carouselSettings.speed,
364
+ swipe: carouselSettings.swipe,
365
+ swipeToSlide: carouselSettings.swipeToSlide,
366
+ touchMove: carouselSettings.touchMove,
367
+ touchThreshold: carouselSettings.touchThreshold,
368
+ useCSS: carouselSettings.useCSS,
369
+ useTransform: carouselSettings.useTransform,
370
+ variableWidth: carouselSettings.variableWidth,
371
+ vertical: carouselSettings.vertical,
372
+ verticalSwiping: carouselSettings.verticalSwiping,
373
+ waitForAnimate: carouselSettings.waitForAnimate,
374
+ zIndex: carouselSettings.zIndex,
375
+ responsive: carouselResponsiveSettingsOBJ
376
+ });
377
+
378
+ // NOT issued correctly (disabled for now)
379
+ // $(window).resize(debounce(positionSlickArrows, 100));
380
+
381
+ clearInterval (load_dependencies['dependencies_met_html_loaded_{{carousel.id}}']);
382
+ } // END if xhrLoadState success
383
+ }, 10); // END dependencies_met_html_loaded carousel.id
384
+ {% endif %} {% endfor %} // ENDFOR (all) carousels
385
+
386
+ _this.setState ('finished');
387
+ logger.debug ('\n' + 'state: ' + _this.getState());
388
+ logger.info ('\n' + 'module initialization finished');
389
+
390
+ endTimeModule = Date.now();
391
+ logger.info('\n' + 'module initializing time: ' + (endTimeModule-startTimeModule) + 'ms');
392
+
393
+ clearInterval (dependencies_met_page_ready);
394
+ } // END if pageVisible
395
+ }, 10); // END dependency_met_page_ready
396
+ }, // END init
397
+
398
+ // -------------------------------------------------------------------------
399
+ // loadcarouselHTML()
400
+ // load all Slick carousels (HTML portion) dynanically configured
401
+ // and enabled (AJAX) from YAMLdata file
402
+ // NOTE: Make sure the placeholder is available in the content page
403
+ // eg. using the asciidoc extension mastercarousel::
404
+ // -------------------------------------------------------------------------
405
+ loadCarouselHTML: (options, carousel) => {
406
+ var numcarousels = Object.keys(carousel).length;
407
+ var active_carousels = numcarousels;
408
+ var xhr_data_path = options.xhr_data_path + '/index.html';
409
+ var xhr_container_id;
410
+
411
+ // console.debug('number of carousels found: ' + numcarousels);
412
+
413
+ _this.setState('load_data');
414
+ Object.keys(carousel).forEach ((key) => {
415
+ if (carousel[key].enabled) {
416
+ xhr_container_id = carousel[key].id + '_parent';
417
+
418
+ // console.debug('load HTML data on carousel id: ' + carousel[key].id);
419
+ j1.loadHTML({
420
+ xhr_container_id: xhr_container_id,
421
+ xhr_data_path: xhr_data_path,
422
+ xhr_data_element: carousel[key].id
423
+ });
424
+ } else {
425
+ // console.debug('carousel found disabled on id: ' + carousel[key].id);
426
+ active_carousels--;
427
+ }
428
+ });
429
+ // console.debug('carousels loaded in page enabled|all: ' + active_carousels + '|' + numcarousels);
430
+ _this.setState('data_loaded');
431
+ }, // END loadcarouselHTML
432
+
433
+ // -------------------------------------------------------------------------
434
+ // messageHandler()
435
+ // manage messages send from other J1 modules
436
+ // -------------------------------------------------------------------------
437
+ messageHandler: (sender, message) => {
438
+ var json_message = JSON.stringify(message, undefined, 2);
439
+
440
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
441
+ logger.debug(logText);
442
+
443
+ // -----------------------------------------------------------------------
444
+ // process commands|actions
445
+ // -----------------------------------------------------------------------
446
+ if (message.type === 'command' && message.action === 'module_initialized') {
447
+
448
+ //
449
+ // place handling of command|action here
450
+ //
451
+
452
+ logger.info('\n' + message.text);
453
+ }
454
+
455
+ //
456
+ // place handling of other command|action here
457
+ //
458
+
459
+ return true;
460
+ }, // END messageHandler
461
+
462
+ // -------------------------------------------------------------------------
463
+ // setState()
464
+ // sets the current (processing) state of the module
465
+ // -------------------------------------------------------------------------
466
+ setState: (stat) => {
467
+ _this.state = stat;
468
+ }, // END setState
469
+
470
+ // -------------------------------------------------------------------------
471
+ // getState()
472
+ // Returns the current (processing) state of the module
473
+ // -------------------------------------------------------------------------
474
+ getState: () => {
475
+ return _this.state;
476
+ } // END getState
477
+
478
+ }; // END main (return)
479
+ })(j1, window);
480
+
481
+ {% endcapture %}
482
+ {% if production %}
483
+ {{ cache | minifyJS }}
484
+ {% else %}
485
+ {{ cache | strip_empty_lines }}
486
+ {% endif %}
487
+ {% assign cache = nil %}