j1-template 2021.1.2 → 2021.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/layout_metadata_generator.html +23 -9
  3. data/_includes/themes/j1/modules/connectors/ad/google-adsense.html +7 -15
  4. data/_includes/themes/j1/modules/connectors/analytic/google-analytics.html +9 -5
  5. data/_includes/themes/j1/modules/navigator/generator.html +2 -2
  6. data/_includes/themes/j1/modules/navigator/procedures/topsearch.proc +2 -2
  7. data/_includes/themes/j1/procedures/posts/collate_timeline.proc +8 -7
  8. data/_layouts/default.html +4 -7
  9. data/assets/data/authclient.html +231 -229
  10. data/assets/data/banner.html +30 -32
  11. data/assets/data/cookieconsent.html +249 -0
  12. data/assets/data/fam.html +1 -1
  13. data/assets/data/footer.html +1 -1
  14. data/assets/data/gallery_customizer.html +10 -5
  15. data/assets/data/menu.html +3 -3
  16. data/assets/data/mmenu.html +4 -3
  17. data/assets/data/mmenu_sidebar.html +1 -1
  18. data/assets/data/mmenu_toc.html +1 -1
  19. data/assets/data/panel.html +11 -10
  20. data/assets/data/quicklinks.html +20 -18
  21. data/assets/data/themes.json +6 -6
  22. data/assets/themes/j1/adapter/js/{cookiebar.js → cookieConsent.js} +129 -55
  23. data/assets/themes/j1/adapter/js/j1.js +160 -151
  24. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +3 -2
  25. data/assets/themes/j1/adapter/js/mmenu.js +8 -4
  26. data/assets/themes/j1/adapter/js/navigator.1.js +896 -0
  27. data/assets/themes/j1/adapter/js/navigator.2.js +928 -0
  28. data/assets/themes/j1/adapter/js/navigator.js +176 -209
  29. data/assets/themes/j1/adapter/js/themer.1.js +326 -0
  30. data/assets/themes/j1/adapter/js/themer.js +41 -57
  31. data/assets/themes/j1/adapter/js/toccer.js +4 -45
  32. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.css +17 -14
  33. data/assets/themes/j1/core/css/themes/uno-dark/bootstrap.min.css +1 -1
  34. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.css +3859 -187
  35. data/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css +1 -1
  36. data/assets/themes/j1/core/js/template.js +3 -9
  37. data/assets/themes/j1/core/js/template.js.map +1 -1
  38. data/assets/themes/j1/core/js/template.min.js +3 -9
  39. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  40. data/assets/themes/j1/modules/cookieConsent/LICENSE +21 -0
  41. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +286 -0
  42. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +28 -0
  43. data/assets/themes/j1/modules/fam/css/{uno → theme/uno}/fam.css +0 -0
  44. data/assets/themes/j1/modules/fam/css/theme/uno/fam.min.css +15 -0
  45. data/assets/themes/j1/modules/fam/js/fam.js +1 -6
  46. data/assets/themes/j1/modules/iframeResizer/examples/frame.absolute.html +4 -2
  47. data/assets/themes/j1/modules/iframeResizer/examples/frame.content.html +4 -3
  48. data/assets/themes/j1/modules/iframeResizer/examples/frame.hover.html +4 -2
  49. data/assets/themes/j1/modules/iframeResizer/examples/frame.nested.html +4 -2
  50. data/assets/themes/j1/modules/iframeResizer/examples/frame.textarea.html +4 -2
  51. data/assets/themes/j1/modules/iframeResizer/examples/frame.tolerance.html +4 -2
  52. data/assets/themes/j1/modules/iframeResizer/examples/index.html +2 -0
  53. data/assets/themes/j1/modules/iframeResizer/examples/two.html +4 -2
  54. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.css → mmenu-light.css} +0 -0
  55. data/assets/themes/j1/modules/mmenuLight/css/{mmenu.min.css → mmenu-light.min.css} +0 -0
  56. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.css → uno/mmenu.css} +0 -0
  57. data/assets/themes/j1/modules/mmenuLight/css/theme/{uno.min.css → uno/mmenu.min.css} +0 -0
  58. data/assets/themes/j1/modules/rtable/css/theme/{uno.css → uno/rtable.css} +0 -0
  59. data/assets/themes/j1/modules/rtable/css/theme/{uno.min.css → uno/rtable.min.css} +0 -0
  60. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +33 -47
  61. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +410 -2
  62. data/assets/themes/j1/modules/util/js/domready.js +146 -0
  63. data/assets/themes/j1/modules/util/js/gtag-opt-in.js +1 -0
  64. data/lib/j1/version.rb +1 -1
  65. data/lib/j1_app/j1_auth_manager/auth_manager.rb +2 -3
  66. data/lib/starter_web/Gemfile +1 -1
  67. data/lib/starter_web/_config.yml +6 -5
  68. data/lib/starter_web/_data/_defaults/resources.yml +11 -8
  69. data/lib/starter_web/_data/apps/defaults/justifiedGalleryCustomizer.yml +1 -0
  70. data/lib/starter_web/_data/blocks/banner.yml +5 -3
  71. data/lib/starter_web/_data/blocks/panel.yml +9 -7
  72. data/lib/starter_web/_data/builder/blog_navigator.yml +1 -0
  73. data/lib/starter_web/_data/j1_config.yml +20 -17
  74. data/lib/starter_web/_data/layouts/default.yml +1 -1
  75. data/lib/starter_web/_data/layouts/home.yml +6 -5
  76. data/lib/starter_web/_data/layouts/page.yml +1 -1
  77. data/lib/starter_web/_data/modules/{cookiebar.yml → cookieconsent.yml} +4 -4
  78. data/lib/starter_web/_data/modules/defaults/authentication.yml +1 -0
  79. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +135 -0
  80. data/lib/starter_web/_data/modules/defaults/navigator.yml +5 -2
  81. data/lib/starter_web/_data/modules/defaults/themer.yml +2 -1
  82. data/lib/starter_web/_data/modules/navigator.yml +24 -21
  83. data/lib/starter_web/_data/pages/builder.yml +7 -7
  84. data/lib/starter_web/_data/private.default.yml +119 -0
  85. data/lib/starter_web/_data/private.yml +6 -6
  86. data/lib/starter_web/_data/resources.yml +15 -14
  87. data/lib/starter_web/_includes/attributes.asciidoc +10 -1
  88. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  89. data/lib/starter_web/assets/images/modules/attics/{cookies-1920x1200-bw.jpg → cookies-1920x1200.jpg} +0 -0
  90. data/lib/starter_web/assets/images/modules/attics/lianhao-1920x1280.jpg +0 -0
  91. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +3 -3
  92. data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +4 -4
  93. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-01-site-generators.adoc +1 -7
  94. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +2 -7
  95. data/lib/starter_web/dot.gitignore +1 -1
  96. data/lib/starter_web/index.html +1 -1
  97. data/lib/starter_web/package.json +1 -1
  98. data/lib/starter_web/pages/public/blog/navigator/archive.html +4 -3
  99. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +14 -8
  100. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +11 -8
  101. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +6 -5
  102. data/lib/starter_web/pages/public/cookieConsent.adoc +93 -0
  103. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +2 -1
  104. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +104 -209
  105. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +6 -1
  106. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  107. data/lib/starter_web/utilsrv/package.json +1 -1
  108. metadata +26 -15
  109. data/_includes/themes/j1/modules/navigator/generator.org.html +0 -232
  110. data/assets/data/cookiebar.html +0 -285
  111. data/lib/starter_web/_data/modules/defaults/cookiebar.yml +0 -132
