j1-template 2024.2.0 → 2024.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/data/gemini-ui.html +2 -2
- data/assets/themes/j1/adapter/js/advertising.js +2 -10
- data/assets/themes/j1/adapter/js/analytics.js +1 -5
- data/assets/themes/j1/adapter/js/bmd.js +195 -195
- data/assets/themes/j1/adapter/js/carousel.js +786 -786
- data/assets/themes/j1/adapter/js/clipboard.js +1 -0
- data/assets/themes/j1/adapter/js/comments.js +1 -0
- data/assets/themes/j1/adapter/js/cookieConsent.js +460 -466
- data/assets/themes/j1/adapter/js/customModule.js +5 -4
- data/assets/themes/j1/adapter/js/docsearch.js +1 -0
- data/assets/themes/j1/adapter/js/dropdowns.js +1 -0
- data/assets/themes/j1/adapter/js/fab.js +1 -0
- data/assets/themes/j1/adapter/js/gallery.js +495 -494
- data/assets/themes/j1/adapter/js/gemini.js +154 -128
- data/assets/themes/j1/adapter/js/iconPicker.js +257 -255
- data/assets/themes/j1/adapter/js/iconPickerPage.js +279 -279
- data/assets/themes/j1/adapter/js/iframer.js +3 -2
- data/assets/themes/j1/adapter/js/j1.js +3285 -3285
- data/assets/themes/j1/adapter/js/lazyLoader.js +241 -241
- data/assets/themes/j1/adapter/js/lightbox.js +242 -241
- data/assets/themes/j1/adapter/js/logger.js +1 -0
- data/assets/themes/j1/adapter/js/lunr.js +6 -10
- data/assets/themes/j1/adapter/js/masonry.js +427 -426
- data/assets/themes/j1/adapter/js/masterslider.js +526 -526
- data/assets/themes/j1/adapter/js/mmenu.js +1 -0
- data/assets/themes/j1/adapter/js/navigator.js +2 -2
- data/assets/themes/j1/adapter/js/particles.js +1 -0
- data/assets/themes/j1/adapter/js/rangeSlider.js +1 -0
- data/assets/themes/j1/adapter/js/rouge.js +288 -287
- data/assets/themes/j1/adapter/js/rtable.js +309 -309
- data/assets/themes/j1/adapter/js/slick.js +487 -487
- data/assets/themes/j1/adapter/js/slimSelect.js +3 -5
- data/assets/themes/j1/adapter/js/themeToggler.js +281 -280
- data/assets/themes/j1/adapter/js/themes.js +0 -1
- data/assets/themes/j1/adapter/js/toccer.js +1 -0
- data/assets/themes/j1/adapter/js/translator.js +1 -0
- data/assets/themes/j1/adapter/js/waves.js +1 -0
- data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +23 -17
- data/assets/themes/j1/modules/js-cookies/js/js.cookie.js +147 -0
- data/assets/themes/j1/modules/js-cookies/js/js.cookie.min.js +2 -0
- data/lib/j1/version.rb +1 -1
- data/lib/starter_web/README.md +5 -5
- data/lib/starter_web/_config.yml +1 -1
- data/lib/starter_web/_data/modules/defaults/themes.yml +171 -171
- data/lib/starter_web/_data/resources.yml +26 -0
- data/lib/starter_web/_data/templates/feed.xml +1 -1
- data/lib/starter_web/_plugins/index/lunr.rb +1 -1
- data/lib/starter_web/package.json +1 -1
- data/lib/starter_web/pages/public/learn/roundtrip/present_images.adoc +500 -500
- metadata +4 -2
@@ -1,487 +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 = ((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 %}
|
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 %}
|