@@ -23,7 +23,7 @@ regenerate: true
23
23
  {% endcomment %}
24
24
 
25
25
  {% comment %} Liquid procedures
26
- -------------------------------------------------------------------------------- {% endcomment %}
26
+ ------------------------------------------------------------------------------- {% endcomment %}
27
27
 
28
28
  {% comment %} Set global settings
29
29
  -------------------------------------------------------------------------------- {% endcomment %}
@@ -93,7 +93,6 @@ regenerate: true
93
93
  # For details, see https://jekyll.one
94
94
  # -----------------------------------------------------------------------------
95
95
  # TODO:
96
- # MANAGE themeExtensionCss is to be checked
97
96
  #
98
97
  # -----------------------------------------------------------------------------
99
98
  # Adapter generated: {{site.time}}
@@ -114,14 +113,14 @@ var j1 = (function () {
114
113
  // ---------------------------------------------------------------------------
115
114
  // globals
116
115
  // ---------------------------------------------------------------------------
117
- var rePager = new RegExp('navigator|dateview|tagview|archive');
118
- var environment = '{{environment}}';
119
- var moduleOptions = {};
120
- var j1_runtime_data = {};
116
+ var rePager = new RegExp('navigator|dateview|tagview|archive');
117
+ var environment = '{{environment}}';
118
+ var moduleOptions = {};
119
+ var j1_runtime_data = {};
121
120
 
122
121
  // Status information
123
- var state = 'not_started';
124
- var mode = 'not_detected';
122
+ var state = 'not_started';
123
+ var mode = 'not_detected';
125
124
 
126
125
  var current_user_data;
127
126
  var current_page;
@@ -131,15 +130,17 @@ var j1 = (function () {
131
130
  var app_detected;
132
131
  var user_session_detected;
133
132
 
134
- // Connector settings
135
- var translation_enabled = {{template_config.translation.enabled}};
133
+ // Translatior settings (currently NOT supported)
134
+ // var translation_enabled = {{template_config.translation.enabled}};
136
135
 
137
136
  // Theme information
138
137
  var themeName;
139
138
  var themeCss;
140
- var themeExtensionCss = environment === 'production' ? '/assets/themes/j1/core/css/themes/theme-extensions.min.css' : '/assets/themes/j1/core/css/themes/theme-extensions.css';
139
+ var cssExtension = (environment === 'production')
140
+ ? '.min.css'
141
+ : '.css';
141
142
 
142
- // Pathes of J1 data files
143
+ // Pathes of J1 data files
143
144
  var colors_data_path = '{{template_config.colors_data_path}}';
144
145
  var font_size_data_path = '{{template_config.font_size_data_path}}';
145
146
  var runtime_data_path = '{{template_config.runtime_data_path}}';
@@ -156,18 +157,11 @@ var j1 = (function () {
156
157
  var baseUrl;
157
158
  var referrer;
158
159
 
159
- // var default_theme_css = environment === 'production' ? '/assets/themes/j1/core/css/themes/uno-light/bootstrap.min.css' : '/assets/themes/j1/core/css/themes/uno-light/bootstrap.css';
160
- // // TODO: check what property is used default_theme|default_theme_name ?
161
- // var default_theme_display_name = 'Uno (light)';
162
- // var default_theme_name = 'uno-light';
163
- // var default_theme_author = 'J1 Team';
164
- // var default_theme_link = 'https://jekyll.one/';
165
- var default_white_listed_pages = [];
166
-
167
160
  var cookie_names = {
168
161
  'app_session': '{{template_config.cookies.app_session}}',
169
162
  'user_session': '{{template_config.cookies.user_session}}',
170
- 'user_state': '{{template_config.cookies.user_state}}'
163
+ 'user_state': '{{template_config.cookies.user_state}}',
164
+ 'user_consent': '{{template_config.cookies.user_consent}}'
171
165
  };
172
166
 
173
167
  // user SESSION cookie (initial values)
@@ -189,29 +183,24 @@ var j1 = (function () {
189
183
  'last_pager': '/pages/public/blog/navigator/'
190
184
  };
191
185
 
192
- // user STATE cookie (initial values)
193
186
  var user_state = {
194
- 'theme_css': "",
195
- 'theme_name': "",
196
- 'theme_author': "",
187
+ 'theme_css': '',
188
+ 'theme_name': '',
189
+ 'theme_author': '',
197
190
  'theme_version': '{{site.version}}',
198
- 'cookies_accepted': 'pending',
199
- 'whitelistedPages': default_white_listed_pages,
200
- 'deleteOnDecline': false,
201
- 'showConsentOnPending': false,
202
- 'stopScrolling': true,
203
191
  'session_active': false,
204
- 'last_session_ts': '',
205
- 'cc_authenticated': false
192
+ 'last_session_ts': ''
206
193
  };
207
194
 
195
+ var user_consent;
196
+
208
197
  // ---------------------------------------------------------------------------
209
198
  // helper functions
210
199
  // ---------------------------------------------------------------------------
211
200
 
201
+ // See: https://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string
202
+ //
212
203
  function executeFunctionByName(functionName, context /*, args */) {
213
- // See: https://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string
214
- //
215
204
  var args = Array.prototype.slice.call(arguments, 2);
216
205
  var namespaces = functionName.split('.');
217
206
  var func = namespaces.pop();
@@ -228,7 +217,6 @@ var j1 = (function () {
228
217
 
229
218
  // -------------------------------------------------------------------------
230
219
  // init()
231
- // initializer
232
220
  // -------------------------------------------------------------------------
233
221
  init: function (options) {
234
222
 
@@ -238,15 +226,9 @@ var j1 = (function () {
238
226
  var logger = log4javascript.getLogger('j1.init');
239
227
  var url = new liteURL(window.location.href);
240
228
  var baseUrl = url.origin;
241
- // moment not used anymore
242
- // var epoch = Math.floor(Date.now()/1000);
243
- // var timestamp_now = moment.unix(epoch).format('YYYY-MM-DD HH:mm:ss');
244
229
  var date = new Date();
245
230
  var timestamp_now = date.toISOString();
246
231
  var curr_state = 'started';
247
- // var date = new Date();
248
- // var my_timestamp = date.toISOString();
249
-
250
232
 
251
233
  // -----------------------------------------------------------------------
252
234
  // options loader
@@ -267,51 +249,58 @@ var j1 = (function () {
267
249
  j1['xhrDOMState'] = {};
268
250
 
269
251
  // -----------------------------------------------------------------------
270
- // session ON_CLOSE event
271
- // wrapup if ALL browser windows get closed. Update user STATE
272
- // cookie on window CLOSE.
252
+ // update cookies if browser window get closed
273
253
  // see: https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing
274
254
  // -----------------------------------------------------------------------
275
255
  window.addEventListener('beforeunload', function (event) {
276
256
  var cookie_names = j1.getCookieNames();
277
- var cookie_user_state_name = cookie_names.user_state;
278
- var cookie_user_session_name = cookie_names.user_session;
279
- // moment not used anymore
280
- // var epoch = Math.floor(Date.now()/1000);
281
- // var timestamp_now = moment.unix(epoch).format('YYYY-MM-DD HH:mm:ss');
282
257
  var date = new Date();
283
258
  var timestamp_now = date.toISOString();
284
- var user_state = j1.readCookie(cookie_user_state_name);
259
+ var user_state = j1.readCookie(cookie_names.user_state);
260
+ var user_consent = j1.readCookie(cookie_names.user_consent);
285
261
  var ep_status;
286
262
  var url;
287
263
  var baseUrl;
288
264
 
289
- // update cookie only, if (already) exists
290
- //
291
- if (user_state) {
292
- user_state.session_active = false;
293
- user_state.last_session_ts = timestamp_now;
265
+ user_state.session_active = false;
266
+ user_state.last_session_ts = timestamp_now;
294
267
 
268
+ if (!user_consent.analyses || !user_consent.personalization) {
269
+ // expire consent|state cookies to session
270
+ j1.writeCookie({
271
+ name: cookie_names.user_consent,
272
+ data: user_state,
273
+ samesite: 'Strict'
274
+ });
295
275
  j1.writeCookie({
296
- name: cookie_user_state_name,
297
- data: user_state,
298
- expires: 365
276
+ name: cookie_names.user_state,
277
+ data: user_state,
278
+ samesite: 'Strict'
279
+ });
280
+ } else {
281
+ j1.writeCookie({
282
+ name: cookie_names.user_state,
283
+ data: user_state,
284
+ samesite: 'Strict',
285
+ expires: 365
299
286
  });
300
287
  }
301
288
 
302
- });
289
+ }); // END beforeunload
303
290
 
304
291
  // -----------------------------------------------------------------------
305
- // initialize|load (existing) user cookies
292
+ // initialize|load user cookies
306
293
  // -----------------------------------------------------------------------
307
294
  user_session.created = timestamp_now;
308
295
  user_session.timestamp = timestamp_now;
309
296
 
297
+ user_consent = j1.readCookie(cookie_names.user_consent);
310
298
  user_session = j1.existsCookie(cookie_names.user_session)
311
299
  ? j1.readCookie(cookie_names.user_session)
312
300
  : j1.writeCookie({
313
301
  name: cookie_names.user_session,
314
302
  data: user_session,
303
+ samesite: 'Strict'
315
304
  });
316
305
 
317
306
  user_state = j1.existsCookie(cookie_names.user_state)
@@ -319,27 +308,38 @@ var j1 = (function () {
319
308
  : j1.writeCookie({
320
309
  name: cookie_names.user_state,
321
310
  data: user_state,
311
+ samesite: 'Strict',
322
312
  expires: 365
323
313
  });
324
314
 
325
315
  user_state.session_active = true;
326
- j1.writeCookie({
327
- name: cookie_names.user_state,
328
- data: user_state,
329
- expires: 365
330
- });
316
+
317
+ if (!user_consent.analyses || !user_consent.personalization) {
318
+ // expire consent|state cookies to session
319
+ j1.writeCookie({
320
+ name: cookie_names.user_state,
321
+ data: user_state,
322
+ samesite: 'Strict'
323
+ });
324
+ } else {
325
+ j1.writeCookie({
326
+ name: cookie_names.user_state,
327
+ data: user_state,
328
+ samesite: 'Strict',
329
+ expires: 365
330
+ });
331
+ }
331
332
 
332
333
  // detect middleware (mode 'app') and update user session cookie
333
334
  // -----------------------------------------------------------------------
334
- // if (user_session.mode === 'na' || user_session.mode === 'app') {
335
335
  if (user_session.mode === 'app') {
336
336
  var url = new liteURL(window.location.href);
337
337
  var ep_status = baseUrl + '/status' + '?page=' + window.location.pathname;
338
338
  var detectTimeout = 50;
339
339
 
340
- baseUrl = url.origin;
340
+ baseUrl = url.origin;
341
341
 
342
- // see: https://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done
342
+ // See: https://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done
343
343
  $.when (
344
344
  $.ajax(ep_status)
345
345
  )
@@ -356,14 +356,12 @@ var j1 = (function () {
356
356
  logger.info('update user session cookie');
357
357
  j1.writeCookie({
358
358
  name: cookie_names.user_session,
359
- data: user_session
359
+ data: user_session,
360
+ samesite: 'Strict'
360
361
  });
361
362
  j1.setState(curr_state);
362
363
  logger.info('state: ' + j1.getState());
363
364
 
364
-
365
-
366
-
367
365
  var dependencies_met_page_displayed = setInterval (function () {
368
366
  if (j1.getState() == 'finished') {
369
367
  if (j1.authEnabled()) {
@@ -398,8 +396,9 @@ var j1 = (function () {
398
396
 
399
397
  logger.info(logText);
400
398
  j1.writeCookie({
401
- name: cookie_names.user_session,
402
- data: user_session
399
+ name: cookie_names.user_session,
400
+ data: user_session,
401
+ samesite: 'Strict'
403
402
  });
404
403
  j1.setState(curr_state);
405
404
  logger.info('state: ' + j1.getState());
@@ -411,10 +410,6 @@ var j1 = (function () {
411
410
  logger.info('page is being initialized');
412
411
  }
413
412
 
414
- // jadams: for testing only
415
- // display page
416
- // $('#no_flicker').css('display', 'block');
417
-
418
413
  state = 'started';
419
414
  logger.info('state: ' + state);
420
415
  logger.info('page is being initialized');
@@ -430,7 +425,6 @@ var j1 = (function () {
430
425
  // process|update user state cookie
431
426
  themeName = user_session.theme_name;
432
427
  themeCss = user_session.theme_css;
433
- themeExtensionCss = user_session.theme_extension_css;
434
428
 
435
429
  // save last page access
436
430
  // see: https://stackoverflow.com/questions/3528324/how-to-get-the-previous-url-in-javascript
@@ -455,18 +449,15 @@ var j1 = (function () {
455
449
  last_pager = user_session.last_pager;
456
450
  }
457
451
 
458
- // jadams: for testing only
459
- // display page
460
- //$('#no_flicker').css('display', 'block');
461
-
462
452
  logger.info('update user session cookie');
463
453
  j1.writeCookie({
464
- name: cookie_names.user_session,
465
- data: user_session
454
+ name: cookie_names.user_session,
455
+ data: user_session,
456
+ samesite: 'Strict'
466
457
  });
467
458
 
459
+ // NOTE: asynchronous calls should be rewitten to xhrData
468
460
  // initialize page resources for blocks
469
- // (asynchronous, should be rewitten to xhrData)
470
461
  j1.initBanner(settings);
471
462
  j1.initPanel(settings);
472
463
  j1.initFooter(settings);
@@ -477,8 +468,9 @@ var j1 = (function () {
477
468
 
478
469
  user_session.timestamp = timestamp_now;
479
470
  j1.writeCookie({
480
- name: cookie_names.user_session,
481
- data: user_session
471
+ name: cookie_names.user_session,
472
+ data: user_session,
473
+ samesite: 'Strict'
482
474
  });
483
475
 
484
476
  // -----------------------------------------------------------------------
@@ -586,7 +578,7 @@ var j1 = (function () {
586
578
  if (selector.length) {
587
579
  logText = 'loading banner on id: ' +banner[i];
588
580
  logger.info(logText);
589
- var banner_data_path = '{{banner_data_path}} ' + id + ' > *';
581
+ var banner_data_path = '{{banner_data_path}} ' + id;
590
582
  selector.load(banner_data_path, cb_load_closure(id));
591
583
  }
592
584
  } // END for
@@ -689,7 +681,7 @@ var j1 = (function () {
689
681
  if ( selector.length ) {
690
682
  logText = 'loading panel on id: ' +panel[i];
691
683
  logger.info(logText);
692
- var panel_data_path = '{{panel_data_path}} ' + id + ' > *';
684
+ var panel_data_path = '{{panel_data_path}} ' + id;
693
685
  selector.load(panel_data_path, cb_load_closure(id));
694
686
  }
695
687
  } // END for
@@ -722,12 +714,6 @@ var j1 = (function () {
722
714
  j1.setXhrDataState(footer_id, statusTxt);
723
715
  j1.setXhrDomState(footer_id, statusTxt);
724
716
  logger.info('XHR data loaded in the DOM: ' + footer_id);
725
-
726
- // jadams, 2020-07-21: intermediate state DISABLED
727
- // state = 'footer_loaded';
728
- // logger.info('set state for module ' + mod + ': ' + state);
729
- // executeFunctionByName(mod + '.setState', window, state);
730
-
731
717
  logText = 'initialization finished';
732
718
  logger.info(logText);
733
719
  }
@@ -749,7 +735,7 @@ var j1 = (function () {
749
735
  var id = '#' + '{{footer_id}}';
750
736
  var selector = $(id);
751
737
  if ( selector.length ) {
752
- var footer_data_path = '{{footer_data_path}}' + id + ' > *';
738
+ var footer_data_path = '{{footer_data_path}} ' + id;
753
739
  selector.load(footer_data_path, cb_load_closure(id));
754
740
  } else {
755
741
  logText = 'data not loaded';
@@ -804,7 +790,8 @@ var j1 = (function () {
804
790
  user_session.current_page = current_url.pathname;
805
791
  j1.writeCookie({
806
792
  name: cookie_names.user_session,
807
- data: user_session
793
+ data: user_session,
794
+ samesite: 'Strict'
808
795
  });
809
796
 
810
797
  providerPermissions = user_session.provider_permissions;
@@ -835,7 +822,7 @@ var j1 = (function () {
835
822
  $('#no_flicker').css('display', 'block');
836
823
 
837
824
  // show|hide cookie icon (should MOVED to Cookiebar ???)
838
- if (user_state.cookies_accepted === 'accepted') {
825
+ if (j1.existsCookie(cookie_names.user_consent)) {
839
826
  // Display cookie icon
840
827
  logText = 'show cookie icon';
841
828
  logger.info(logText);
@@ -847,14 +834,14 @@ var j1 = (function () {
847
834
  $('#quickLinksCookieButton').css('display', 'none');
848
835
  }
849
836
 
850
- // show|hide translator icon
851
- if (translation_enabled) {
852
- logger.info('translator detected: google');
853
- logger.info('initialize language selector');
854
- $('.goog-te-combo').addClass('form-control');
855
- }
837
+ // show|hide translator icon (currently NOT supported)
838
+ // if (translation_enabled) {
839
+ // logger.info('translator detected: google');
840
+ // logger.info('initialize language selector');
841
+ // $('.goog-te-combo').addClass('form-control');
842
+ // }
856
843
 
857
- // show cc icon
844
+ // show cc icon (currently NOT supported)
858
845
  // $('#quickLinksControlCenterButton').css('display', 'block');
859
846
 
860
847
  if (j1.authEnabled()) {
@@ -918,18 +905,22 @@ var j1 = (function () {
918
905
  user_session.current_page = current_url.pathname;
919
906
  j1.writeCookie({
920
907
  name: cookie_names.user_session,
921
- data: user_session
908
+ data: user_session,
909
+ samesite: 'Strict'
922
910
  });
923
911
 
924
- // show|hide translator icon
925
- if (translation_enabled) {
926
- logger.info('translator detected: google');
927
- logger.info('initialize language selector');
928
- $('.goog-te-combo').addClass('form-control');
929
- }
912
+ // show|hide translator icon (currently NOT supported)
913
+ // if (translation_enabled) {
914
+ // logger.info('translator detected: google');
915
+ // logger.info('initialize language selector');
916
+ // $('.goog-te-combo').addClass('form-control');
917
+ // }
918
+
919
+ // show cc icon (currently NOT supported)
920
+ // $('#quickLinksControlCenterButton').css('display', 'block');
930
921
 
931
- // show|hide cookie icon (should MOVED to Cookiebar ???)
932
- if (user_state.cookies_accepted === 'accepted') {
922
+ // show|hide cookie icon
923
+ if (j1.existsCookie(cookie_names.user_consent)) {
933
924
  // Display cookie icon
934
925
  logText = 'show cookie icon';
935
926
  logger.info(logText);
@@ -942,7 +933,7 @@ var j1 = (function () {
942
933
  }
943
934
 
944
935
  // If the page requested contains an anchor element,
945
- // do a smooth scroll to
936
+ // do a smooth scroll
946
937
  j1.scrollTo();
947
938
 
948
939
  if (user_session.previous_page !== user_session.current_page) {
@@ -1035,7 +1026,6 @@ var j1 = (function () {
1035
1026
  var toccerScrollOffset = {{toccer_options.scrollSmoothOffset}};
1036
1027
 
1037
1028
  // calculate offset for correct (smooth) scroll position
1038
- //
1039
1029
  var $pagehead = $('.attic');
1040
1030
  var $navbar = $('nav.navbar');
1041
1031
  var $adblock = $('#adblock');
@@ -1053,7 +1043,6 @@ var j1 = (function () {
1053
1043
  var scrollOffset = navbarType == 'fixed' ? -1*(n + a + l) : -1*(h + n + a + l);
1054
1044
 
1055
1045
  // static offset, to be checked why this is needed
1056
- //
1057
1046
  scrollOffset = scrollOffset + toccerScrollOffset;
1058
1047
 
1059
1048
  if (anchor_id && anchor_id !== '#') {
@@ -1133,11 +1122,6 @@ var j1 = (function () {
1133
1122
  return function (responseTxt, statusTxt, xhr) {
1134
1123
  var logger = log4javascript.getLogger('j1.adapter.xhrData');
1135
1124
  if ( statusTxt === 'success' ) {
1136
- // jadams, 2020-07-21: intermediate state should DISABLED
1137
- // if (state) {
1138
- // logger.info('set state for ' +mod+ ' to: ' + state);
1139
- // executeFunctionByName(mod + '.setState', window, state);
1140
- // }
1141
1125
  j1.setXhrDataState(id, statusTxt);
1142
1126
  j1.setXhrDomState(id, 'pending');
1143
1127
 
@@ -1161,17 +1145,27 @@ var j1 = (function () {
1161
1145
  }
1162
1146
  };
1163
1147
  };
1148
+
1164
1149
  // see: https://stackoverflow.com/questions/20420577/detect-added-element-to-dom-with-mutation-observer
1165
- var html_data_path;
1150
+ //
1151
+ var html_data_path = options.xhr_data_path + ' #' + options.xhr_data_element;
1166
1152
  var id = '#' + options.xhr_container_id;
1153
+ var container = '#' + options.xhr_container_id + '_container';
1167
1154
  var $selector = $(id);
1168
1155
 
1156
+ // NOTE: Unclear why some pages (e.g. about/site) affected (fam button).
1157
+ // All pages should have FRONTMATTER defaults (by _config.yml) setting
1158
+ // all relevant defaults.
1159
+
1160
+ // failsafe - prevent XHR load errors
1161
+ if (options.xhr_data_element !== '') {
1162
+ logger.info('XHR data element found: ' + options.xhr_data_element);
1163
+ } else {
1164
+ logger.warn('no XHR data element found, loading data aborted');
1165
+ return;
1166
+ }
1167
+
1169
1168
  if ( $selector.length ) {
1170
- if (options.xhr_data_element) {
1171
- html_data_path = options.xhr_data_path + ' #' + options.xhr_data_element + ' > *';
1172
- } else {
1173
- html_data_path = options.xhr_data_path + ' > *';
1174
- }
1175
1169
  $selector.load( html_data_path, cb_load_closure( mod, id ) );
1176
1170
 
1177
1171
  var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
@@ -1184,7 +1178,7 @@ var j1 = (function () {
1184
1178
 
1185
1179
  selector.each(function(){
1186
1180
  xhrObserver.observe(this, obsConfig);
1187
- } );
1181
+ });
1188
1182
 
1189
1183
  function mutationHandler (mutationRecords) {
1190
1184
  mutationRecords.forEach ( function (mutation) {
@@ -1196,6 +1190,8 @@ var j1 = (function () {
1196
1190
  }
1197
1191
  } else {
1198
1192
  // jadams, 2020-07-21: To be clarified why a id is "undefined"
1193
+
1194
+ // failsafe - prevent XHR load errors
1199
1195
  if (id != '#undefined') {
1200
1196
  logText = 'data not loaded on id:' + id;
1201
1197
  logger.warn(logText);
@@ -1234,6 +1230,19 @@ var j1 = (function () {
1234
1230
  }
1235
1231
  }, // END readCookie
1236
1232
 
1233
+ // -------------------------------------------------------------------------
1234
+ // findCookie()
1235
+ // Search for cookies (names) in the page header that matches
1236
+ // a given regex string. Returns all names found as an array.
1237
+ // -------------------------------------------------------------------------
1238
+ // See: https://stackoverflow.com/questions/52287989/javascript-cookie-remove-or-delete-with-regex-regular-expression
1239
+ // -------------------------------------------------------------------------
1240
+ findCookie: function (regex) {
1241
+ var r=[];
1242
+ document.cookie.replace(new RegExp(regex + "[^= ]*", "g"), function(a){ r.push(a.trim()); });
1243
+ return r;
1244
+ }, // END findCookie
1245
+
1237
1246
  // -------------------------------------------------------------------------
1238
1247
  // writeCookie()
1239
1248
  // Write 'data' to a cookie 'name'. If not exists, the cookie gets
@@ -1261,21 +1270,17 @@ var j1 = (function () {
1261
1270
  // context/HTTPS).
1262
1271
  // -------------------------------------------------------------------------
1263
1272
  //
1264
- writeCookie: function (options /*name, data, [path, expires, SameSite, secure]*/) {
1273
+ writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
1265
1274
  var defaults = {
1266
1275
  data: {},
1267
1276
  name: '',
1268
- expires: 0,
1269
1277
  path: '/',
1270
- // SameSite: 'Strict',
1271
- // SameSite: 'Lax',
1278
+ expires: 0,
1279
+ samesite: 'Lax',
1272
1280
  http_only: false,
1273
1281
  secure: false
1274
1282
  };
1275
1283
  var settings = $.extend(defaults, options);
1276
- // moment not used anymore
1277
- // var epoch = Math.floor(Date.now()/1000);
1278
- // var timestamp_now = moment.unix(epoch).format('YYYY-MM-DD HH:mm:ss');
1279
1284
  var date = new Date();
1280
1285
  var timestamp_now = date.toISOString();
1281
1286
  var cookie_data = {};
@@ -1292,25 +1297,26 @@ var j1 = (function () {
1292
1297
  if (settings.expires > 0) {
1293
1298
  Cookies.set(settings.name, data_encoded, {
1294
1299
  expires: settings.expires,
1295
- SameSite: settings.SameSite
1300
+ SameSite: settings.samesite
1296
1301
  });
1297
1302
  } else {
1298
1303
  Cookies.set(settings.name, data_encoded, {
1299
- SameSite: settings.SameSite
1304
+ SameSite: settings.samesite
1300
1305
  });
1301
1306
  }
1302
1307
  } else {
1303
1308
  cookie_data = settings.data;
1304
1309
  data_json = JSON.stringify(settings.data);
1305
1310
  data_encoded = window.btoa(data_json);
1311
+
1306
1312
  if (settings.expires > 0) {
1307
1313
  Cookies.set(settings.name, data_encoded, {
1308
1314
  expires: settings.expires,
1309
- SameSite: settings.SameSite
1315
+ SameSite: settings.samesite
1310
1316
  });
1311
1317
  } else {
1312
1318
  Cookies.set(settings.name, data_encoded, {
1313
- SameSite: settings.SameSite
1319
+ SameSite: settings.samesite
1314
1320
  });
1315
1321
  }
1316
1322
  }
@@ -1349,8 +1355,7 @@ var j1 = (function () {
1349
1355
  // by the browser if the last session (browser window) is closed.
1350
1356
  // See: https://stackoverflow.com/questions/179355/clearing-all-cookies-with-javascript
1351
1357
  // -------------------------------------------------------------------------
1352
- deleteCookie: function (options) {
1353
- var name = options;
1358
+ deleteCookie: function (name) {
1354
1359
  var all_cookies = document.cookie.split('; ');
1355
1360
 
1356
1361
  if ( name === 'all' ) {
@@ -1672,12 +1677,6 @@ var j1 = (function () {
1672
1677
  // -----------------------------------------------------------------------
1673
1678
  $('head').append('<style>.g-bg-primary { background-color: ' +bg_primary+ ' !important; }</style>');
1674
1679
 
1675
- // Set color of timeline bullet
1676
- // -----------------------------------------------------------------------
1677
- // $('head').append('<style>.tmicon { background: ' +bg_primary+ ' !important; }</style>');
1678
- // $('head').append('<style>.timeline-panel:after { border-left-color: ' +bg_primary+ ' !important; }</style>');
1679
- // $('head').append('<style>.timeline-panel:after { border-right-color: ' +bg_primary+ ' !important; }</style>');
1680
-
1681
1680
  // mdi icons
1682
1681
  // -----------------------------------------------------------------------
1683
1682
  $('head').append('<style>.iconify-md-bg-primary { color: ' +bg_primary+ ' !important; }</style>');
@@ -1818,7 +1817,7 @@ var j1 = (function () {
1818
1817
  for ( var i = 0; i < length; i++ ) {
1819
1818
  result += characters.charAt(Math.floor(Math.random() * charactersLength));
1820
1819
  }
1821
- return result;
1820
+ return result;
1822
1821
  }, // END generateId
1823
1822
 
1824
1823
  // -------------------------------------------------------------------------
@@ -1865,10 +1864,20 @@ var j1 = (function () {
1865
1864
  }; // END j1 (return)
1866
1865
  }) (j1, window);
1867
1866
 
1868
- {% endcapture %}
1867
+ {% comment %} NOTE: Unexpected token: punc (;) errors if compressed
1868
+ --------------------------------------------------------------------------------
1869
1869
  {% if production %}
1870
1870
  {{ cache | minifyJS }}
1871
1871
  {% else %}
1872
1872
  {{ cache | strip_empty_lines }}
1873
1873
  {% endif %}
1874
1874
  {% assign cache = nil %}
1875
+ -------------------------------------------------------------------------------- {% endcomment %}
1876
+
1877
+ {% endcapture %}
1878
+ {% if production %}
1879
+ {{ cache | strip_empty_lines }}
1880
+ {% else %}
1881
+ {{ cache | strip_empty_lines }}
1882
+ {% endif %}
1883
+ {% assign cache = nil %}