j1-template 2021.1.12 → 2021.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/blocks/footer/boxes/issue.proc +28 -5
  3. data/_includes/themes/j1/blocks/footer/boxes/legal_statements.proc +66 -23
  4. data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +0 -1
  5. data/_includes/themes/j1/blocks/footer/boxes/news_box.proc +16 -1
  6. data/_includes/themes/j1/layouts/content_generator_app.html +1 -1
  7. data/_includes/themes/j1/layouts/content_generator_blog_archive.html +197 -219
  8. data/_includes/themes/j1/layouts/content_generator_collection.html +4 -2
  9. data/_includes/themes/j1/layouts/content_generator_page.html +4 -1
  10. data/_includes/themes/j1/layouts/content_generator_post.html +31 -23
  11. data/_includes/themes/j1/layouts/content_generator_raw.html +1 -1
  12. data/_includes/themes/j1/layouts/layout_metadata_generator.html +82 -4
  13. data/_includes/themes/j1/modules/connectors/comment/commento.html +31 -0
  14. data/_includes/themes/j1/modules/connectors/comment/custom-provider.html +7 -8
  15. data/_includes/themes/j1/modules/connectors/comment/disqus.html +12 -54
  16. data/_includes/themes/j1/modules/connectors/comment/facebook.html +7 -8
  17. data/_includes/themes/j1/modules/connectors/comment/hyvor.html +33 -0
  18. data/_includes/themes/j1/modules/connectors/comment/just-comments.html +31 -0
  19. data/_includes/themes/j1/modules/connectors/comments +3 -0
  20. data/_includes/themes/j1/procedures/posts/collate_timeline.proc +27 -5
  21. data/_includes/themes/j1/procedures/posts/pager.proc +123 -0
  22. data/_layouts/default.html +52 -1
  23. data/assets/data/cookieconsent.html +0 -2
  24. data/assets/data/disqus.js +81 -0
  25. data/assets/data/hyvor.js +72 -0
  26. data/assets/data/menu.html +1 -1
  27. data/assets/data/mmenu_toc.html +20 -1
  28. data/assets/data/panel.html +28 -7
  29. data/assets/error_pages/HTTP204.html +2 -1
  30. data/assets/error_pages/HTTP400.html +2 -1
  31. data/assets/error_pages/HTTP401.html +2 -1
  32. data/assets/error_pages/HTTP403.html +2 -1
  33. data/assets/error_pages/HTTP404.html +2 -1
  34. data/assets/error_pages/HTTP444.html +93 -0
  35. data/assets/error_pages/HTTP500.html +2 -1
  36. data/assets/error_pages/HTTP501.html +2 -1
  37. data/assets/error_pages/HTTP502.html +2 -1
  38. data/assets/error_pages/HTTP503.html +2 -1
  39. data/assets/themes/j1/adapter/js/algolia.js +10 -10
  40. data/assets/themes/j1/adapter/js/asciidoctor.js +6 -6
  41. data/assets/themes/j1/adapter/js/attic.js +17 -17
  42. data/assets/themes/j1/adapter/js/bmd.js +6 -6
  43. data/assets/themes/j1/adapter/js/carousel.js +10 -10
  44. data/assets/themes/j1/adapter/js/clipboard.js +10 -10
  45. data/assets/themes/j1/adapter/js/cookieConsent.js +54 -27
  46. data/assets/themes/j1/adapter/js/fam.js +34 -34
  47. data/assets/themes/j1/adapter/js/framer.js +6 -6
  48. data/assets/themes/j1/adapter/js/j1.js +444 -259
  49. data/assets/themes/j1/adapter/js/justifiedGallery.js +11 -11
  50. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +19 -19
  51. data/assets/themes/j1/adapter/js/lightbox.js +6 -6
  52. data/assets/themes/j1/adapter/js/logger.js +7 -7
  53. data/assets/themes/j1/adapter/js/mmenu.js +25 -25
  54. data/assets/themes/j1/adapter/js/navigator.js +55 -48
  55. data/assets/themes/j1/adapter/js/quicksearch.js +6 -6
  56. data/assets/themes/j1/adapter/js/rouge.js +7 -7
  57. data/assets/themes/j1/adapter/js/rtable.js +6 -6
  58. data/assets/themes/j1/adapter/js/themer.js +35 -41
  59. data/assets/themes/j1/adapter/js/toccer.js +9 -9
  60. data/assets/themes/j1/modules/backstretch/js/backstretch.js +3 -3
  61. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +27 -20
  62. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +2 -2
  63. data/assets/themes/j1/modules/lunrSearch/js/quicksearch.js +1 -1
  64. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +74 -55
  65. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +75 -57
  66. data/lib/j1/version.rb +1 -1
  67. data/lib/starter_web/Gemfile +4 -5
  68. data/lib/starter_web/_config.yml +42 -24
  69. data/lib/starter_web/_data/blocks/footer.yml +52 -20
  70. data/lib/starter_web/_data/blocks/panel.yml +4 -4
  71. data/lib/starter_web/_data/builder/blog_navigator.yml +9 -192
  72. data/lib/starter_web/_data/builder/defaults/blog_navigator.yml +389 -0
  73. data/lib/starter_web/_data/j1_config.yml +66 -41
  74. data/lib/starter_web/_data/locales/be.yml +269 -0
  75. data/lib/starter_web/_data/locales/cs.yml +218 -0
  76. data/lib/starter_web/_data/locales/da.yml +213 -0
  77. data/lib/starter_web/_data/locales/de.yml +222 -0
  78. data/lib/starter_web/_data/locales/el.yml +215 -0
  79. data/lib/starter_web/_data/locales/en.yml +215 -0
  80. data/lib/starter_web/_data/locales/es.yml +219 -0
  81. data/lib/starter_web/_data/locales/et.yml +207 -0
  82. data/lib/starter_web/_data/locales/fi.yml +211 -0
  83. data/lib/starter_web/_data/locales/fr.yml +219 -0
  84. data/lib/starter_web/_data/locales/hr.yml +240 -0
  85. data/lib/starter_web/_data/locales/hu.yml +196 -0
  86. data/lib/starter_web/_data/locales/it.yml +215 -0
  87. data/lib/starter_web/_data/locales/lv.yml +233 -0
  88. data/lib/starter_web/_data/locales/nl.yml +213 -0
  89. data/lib/starter_web/_data/locales/pl.yml +241 -0
  90. data/lib/starter_web/_data/locales/pt.yml +217 -0
  91. data/lib/starter_web/_data/locales/readme +4 -0
  92. data/lib/starter_web/_data/locales/ro.yml +209 -0
  93. data/lib/starter_web/_data/locales/ru.yml +269 -0
  94. data/lib/starter_web/_data/locales/sk.yml +211 -0
  95. data/lib/starter_web/_data/locales/sl.yml +209 -0
  96. data/lib/starter_web/_data/locales/sv.yml +207 -0
  97. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +10 -10
  98. data/lib/starter_web/_data/modules/defaults/themer.yml +1 -0
  99. data/lib/starter_web/_data/modules/themer.yml +1 -0
  100. data/lib/starter_web/_data/plugins/defaults/paginator.yml +7 -6
  101. data/lib/starter_web/_data/plugins/paginator.yml +3 -0
  102. data/lib/starter_web/_includes/attributes.asciidoc +1 -1
  103. data/lib/starter_web/_plugins/date-i18n.rb +67 -0
  104. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  105. data/lib/starter_web/assets/images/modules/attics/markus-spiske-1920x1280.jpg +0 -0
  106. data/lib/starter_web/assets/images/modules/attics/matthew-dockery-1920x1280.jpg +0 -0
  107. data/lib/starter_web/collections/posts/public/featured/_posts/2020-01-01-about-cookies.adoc +1 -1
  108. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-01-site-generators.adoc +1 -1
  109. data/lib/starter_web/collections/posts/public/featured/_posts/2021-03-03-about-j1.adoc +1 -1
  110. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-01-post-test-series.adoc +2 -2
  111. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-02-post-test-series.adoc +2 -2
  112. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-03-post-test-series.adoc +2 -2
  113. data/lib/starter_web/collections/posts/public/series/_posts/2020-01-04-post-test-series.adoc +2 -2
  114. data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-20-minneapolis.adoc +1 -1
  115. data/lib/starter_web/collections/posts/public/wikipedia/_posts/2016-11-24-narcisse-snake-dens.adoc +1 -1
  116. data/lib/starter_web/index.html +3 -3
  117. data/lib/starter_web/package.json +1 -1
  118. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +3 -0
  119. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +3 -0
  120. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +3 -0
  121. data/lib/starter_web/pages/public/blog/navigator/archive.html +80 -12
  122. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +94 -26
  123. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +81 -12
  124. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +95 -37
  125. data/lib/starter_web/pages/public/blog/navigator/index.html +4 -0
  126. data/lib/starter_web/pages/public/cookieConsent.adoc +3 -0
  127. data/lib/starter_web/pages/public/learn/quickstart.adoc +473 -0
  128. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +0 -1
  129. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -1
  130. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +0 -2
  131. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +0 -2
  132. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +0 -1
  133. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +0 -1
  134. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +0 -1
  135. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +0 -1
  136. data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +0 -1
  137. data/lib/starter_web/pages/public/learn/where_to_go.adoc +0 -1
  138. data/lib/starter_web/pages/public/legal/de/100_copyright.adoc +116 -0
  139. data/lib/starter_web/pages/public/legal/de/100_impress.adoc +94 -0
  140. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +320 -0
  141. data/lib/starter_web/pages/public/legal/de/400_comment_policy.adoc +123 -0
  142. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -1
  143. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -1
  144. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +81 -20
  145. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +34 -16
  146. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  147. data/lib/starter_web/utilsrv/package.json +1 -1
  148. metadata +41 -4
  149. data/_includes/themes/j1/procedures/global/pager.proc +0 -79
  150. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.org.asciidoc +0 -244
@@ -127,8 +127,8 @@ j1.adapter['fam'] = (function (j1, window) {
127
127
 
128
128
  // initialize state flag
129
129
  _this.setState('started');
130
- logger.info('set module state to: ' + _this.getState());
131
- logger.info('module is being initialized');
130
+ logger.info('\n' + 'set module state to: ' + _this.getState());
131
+ logger.info('\n' + 'module is being initialized');
132
132
 
133
133
  // create settings object from frontmatterOptions
134
134
  var frontmatterOptions = options != null ? $.extend({}, options) : {};
@@ -161,7 +161,7 @@ j1.adapter['fam'] = (function (j1, window) {
161
161
 
162
162
  var dependencies_met_navigator = setInterval(function() {
163
163
  if (j1.adapter.navigator.getState() == 'finished') {
164
- logger.info('met dependencies for: navigator');
164
+ logger.info('\n' + 'met dependencies for: navigator');
165
165
  _this.famLoader(moduleOptions);
166
166
  clearInterval(dependencies_met_navigator);
167
167
  }
@@ -175,10 +175,10 @@ j1.adapter['fam'] = (function (j1, window) {
175
175
  famLoader: function (famOptions) {
176
176
 
177
177
  _this.setState('loading');
178
- logger.info('set module state to: ' + _this.getState());
179
- logger.info('load HTML data for fam');
178
+ logger.info('\n' + 'set module state to: ' + _this.getState());
179
+ logger.info('\n' + 'load HTML data for fam');
180
180
 
181
- j1.xhrData ({
181
+ j1.loadHTML({
182
182
  xhr_container_id: famOptions.xhr_container_id,
183
183
  xhr_data_path: famOptions.xhr_data_path,
184
184
  xhr_data_element: famOptions.fam_menu_id },
@@ -192,15 +192,15 @@ j1.adapter['fam'] = (function (j1, window) {
192
192
  var dependencies_met_fam_initialized = setInterval (function () {
193
193
  if (j1.xhrDOMState['#' + famOptions.xhr_container_id] == 'success' && j1.getState() == 'finished') {
194
194
  _this.setState('loaded');
195
- logger.info('set module state to: ' + _this.getState());
196
- logger.info('HTML data for fam: ' + _this.getState());
195
+ logger.info('\n' + 'set module state to: ' + _this.getState());
196
+ logger.info('\n' + 'HTML data for fam: ' + _this.getState());
197
197
 
198
198
  // _this.scrollSpy(famOptions);
199
199
  _this.buttonInitializer(famOptions);
200
200
 
201
201
  _this.setState('finished');
202
- logger.info('state: ' + _this.getState());
203
- logger.info('module initialized successfully');
202
+ logger.info('\n' + 'state: ' + _this.getState());
203
+ logger.info('\n' + 'module initialized successfully');
204
204
 
205
205
  $('.fam-btn').show();
206
206
 
@@ -231,14 +231,14 @@ j1.adapter['fam'] = (function (j1, window) {
231
231
  //
232
232
  $('a[href="#void"]').click(function(e) {
233
233
  e.preventDefault ? e.preventDefault() : e.returnValue = false;
234
- logger.info('bound click event to "#void", suppress default action');
234
+ logger.info('\n' + 'bound click event to "#void", suppress default action');
235
235
  });
236
236
 
237
237
  // check if multiple buttons detected
238
238
  if ( famButtons.length == 1 ) {
239
239
  _this.setState('processing');
240
- logger.info('set module state to: ' + _this.getState());
241
- logger.info('initialize fam menu');
240
+ logger.info('\n' + 'set module state to: ' + _this.getState());
241
+ logger.info('\n' + 'initialize fam menu');
242
242
 
243
243
  actionButtonId = famButtons[0].firstElementChild.id;
244
244
  actionMenuId = actionButtonId.replace('_button', '');
@@ -281,25 +281,25 @@ j1.adapter['fam'] = (function (j1, window) {
281
281
  eventHandler = item.event_handler;
282
282
  // check if eventhandler configured is a SINGLE word
283
283
  if (eventHandler.split(' ').length == 1) {
284
- logger.info('register pre-configured eventhandler ' +eventHandler+ ' on id: #' + item.id);
284
+ logger.info('\n' + 'register pre-configured eventhandler ' +eventHandler+ ' on id: #' + item.id);
285
285
 
286
286
  if ( eventHandler === 'open_mmenu_toc' ) {
287
287
  if ($('#j1-toc-mgr').length) {
288
- logger.info('found toc in page: enabled');
288
+ logger.info('\n' + 'found toc in page: enabled');
289
289
  var dependencies_met_toccer_finished = setInterval (function () {
290
290
  if ( j1.adapter.toccer.getState() == 'finished' ) {
291
- logger.info('met dependencies for: toccer');
291
+ logger.info('\n' + 'met dependencies for: toccer');
292
292
 
293
293
  // famOptions.mode === 'icon'
294
- // ? logger.info('fam mode detected: icon')
295
- // : logger.info('fam mode detected: menu');
294
+ // ? logger.info('\n' + 'fam mode detected: icon')
295
+ // : logger.info('\n' + 'fam mode detected: menu');
296
296
 
297
297
  $('#open_mmenu_toc').show();
298
298
  clearInterval(dependencies_met_toccer_finished);
299
299
  }
300
300
  }, 25); // END dependencies_met_toccer_finished
301
301
  } else {
302
- logger.info('found toc in page: disabled');
302
+ logger.info('\n' + 'found toc in page: disabled');
303
303
  }
304
304
  } else {
305
305
  $('#' + item.id).show();
@@ -313,16 +313,16 @@ j1.adapter['fam'] = (function (j1, window) {
313
313
  });
314
314
  });
315
315
  } else {
316
- logger.info('register custom eventhandler on id: #' + item.id);
316
+ logger.info('\n' + 'register custom eventhandler on id: #' + item.id);
317
317
  }
318
318
  } else {
319
319
  // alert ('Creating Eventhandler failed on id: #' + item.id);
320
- logger.error('Creating Eventhandler failed on id: #' + item.id);
320
+ logger.error('\n' + 'creating Eventhandler failed on id: #' + item.id);
321
321
  } // END if items (action buttons)
322
322
  });
323
323
  } else {
324
324
  // single action, create FAB
325
- logger.info('single action found for FAM, create: FAB');
325
+ logger.info('\n' + 'single action found for FAM, create: FAB');
326
326
 
327
327
  // disable hover event (CSS)
328
328
  // $actionButton.css({'pointer-events': 'none'})
@@ -331,7 +331,7 @@ j1.adapter['fam'] = (function (j1, window) {
331
331
  eventHandler = item.event_handler;
332
332
  // check if eventhandler configured is a SINGLE word
333
333
  if (eventHandler.split(' ').length == 1) {
334
- logger.info('register pre-configured eventhandler ' +eventHandler+ ' on id: #' + actionButtonId);
334
+ logger.info('\n' + 'register pre-configured eventhandler ' +eventHandler+ ' on id: #' + actionButtonId);
335
335
 
336
336
  if (eventHandler === 'scroll_to_top') {
337
337
  // register click event
@@ -346,10 +346,10 @@ j1.adapter['fam'] = (function (j1, window) {
346
346
  if ( eventHandler === 'open_mmenu_toc' ) {
347
347
  // check if toccer (toc_mgr) is available
348
348
  if ($('#j1-toc-mgr').length) {
349
- logger.info('found toc in page: enabled');
349
+ logger.info('\n' + 'found toc in page: enabled');
350
350
  var dependencies_met_toccer_finished = setInterval (function () {
351
351
  if ( j1.adapter.toccer.getState() == 'finished' ) {
352
- logger.info('met dependencies for toccer: finished');
352
+ logger.info('\n' + 'met dependencies for toccer: finished');
353
353
  // change the id of the $actionButton to the already
354
354
  // registered id by mmenu adapter of ('open_mmenu_toc')
355
355
  // to open the TOC sidebar
@@ -359,8 +359,8 @@ j1.adapter['fam'] = (function (j1, window) {
359
359
  }
360
360
  }, 25); // END dependencies_met_toccer_finished
361
361
  } else {
362
- logger.info('found toc in page: disabled');
363
- logger.info('eventhandler: disabled');
362
+ logger.info('\n' + 'found toc in page: disabled');
363
+ logger.info('\n' + 'eventhandler: disabled');
364
364
  }
365
365
  } // END if eventHandler == open_mmenu_toc
366
366
  }
@@ -368,8 +368,8 @@ j1.adapter['fam'] = (function (j1, window) {
368
368
  } // END else
369
369
  } else {
370
370
  // alert ('Multiple FAM buttons found: ' + famButtons.length);
371
- logger.error('Multiple FAM buttons found: ' + famButtons.length);
372
- logger.info('FAM container set to hidden: ' + $famContainer);
371
+ logger.error('\n' + 'multiple FAM buttons found: ' + famButtons.length);
372
+ logger.info('\n' + 'FAM container set to hidden: ' + $famContainer);
373
373
  $famContainer.hide();
374
374
  } // END if famButton
375
375
  }, // END buttonInitializer
@@ -573,7 +573,7 @@ j1.adapter['fam'] = (function (j1, window) {
573
573
  // var json_message = JSON.stringify(message, undefined, 2); // multiline
574
574
  var json_message = JSON.stringify(message);
575
575
 
576
- logText = 'received message from ' + sender + ': ' + json_message;
576
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
577
577
  logger.debug(logText);
578
578
 
579
579
  // -----------------------------------------------------------------------
@@ -583,10 +583,10 @@ j1.adapter['fam'] = (function (j1, window) {
583
583
  //
584
584
  // Place handling of command|action here
585
585
  //
586
- logger.info(message.text);
586
+ logger.info('\n' + message.text);
587
587
  }
588
588
  if (message.type === 'command' && message.action === 'status') {
589
- logger.info('messageHandler: received - ' + message.action);
589
+ logger.info('\n' + 'messageHandler: received - ' + message.action);
590
590
  }
591
591
 
592
592
  //
@@ -645,8 +645,8 @@ j1.adapter['fam'] = (function (j1, window) {
645
645
  ? $famContainer.css('display','block')
646
646
  : $famContainer.css('display','none');
647
647
 
648
- // logger.debug('content pos detected as: ' + m + 'px');
649
- // logger.debug('scroll pos detected as: ' + scrollPos + 'px');
648
+ // logger.debug('\n' + 'content pos detected as: ' + m + 'px');
649
+ // logger.debug('\n' + 'scroll pos detected as: ' + scrollPos + 'px');
650
650
  }); // END setTop on scroll
651
651
 
652
652
  }, // END scrollSpy
@@ -115,8 +115,8 @@ j1.adapter['framer'] = (function (j1, window) {
115
115
 
116
116
  // initialize state flag
117
117
  _this.setState('started');
118
- logger.info('state: ' + _this.getState());
119
- logger.info('module is being initialized');
118
+ logger.info('\n' + 'state: ' + _this.getState());
119
+ logger.info('\n' + 'module is being initialized');
120
120
 
121
121
  // -----------------------------------------------------------------------
122
122
  // Default module settings
@@ -160,8 +160,8 @@ j1.adapter['framer'] = (function (j1, window) {
160
160
  });
161
161
 
162
162
  _this.setState('finished');
163
- logger.info('state: ' + _this.getState());
164
- logger.info('initializing module finished');
163
+ logger.info('\n' + 'state: ' + _this.getState());
164
+ logger.info('\n' + 'initializing module finished');
165
165
 
166
166
  clearInterval(dependencies_met_page_finished);
167
167
 
@@ -179,7 +179,7 @@ j1.adapter['framer'] = (function (j1, window) {
179
179
  messageHandler: function (sender, message) {
180
180
  var json_message = JSON.stringify(message, undefined, 2);
181
181
 
182
- logText = 'received message from ' + sender + ': ' + json_message;
182
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
183
183
  logger.debug(logText);
184
184
 
185
185
  // -----------------------------------------------------------------------
@@ -189,7 +189,7 @@ j1.adapter['framer'] = (function (j1, window) {
189
189
  //
190
190
  // Place handling of command|action here
191
191
  //
192
- logger.info(message.text);
192
+ logger.info('\n' + message.text);
193
193
  }
194
194
 
195
195
  //
@@ -41,46 +41,84 @@ regenerate: true
41
41
 
42
42
  {% comment %} Set config files
43
43
  -------------------------------------------------------------------------------- {% endcomment %}
44
- {% assign blocks = site.data.blocks %}
45
- {% assign modules = site.data.modules %}
46
- {% assign template_config = site.data.j1_config %}
44
+ {% assign blocks = site.data.blocks %}
45
+ {% assign modules = site.data.modules %}
46
+ {% assign template_config = site.data.j1_config %}
47
47
 
48
48
  {% comment %} Set config data
49
49
  -------------------------------------------------------------------------------- {% endcomment %}
50
- {% assign banner_config_defaults = blocks.defaults.banner.defaults %}
51
- {% assign banner_config_settings = blocks.banner.settings %}
52
- {% assign panel_config_defaults = blocks.defaults.panel.defaults %}
53
- {% assign panel_config_settings = blocks.panel.settings %}
54
- {% assign footer_config_defaults = blocks.defaults.footer.defaults %}
55
- {% assign toccer_defaults = modules.defaults.toccer.defaults %}
56
- {% assign toccer_settings = modules.toccer.settings %}
57
- {% assign themer_defaults = modules.defaults.themer.defaults %}
58
- {% assign themer_settings = modules.themer.settings %}
59
- {% assign tracking_enabled = template_config.analytics.enabled %}
60
- {% assign tracking_id = template_config.analytics.google.tracking_id %}
61
-
62
- {% assign authentication_defaults = modules.defaults.authentication.defaults %}
63
- {% assign authentication_settings = modules.authentication.settings %}
50
+ {% assign banner_config_defaults = blocks.defaults.banner.defaults %}
51
+ {% assign banner_config_settings = blocks.banner.settings %}
52
+ {% assign panel_config_defaults = blocks.defaults.panel.defaults %}
53
+ {% assign panel_config_settings = blocks.panel.settings %}
54
+ {% assign footer_config_defaults = blocks.defaults.footer.defaults %}
55
+ {% assign toccer_defaults = modules.defaults.toccer.defaults %}
56
+
57
+ {% assign themer_defaults = modules.defaults.themer.defaults %}
58
+ {% assign themer_settings = modules.themer.settings %}
59
+
60
+ {% assign tracking_enabled = template_config.analytics.enabled %}
61
+ {% assign tracking_id = template_config.analytics.google.tracking_id %}
62
+
63
+ {% assign authentication_defaults = modules.defaults.authentication.defaults %}
64
+ {% assign authentication_settings = modules.authentication.settings %}
64
65
 
65
66
  {% comment %} Set config options
66
67
  -------------------------------------------------------------------------------- {% endcomment %}
67
- {% assign toccer_options = toccer_defaults | merge: toccer_settings %}
68
- {% assign themer_options = themer_defaults | merge: themer_settings %}
68
+ {% assign toccer_options = toccer_defaults | merge: toccer_settings %}
69
+ {% assign themer_options = themer_defaults| merge: themer_settings %}
70
+
71
+ {% assign authentication_options = authentication_defaults | merge: authentication_settings %}
69
72
 
70
- {% assign authentication_options = authentication_defaults | merge: authentication_settings %}
73
+ {% assign footer_id = footer_config_defaults.container-id %}
74
+ {% assign footer_data_path = footer_config_defaults.data_path %}
75
+ {% assign banner_data_path = banner_config_defaults.data_path %}
76
+ {% assign panel_data_path = panel_config_defaults.data_path %}
71
77
 
72
- {% assign footer_id = footer_config_defaults.container-id %}
73
- {% assign footer_data_path = footer_config_defaults.data_path %}
74
- {% assign banner_data_path = banner_config_defaults.data_path %}
75
- {% assign panel_data_path = panel_config_defaults.data_path %}
78
+ {% assign themer_enabled = modules.themer_options.enabled %}
79
+ {% assign themer_reloadPageOnChange = modules.themer_options.reloadPageOnChange %}
80
+ {% assign themer_hideOnReload = modules.themer_options.hideOnReload %}
81
+ {% assign comment_provider = template_config.comments.provider %}
76
82
 
77
- {% assign hideOnReload = modules.themer_options.hideOnReload %}
83
+ {% comment %} Set variables
84
+ -------------------------------------------------------------------------------- {% endcomment %}
85
+ {% if comment_provider == 'disqus' %}
86
+ {% assign site_id = template_config.comments.disqus.site_id %}
87
+ {% elsif comment_provider == 'hyvor' %}
88
+ {% assign site_id = template_config.comments.hyvor.site_id %}
89
+ {% elsif comment_provider == 'commento' %}
90
+ {% assign site_id = template_config.comments.commento.site_id %}
91
+ {% elsif comment_provider == 'just-comments' %}
92
+ {% assign site_id = template_config.comments.just-comments.site_id %}
93
+ {% elsif comment_provider == 'facebook' %}
94
+ {% assign site_id = template_config.comments.facebook.site_id %}
95
+ {% else %}
96
+ {% assign site_id = false %}
97
+ {% endif %}
78
98
 
79
99
  {% assign production = false %}
80
100
  {% if environment == 'prod' or environment == 'production' %}
81
101
  {% assign production = true %}
82
102
  {% endif %}
83
103
 
104
+ {% comment %} language detection
105
+ -------------------------------------------------------------------------------- {% endcomment %}
106
+ {% if site.language == "en" %}
107
+ {% assign language = "en" %}
108
+ {% elsif site.language == "de"%}
109
+ {% assign language = "de" %}
110
+ {% else %}
111
+ {% assign language = "en" %}
112
+ {% endif %}
113
+
114
+ {% if language == "en" %}
115
+ {% assign comments_headline = template_config.comments.comments_headline.en %}
116
+ {% endif %}
117
+
118
+ {% if language == "de" %}
119
+ {% assign comments_headline = template_config.comments.comments_headline.de %}
120
+ {% endif %}
121
+
84
122
  /*
85
123
  # -----------------------------------------------------------------------------
86
124
  # ~/assets/themes/j1/adapter/js/j1_template.js
@@ -124,11 +162,18 @@ var j1 = (function () {
124
162
  var state = 'not_started';
125
163
  var mode = 'not_detected';
126
164
 
127
- // Tracking information (GA)
165
+ // Default tracking provider information
128
166
  var tracking_enabled = ('{{tracking_enabled}}' === 'true') ? true: false;
129
167
  var tracking_id = '{{tracking_id}}';
130
168
  var tracking_id_valid = (tracking_id.includes('tracking-id')) ? false : true;
131
169
 
170
+ // Default comment provider information
171
+ var comment_provider = '{{comment_provider}}';
172
+ var site_id = '{{site_id}}';
173
+
174
+ // Default translator settings (currently NOT supported)
175
+ // var translation_enabled = {{template_config.translation.enabled}};
176
+
132
177
  var current_user_data;
133
178
  var current_page;
134
179
  var previous_page;
@@ -138,15 +183,12 @@ var j1 = (function () {
138
183
  var user_session_detected;
139
184
  var cookie_written;
140
185
 
141
- // Translatior settings (currently NOT supported)
142
- // var translation_enabled = {{template_config.translation.enabled}};
143
-
144
186
  // Theme information
145
187
  var themeName;
146
188
  var themeCss;
147
189
  var cssExtension = (environment === 'production')
148
190
  ? '.min.css'
149
- : '.css';
191
+ : '.css'
150
192
 
151
193
  // Pathes of J1 data files
152
194
  var colors_data_path = '{{template_config.colors_data_path}}';
@@ -165,7 +207,7 @@ var j1 = (function () {
165
207
  var baseUrl;
166
208
  var referrer;
167
209
 
168
- // initial cookie values
210
+ // initial cookie settings
169
211
  var cookie_names = {
170
212
  'app_session': '{{template_config.cookies.app_session}}',
171
213
  'user_session': '{{template_config.cookies.user_session}}',
@@ -191,9 +233,8 @@ var j1 = (function () {
191
233
  };
192
234
  var user_state = {
193
235
  'writer': 'j1.adapter',
194
- 'theme_css': '',
195
- 'theme_css': '',
196
236
  'theme_name': '',
237
+ 'theme_css': '',
197
238
  'theme_author': '',
198
239
  'theme_version': '{{template_version}}',
199
240
  'session_active': false,
@@ -233,9 +274,15 @@ var j1 = (function () {
233
274
  var logger = log4javascript.getLogger('j1.init');
234
275
  var url = new liteURL(window.location.href);
235
276
  var baseUrl = url.origin;
277
+ var hostname = url.hostname;
278
+ var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
279
+ var secure = (url.protocol.includes('https')) ? true : false;
236
280
  var date = new Date();
237
281
  var timestamp_now = date.toISOString();
238
282
  var curr_state = 'started';
283
+ var gaCookies = j1.findCookie('_ga');
284
+ var j1Cookies = j1.findCookie('j1');
285
+ var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
239
286
 
240
287
  // -----------------------------------------------------------------------
241
288
  // options loader
@@ -276,38 +323,45 @@ var j1 = (function () {
276
323
  user_state.last_session_ts = timestamp_now;
277
324
 
278
325
  if (!user_consent.analyses || !user_consent.personalization) {
279
- // expire consent|state cookies to session
326
+ // rewrite consent|state cookies to session
327
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_consent);
280
328
  cookie_written = j1.writeCookie({
281
329
  name: cookie_names.user_consent,
282
330
  data: user_consent,
283
- samesite: 'Strict'
331
+ samesite: 'Strict',
332
+ secure: secure,
333
+ expires: 0
284
334
  });
285
335
  if (!cookie_written) {
286
- logger.error('failed to write cookie: ' + cookie_names.user_consent);
336
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
287
337
  }
338
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
288
339
  cookie_written = j1.writeCookie({
289
340
  name: cookie_names.user_state,
290
341
  data: user_state,
291
- samesite: 'Strict'
342
+ samesite: 'Strict',
343
+ secure: secure,
344
+ expires: 0
292
345
  });
293
346
  if (!cookie_written) {
294
- logger.error('failed to write cookie: ' + cookie_names.user_consent);
347
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_consent);
295
348
  }
296
349
  } else {
350
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
297
351
  cookie_written = j1.writeCookie({
298
352
  name: cookie_names.user_state,
299
353
  data: user_state,
300
354
  samesite: 'Strict',
355
+ secure: secure,
301
356
  expires: 365
302
357
  });
303
358
  if (!cookie_written) {
304
- logger.error('failed to write cookie: ' + cookie_names.user_state);
359
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
305
360
  }
306
361
  }
307
362
  } else {
308
- // jadams, 2021-07-11: on beforeunload, a vaild state cookie
309
- // is expected
310
- logger.fatal('missing cookie detected: ' + cookie_names.user_state);
363
+ // jadams, 2021-07-11: on beforeunload, a user state cookie is expected
364
+ logger.error('\n' + 'missing cookie detected: ' + cookie_names.user_state);
311
365
  }
312
366
  }); // END beforeunload
313
367
 
@@ -323,10 +377,12 @@ var j1 = (function () {
323
377
  : cookie_written = j1.writeCookie({
324
378
  name: cookie_names.user_session,
325
379
  data: user_session,
326
- samesite: 'Strict'
380
+ samesite: 'Strict',
381
+ secure: secure,
382
+ expires: 0
327
383
  });
328
384
  if (!cookie_written) {
329
- logger.error('failed to write cookie: ' + cookie_names.user_session);
385
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
330
386
  }
331
387
 
332
388
  user_state = j1.existsCookie(cookie_names.user_state)
@@ -335,10 +391,11 @@ var j1 = (function () {
335
391
  name: cookie_names.user_state,
336
392
  data: user_state,
337
393
  samesite: 'Strict',
394
+ secure: secure,
338
395
  expires: 365
339
396
  });
340
397
  if (!cookie_written) {
341
- logger.error('failed to write cookie: ' + cookie_names.user_state);
398
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
342
399
  }
343
400
 
344
401
  // jadams, 2021-07-11: Found situation that user_state NOT initialized
@@ -346,30 +403,39 @@ var j1 = (function () {
346
403
  // TODO: Check if/why user state (cookie NOT created?) NOT initialized
347
404
  // for what reason.
348
405
  if (!user_state) {
349
- logger.error('cookie not found: ' + cookie_names.user_state);
406
+ logger.error('\n' + 'cookie not found: ' + cookie_names.user_state);
407
+ logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
408
+ j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
409
+ logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
410
+ gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
350
411
  user_state = j1.readCookie(cookie_names.user_state);
351
412
  user_state.session_active = true;
352
413
  }
353
414
 
354
415
  if (!user_consent.analyses || !user_consent.personalization) {
355
- // expire consent|state cookies to session
416
+ // rewrite consent|state cookies to session
417
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
356
418
  cookie_written = j1.writeCookie({
357
419
  name: cookie_names.user_state,
358
420
  data: user_state,
359
- samesite: 'Strict'
421
+ samesite: 'Strict',
422
+ secure: secure,
423
+ expires: 0
360
424
  });
361
425
  if (!cookie_written) {
362
- logger.error('failed to write cookie: ' + cookie_names.user_state);
426
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
363
427
  }
364
428
  } else {
429
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
365
430
  cookie_written = j1.writeCookie({
366
431
  name: cookie_names.user_state,
367
432
  data: user_state,
368
433
  samesite: 'Strict',
434
+ secure: secure,
369
435
  expires: 365
370
436
  });
371
437
  if (!cookie_written) {
372
- logger.error('failed to write cookie: ' + cookie_names.user_state);
438
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
373
439
  }
374
440
  }
375
441
 
@@ -393,40 +459,43 @@ var j1 = (function () {
393
459
  user_session.requested_page = window.location.pathname;
394
460
  user_session.timestamp = timestamp_now;
395
461
  user_session = j1.mergeData(user_session, data);
396
- logText = 'mode detected: ' + user_session.mode;
462
+ logText = '\n' + 'mode detected: ' + user_session.mode;
397
463
 
398
464
  logger.info(logText);
399
- logger.info('update user session cookie');
465
+ logger.info('\n' + 'update user session cookie');
466
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
400
467
  cookie_written = j1.writeCookie({
401
468
  name: cookie_names.user_session,
402
469
  data: user_session,
403
- samesite: 'Strict'
470
+ samesite: 'Strict',
471
+ secure: secure,
472
+ expires: 0
404
473
  });
405
474
 
406
475
  if (!cookie_written) {
407
- logger.error('failed to write cookie: ' + cookie_names.user_session);
476
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
408
477
  }
409
478
 
410
479
  j1.setState(curr_state);
411
- logger.info('state: ' + j1.getState());
480
+ logger.info('\n' + 'state: ' + j1.getState());
412
481
 
413
482
  var dependencies_met_page_displayed = setInterval (function () {
414
483
  if (j1.getState() == 'finished') {
415
484
  if (j1.authEnabled()) {
416
485
  if (user_session.authenticated === 'true') {
417
486
  // set signout
418
- logger.info('show signout icon');
487
+ logger.info('\n' + 'show signout icon');
419
488
  $('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
420
489
  $('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
421
490
  } else {
422
491
  // set signin
423
- logger.info('show signin icon');
492
+ logger.info('\n' + 'show signin icon');
424
493
  $('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
425
494
  $('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
426
495
  }
427
- logger.info('authentication detected as: ' + user_session.authenticated);
496
+ logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
428
497
  $('#quickLinksSignInOutButton').css('display', 'block');
429
- logger.info('met dependencies for: j1');
498
+ logger.info('\n' + 'met dependencies for: j1');
430
499
  clearInterval(dependencies_met_page_displayed);
431
500
  }
432
501
  }
@@ -440,38 +509,41 @@ var j1 = (function () {
440
509
  user_session.mode = 'web';
441
510
  user_session.requested_page = window.location.pathname;
442
511
  user_session.timestamp = timestamp_now;
443
- logText = 'mode detected: ' + user_session.mode;
512
+ logText = '\n' + 'mode detected: ' + user_session.mode;
444
513
 
445
514
  logger.info(logText);
515
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
446
516
  cookie_written = j1.writeCookie({
447
517
  name: cookie_names.user_session,
448
518
  data: user_session,
449
- samesite: 'Strict'
519
+ samesite: 'Strict',
520
+ secure: secure,
521
+ expires: 0
450
522
  });
451
523
  if (!cookie_written) {
452
- logger.error('failed to write cookie: ' + cookie_names.user_session);
524
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
453
525
  }
454
526
 
455
527
  j1.setState(curr_state);
456
- logger.info('state: ' + j1.getState());
528
+ logger.info('\n' + 'state: ' + j1.getState());
457
529
  }, detectTimeout);
458
530
  });
459
531
  } else { // web mode
460
532
  state = 'started';
461
- logger.info('state: ' + state);
462
- logger.info('page is being initialized');
533
+ logger.info('\n' + 'state: ' + state);
534
+ logger.info('\n' + 'page is being initialized');
463
535
  }
464
536
 
465
537
  state = 'started';
466
- logger.info('state: ' + state);
467
- logger.info('page is being initialized');
538
+ logger.info('\n' + 'state: ' + state);
539
+ logger.info('\n' + 'page is being initialized');
468
540
 
469
541
  if ( settings.scrollbar === 'false' ) {
470
542
  $('body').addClass('hide-scrollbar');
471
543
  $('html').addClass('hide-scrollbar-moz');
472
544
  }
473
545
 
474
- logger.info('read user state from cookie');
546
+ logger.info('\n' + 'read user state from cookie');
475
547
  user_session = j1.readCookie(cookie_names.user_session);
476
548
 
477
549
  // process|update user state cookie
@@ -501,15 +573,18 @@ var j1 = (function () {
501
573
  last_pager = user_session.last_pager;
502
574
  }
503
575
 
504
- logger.info('update user session cookie');
576
+ logger.info('\n' + 'update user session cookie');
577
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
505
578
  cookie_written = j1.writeCookie({
506
579
  name: cookie_names.user_session,
507
580
  data: user_session,
508
- samesite: 'Strict'
581
+ samesite: 'Strict',
582
+ secure: secure,
583
+ expires: 0
509
584
  });
510
585
 
511
586
  if (!cookie_written) {
512
- logger.error('failed to write cookie: ' + cookie_names.user_session);
587
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
513
588
  }
514
589
 
515
590
  // NOTE: asynchronous calls should be rewitten to xhrData
@@ -519,17 +594,20 @@ var j1 = (function () {
519
594
  j1.initFooter(settings);
520
595
 
521
596
  state = 'running';
522
- logger.info('state: ' + state);
523
- logger.info(logText);
597
+ logger.info('\n' + 'state: ' + state);
598
+ // logger.info(logText);
524
599
 
525
600
  user_session.timestamp = timestamp_now;
601
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
526
602
  cookie_written = j1.writeCookie({
527
603
  name: cookie_names.user_session,
528
604
  data: user_session,
529
- samesite: 'Strict'
605
+ samesite: 'Strict',
606
+ secure: secure,
607
+ expires: 0
530
608
  });
531
609
  if (!cookie_written) {
532
- logger.error('failed to write cookie: ' + cookie_names.user_session);
610
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
533
611
  }
534
612
 
535
613
  // -----------------------------------------------------------------------
@@ -561,20 +639,20 @@ var j1 = (function () {
561
639
  return function ( responseTxt, statusTxt, xhr ) {
562
640
  if ( statusTxt == 'success' ) {
563
641
  var logger = log4javascript.getLogger('j1.adapter.xhrData');
564
- logText = 'loading banner completed on id: ' +banner_id;
642
+ logText = '\n' + 'loading banner completed on id: ' +banner_id;
565
643
  logger.info(logText);
566
644
  j1.setXhrDataState(banner_id, statusTxt);
567
645
  j1.setXhrDomState(banner_id, statusTxt);
568
- logger.info('XHR data loaded in the DOM: ' + banner_id);
646
+ logger.info('\n' + 'XHR data loaded in the DOM: ' + banner_id);
569
647
  }
570
648
  if ( statusTxt == 'error' ) {
571
- logText = 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
649
+ logText = '\n' + 'loading banner failed on id: ' +banner_id+ ', error: ' + xhr.status + ': ' + xhr.statusText;
572
650
  logger.error(logText);
573
651
  j1.setXhrDataState(banner_id, statusTxt);
574
652
  j1.setXhrDomState(banner_id, statusTxt);
575
653
  // Set|Log status
576
654
  state = 'failed';
577
- logger.error('state: ' + state);
655
+ logger.error('\n' + 'state: ' + state);
578
656
  }
579
657
  };
580
658
  };
@@ -635,15 +713,15 @@ var j1 = (function () {
635
713
  var id = '#' + banner[i];
636
714
  var selector = $(id);
637
715
  if (selector.length) {
638
- logText = 'loading banner on id: ' +banner[i];
716
+ logText = '\n' + 'loading banner on id: ' +banner[i];
639
717
  logger.info(logText);
640
718
  var banner_data_path = '{{banner_data_path}} ' + id;
641
719
  selector.load(banner_data_path, cb_load_closure(id));
642
720
  }
643
721
  } // END for
644
722
  } else {
645
- logText = 'no banner found in site';
646
- logger.info(logText);
723
+ logText = '\n' + 'no banner found in site';
724
+ logger.warn(logText);
647
725
  return false;
648
726
  }
649
727
  return true;
@@ -672,20 +750,20 @@ var j1 = (function () {
672
750
  return function ( responseTxt, statusTxt, xhr ) {
673
751
  var logger = log4javascript.getLogger('j1.adapter.xhrData');
674
752
  if ( statusTxt == 'success' ) {
675
- logText = 'loading panel completed on id: ' +panel_id;
753
+ logText = '\n' + 'loading panel completed on id: ' +panel_id;
676
754
  logger.info(logText);
677
755
  j1.setXhrDataState(panel_id, statusTxt);
678
756
  j1.setXhrDomState(panel_id, statusTxt);
679
- logger.info('XHR data loaded in the DOM: ' + panel_id);
757
+ logger.info('\n' + 'XHR data loaded in the DOM: ' + panel_id);
680
758
  }
681
759
  if ( statusTxt == 'error' ) {
682
- logText = 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
760
+ logText = '\n' + 'loading panel failed on id: ' +panel_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
683
761
  logger.error(logText);
684
762
  j1.setXhrDataState(panel_id, statusTxt);
685
763
  j1.setXhrDomState(panel_id, statusTxt);
686
764
  // Set|Log status
687
765
  state = 'Error';
688
- logger.error('state: ' + state);
766
+ logger.error('\n' + 'state: ' + state);
689
767
  }
690
768
  };
691
769
  };
@@ -738,15 +816,15 @@ var j1 = (function () {
738
816
  var id = '#' + panel[i];
739
817
  var selector = $(id);
740
818
  if ( selector.length ) {
741
- logText = 'loading panel on id: ' +panel[i];
819
+ logText = '\n' + 'loading panel on id: ' +panel[i];
742
820
  logger.info(logText);
743
821
  var panel_data_path = '{{panel_data_path}} ' + id;
744
822
  selector.load(panel_data_path, cb_load_closure(id));
745
823
  }
746
824
  } // END for
747
825
  } else {
748
- logText = 'no panel found in site';
749
- logger.info(logText);
826
+ logText = '\n' + 'no panel found in site';
827
+ logger.warn(logText);
750
828
  return false;
751
829
  }
752
830
  return true;
@@ -761,31 +839,31 @@ var j1 = (function () {
761
839
  var mod = 'j1';
762
840
  var logText;
763
841
 
764
- logText = 'loading footer started';
842
+ logText = '\n' + 'loading footer started';
765
843
  logger.info(logText);
766
844
 
767
845
  var cb_load_closure = function(footer_id) {
768
846
  return function ( responseTxt, statusTxt, xhr ) {
769
847
  var logger = log4javascript.getLogger('j1.adapter.xhrData');
770
848
  if ( statusTxt == 'success' ) {
771
- logText = 'footer loaded successfully on id: ' + footer_id;
849
+ logText = '\n' + 'footer loaded successfully on id: ' + footer_id;
772
850
  logger.info(logText);
773
851
  j1.setXhrDataState(footer_id, statusTxt);
774
852
  j1.setXhrDomState(footer_id, statusTxt);
775
- logger.info('XHR data loaded in the DOM: ' + footer_id);
776
- logText = 'initialization finished';
853
+ logger.info('\n' + 'XHR data loaded in the DOM: ' + footer_id);
854
+ logText = '\n' + 'initialization finished';
777
855
  logger.info(logText);
778
856
  }
779
857
  if ( statusTxt == 'error' ) {
780
- logText = 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
858
+ logText = '\n' + 'loading footer failed on id: ' +footer_id+ ', error ' + xhr.status + ': ' + xhr.statusText;
781
859
  logger.error(logText);
782
860
  j1.setXhrDataState(footer_id, statusTxt);
783
861
  j1.setXhrDomState(footer_id, statusTxt);
784
862
 
785
863
  // Set|Log status
786
864
  state = 'failed';
787
- logger.error('state: ' + state);
788
- logText = 'initialization finished';
865
+ logger.error('\n' + 'state: ' + state);
866
+ logText = '\n' + 'initialization finished';
789
867
  logger.info(logText);
790
868
  }
791
869
  };
@@ -797,7 +875,7 @@ var j1 = (function () {
797
875
  var footer_data_path = '{{footer_data_path}} ' + id;
798
876
  selector.load(footer_data_path, cb_load_closure(id));
799
877
  } else {
800
- logText = 'data not loaded';
878
+ logText = '\n' + 'data not loaded';
801
879
  logger.warn(logText);
802
880
  j1.setXhrDataState(id, 'not loaded');
803
881
  j1.setXhrDomState(id, 'pending');
@@ -821,9 +899,11 @@ var j1 = (function () {
821
899
  var flickerTimeout = {{template_config.flicker_timeout}};
822
900
  var url = new liteURL(window.location.href);
823
901
  var baseUrl = url.origin;
902
+ var secure = (url.protocol.includes('https')) ? true : false;
824
903
  var ep_status = baseUrl + '/status' + '?page=' + window.location.pathname;
825
904
  var user_session = j1.readCookie(cookie_names.user_session);
826
905
  var user_state = j1.readCookie(cookie_names.user_state);
906
+ var user_consent = j1.readCookie(cookie_names.user_consent);
827
907
  var current_url = new liteURL(window.location.href);
828
908
  var providerPermissions = {};
829
909
  var provider;
@@ -831,14 +911,36 @@ var j1 = (function () {
831
911
  var appDetected;
832
912
  var categoryAllowed;
833
913
 
834
- logger.info('finalize page');
914
+ // provider APIs require user consent
915
+ var meta_analytics = $('meta[name=analytics]').attr('content');
916
+ var analytics = (meta_analytics === 'true') ? true: false;
917
+ var meta_comments = $('meta[name=comments]').attr('content');
918
+ var comments = (meta_comments === 'true') ? true: false;
919
+ var meta_advertising = $('meta[name=advertising]').attr('content');
920
+ var advertising = (meta_advertising === 'true') ? true: false;
921
+ var meta_youtube = $('meta[name=youtube]').attr('content');
922
+ var youtube = (meta_youtube === 'true') ? true: false;
923
+ var meta_vimeo = $('meta[name=vimeo]').attr('content');
924
+ var vimeo = (meta_vimeo === 'true') ? true: false;
925
+
926
+ // personalized content require user consent
927
+ var meta_personalization = $('meta[name=personalization]').attr('content');
928
+ var personalization = (meta_personalization === 'true') ? true: false;
929
+
930
+ // if personalized content detected, page requires user consent
931
+ if (personalization && !user_consent.personalization) {
932
+ // redirect to error paged (blocked content)
933
+ window.location.href = "/444.html";
934
+ }
935
+
936
+ logger.info('\n' + 'finalize page');
835
937
  j1.setCss();
836
938
 
837
- logText= 'loading page partials: started';
939
+ logText= '\n' + 'loading page partials: started';
838
940
  logger.info(logText);
839
941
 
840
942
  if (j1.appDetected()) { // app mode
841
- logger.info('mode detected: app');
943
+ logger.info('\n' + 'mode detected: app');
842
944
 
843
945
  $.when ($.ajax(ep_status))
844
946
  .then(function(data) {
@@ -847,13 +949,16 @@ var j1 = (function () {
847
949
  user_session = j1.mergeData(user_session, data);
848
950
 
849
951
  user_session.current_page = current_url.pathname;
952
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
850
953
  cookie_written = j1.writeCookie({
851
954
  name: cookie_names.user_session,
852
955
  data: user_session,
853
- samesite: 'Strict'
956
+ samesite: 'Strict',
957
+ secure: secure,
958
+ expires: 0
854
959
  });
855
960
  if (!cookie_written) {
856
- logger.error('failed to write cookie: ' + cookie_names.user_session);
961
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
857
962
  }
858
963
 
859
964
  providerPermissions = user_session.provider_permissions;
@@ -880,26 +985,76 @@ var j1 = (function () {
880
985
 
881
986
  // show the page delayed
882
987
  setTimeout (function() {
988
+
989
+ // Manage providers for personalization OptIn/Out (Comments|Ads)
990
+ if (!user_consent.personalization) {
991
+ logger.warn('\n' + 'disable comment provider: ' + comment_provider);
992
+ $('#leave-a-comment').remove();
993
+ if (comment_provider === 'disqus') {
994
+ $('#dsq-count-scr').remove();
995
+ $('#disqus-thread').remove();
996
+ }
997
+ if (comment_provider === 'hyvor') {
998
+ $('#hyvor-embed').remove();
999
+ $('#hyvor-talk-view').remove();
1000
+ }
1001
+ } else {
1002
+ if (comments) {
1003
+ logger.warn('\n' + 'enable comment provider: ' + comment_provider);
1004
+ $('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
1005
+ if (comment_provider === 'disqus') {
1006
+ logger.info('\n' + 'load comment provider code: ' + comment_provider);
1007
+ $('#main-content').append('<div id="disqus_thread"></div>');
1008
+ $('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
1009
+ j1.loadJS({
1010
+ xhr_data_path: '/assets/data/' + comment_provider + '.js',
1011
+ xhr_data_element: comment_provider
1012
+ });
1013
+ }
1014
+ if (comment_provider === 'hyvor') {
1015
+ $('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
1016
+ $('#main-content').append('<div id="hyvor-talk-view"></div>');
1017
+ $('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
1018
+ }
1019
+ } // END comments
1020
+ } // END personalization
1021
+
883
1022
  // display page
884
- $('#no_flicker').css('display', 'block');
1023
+ $('#no_flicker').css('display', 'block');
1024
+
1025
+ // add recommended title to hyvor iframe for SEO optimization (if loadad)
1026
+ if (comment_provider === 'hyvor') {
1027
+ var dependencies_met_load_finished = setInterval (function () {
1028
+ if ($('#hyvor-talk-view').children().length) {
1029
+ $('#hyvor-talk-iframe').prop('title', 'Hyvor talk iframe');
1030
+ clearInterval(dependencies_met_load_finished);
1031
+ }
1032
+ }, 25);
1033
+ }
885
1034
 
886
1035
  // NOTE: Placed tracking warning/info here because page may reloaded
887
1036
  // after cookie consent selection
888
- //
889
- if (tracking_enabled && !tracking_id_valid) {
890
- logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
1037
+ if (user_consent.analyses) {
1038
+ logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
1039
+ if (tracking_enabled && !tracking_id_valid) {
1040
+ logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
1041
+ } else if (tracking_enabled && tracking_id_valid) {
1042
+ logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
1043
+ } else {
1044
+ logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
1045
+ }
891
1046
  } else {
892
- logger.warn('tracking enabled, tracking id found: ' + tracking_id);
1047
+ logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
893
1048
  }
894
1049
 
895
1050
  // show|hide cookie icon (should MOVED to Cookiebar ???)
896
1051
  if (j1.existsCookie(cookie_names.user_consent)) {
897
1052
  // Display cookie icon
898
- logText = 'show cookie icon';
1053
+ logText = '\n' + 'show cookie icon';
899
1054
  logger.info(logText);
900
1055
  $('#quickLinksCookieButton').css('display', 'block');
901
1056
  } else {
902
- logText = 'hide cookie icon';
1057
+ logText = '\n' + 'hide cookie icon';
903
1058
  logger.info(logText);
904
1059
  // Display cookie icon
905
1060
  $('#quickLinksCookieButton').css('display', 'none');
@@ -907,8 +1062,8 @@ var j1 = (function () {
907
1062
 
908
1063
  // show|hide translator icon (currently NOT supported)
909
1064
  // if (translation_enabled) {
910
- // logger.info('translator detected: google');
911
- // logger.info('initialize language selector');
1065
+ // logger.info('\n' + 'translator detected: google');
1066
+ // logger.info('\n' + 'initialize language selector');
912
1067
  // $('.goog-te-combo').addClass('form-control');
913
1068
  // }
914
1069
 
@@ -918,16 +1073,16 @@ var j1 = (function () {
918
1073
  if (j1.authEnabled()) {
919
1074
  if (user_session.authenticated === 'true') {
920
1075
  // set signout
921
- logger.info('show signout icon');
1076
+ logger.info('\n' + 'show signout icon');
922
1077
  $('#navLinkSignInOut').attr('data-target','#modalOmniSignOut');
923
1078
  $('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
924
1079
  } else {
925
1080
  // set signin
926
- logger.info('show signin icon');
1081
+ logger.info('\n' + 'show signin icon');
927
1082
  $('#navLinkSignInOut').attr('data-target','#modalOmniSignIn');
928
1083
  $('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
929
1084
  }
930
- logger.info('authentication detected as: ' + user_session.authenticated);
1085
+ logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
931
1086
  $('#quickLinksSignInOutButton').css('display', 'block');
932
1087
  }
933
1088
 
@@ -936,25 +1091,25 @@ var j1 = (function () {
936
1091
  j1.scrollTo();
937
1092
 
938
1093
  if (user_session.previous_page !== user_session.current_page) {
939
- logText = 'page change detected';
1094
+ logText = '\n' + 'page change detected';
940
1095
  logger.info(logText);
941
- logText = 'previous page: ' + user_session.previous_page;
1096
+ logText = '\n' + 'previous page: ' + user_session.previous_page;
942
1097
  logger.info(logText);
943
- logText = 'current page: ' + user_session.current_page;
1098
+ logText = '\n' + 'current page: ' + user_session.current_page;
944
1099
  logger.info(logText);
945
1100
  }
946
1101
 
947
1102
  // update sidebar for changed theme data
948
- logger.info('update sidebar');
1103
+ logger.info('\n' + 'update sidebar');
949
1104
  user_state = j1.readCookie(cookie_names.user_state);
950
1105
  current_user_data = j1.mergeData(user_session, user_state);
951
1106
  j1.core.navigator.updateSidebar(current_user_data);
952
1107
 
953
1108
  // Set|Log status
954
1109
  state = 'finished';
955
- logText = 'state: ' + state;
1110
+ logText = '\n' + 'state: ' + state;
956
1111
  logger.info(logText);
957
- logText = 'page finalized successfully';
1112
+ logText = '\n' + 'page finalized successfully';
958
1113
  logger.info(logText);
959
1114
 
960
1115
  }, flickerTimeout);
@@ -963,39 +1118,91 @@ var j1 = (function () {
963
1118
  // show the page delayed
964
1119
  setTimeout (function() {
965
1120
  j1.setState('finished');
966
- logger.info('state: finished');
967
- logger.info('page initialization: finished');
1121
+ logger.info('\n' + 'state: finished');
1122
+ logger.info('\n' + 'page initialization: finished');
1123
+
1124
+ // Manage providers for personalization OptIn/Out (Comments|Ads)
1125
+ if (!user_consent.personalization) {
1126
+ logger.warn('\n' + 'disable comment provider: ' + comment_provider);
1127
+ $('#leave-a-comment').remove();
1128
+ if (comment_provider === 'disqus') {
1129
+ $('#dsq-count-scr').remove();
1130
+ $('#disqus-thread').remove();
1131
+ }
1132
+ if (comment_provider === 'hyvor') {
1133
+ $('#hyvor-embed').remove();
1134
+ $('#hyvor-talk-view').remove();
1135
+ }
1136
+ } else {
1137
+ if (comments) {
1138
+ logger.warn('\n' + 'enable comment provider: ' + comment_provider);
1139
+ $('#main-content').append('<h2 id="leave-a-comment" class="mt-4">{{comments_headline}}</h2>');
1140
+ if (comment_provider === 'disqus') {
1141
+ logger.info('\n' + 'load comment provider code: ' + comment_provider);
1142
+ $('#main-content').append('<div id="disqus_thread"></div>');
1143
+ $('body').append('<script async id="dsq-count-scr" src="//' + site_id + '.disqus.com/count.js"></script>');
1144
+ j1.loadJS({
1145
+ xhr_data_path: '/assets/data/' + comment_provider + '.js',
1146
+ xhr_data_element: comment_provider
1147
+ });
1148
+ }
1149
+ if (comment_provider === 'hyvor') {
1150
+ $('body').append('<script> var HYVOR_TALK_WEBSITE = ' + site_id + '; var HYVOR_TALK_CONFIG = { url: false, id: false };');
1151
+ $('#main-content').append('<div id="hyvor-talk-view"></div>');
1152
+ $('body').append('<script async id="hyvor-embed" type="text/javascript" src="//talk.hyvor.com/web-api/embed.js"></script>');
1153
+ }
1154
+ } // END comments
1155
+ } // END personalization
968
1156
 
969
1157
  // display page
970
1158
  $('#no_flicker').css('display', 'block');
971
1159
 
1160
+ // add recommended title to hyvor iframe for SEO optimization (if loadad)
1161
+ if (comment_provider === 'hyvor') {
1162
+ var dependencies_met_load_finished = setInterval (function () {
1163
+ if ($('#hyvor-talk-view').children().length) {
1164
+ $('#hyvor-talk-iframe').prop('title', 'Hyvor talk iframe');
1165
+ clearInterval(dependencies_met_load_finished);
1166
+ }
1167
+ }, 25);
1168
+ }
1169
+
972
1170
  // NOTE: Placed tracking warning/info here because page may reloaded
973
1171
  // after cookie consent selection
974
- //
975
- if (tracking_enabled && !tracking_id_valid) {
976
- logger.error('tracking enabled, but invalid tracking id found: ' + tracking_id);
1172
+ if (user_consent.analyses) {
1173
+ logger.info('\n' + 'tracking allowed, privacy settings for analysis: ' + user_consent.analyses);
1174
+ if (tracking_enabled && !tracking_id_valid) {
1175
+ logger.error('\n' + 'tracking enabled, but invalid tracking id found: ' + tracking_id);
1176
+ } else if (tracking_enabled && tracking_id_valid) {
1177
+ logger.warn('\n' + 'tracking enabled, tracking id found: ' + tracking_id);
1178
+ } else {
1179
+ logger.warn('\n' + 'tracking disabled, tracking id found: ' + tracking_id);
1180
+ }
977
1181
  } else {
978
- logger.warn('tracking enabled, tracking id found: ' + tracking_id);
1182
+ logger.warn('\n' + 'tracking not allowed, privacy settings for analysis: ' + user_consent.analyses);
979
1183
  }
980
1184
 
981
- logger.info('mode detected: web');
982
- logger.info('hide signin icon');
1185
+ logger.info('\n' + 'mode detected: web');
1186
+ logger.info('\n' + 'hide signin icon');
983
1187
  $('#quickLinksSignInOutButton').css('display', 'none');
984
1188
 
985
1189
  user_session.current_page = current_url.pathname;
1190
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
986
1191
  cookie_written = j1.writeCookie({
987
1192
  name: cookie_names.user_session,
988
1193
  data: user_session,
989
- samesite: 'Strict'
1194
+ samesite: 'Strict',
1195
+ secure: secure,
1196
+ expires: 0
990
1197
  });
991
1198
  if (!cookie_written) {
992
- logger.error('failed to write cookie: ' + cookie_names.user_session);
1199
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_session);
993
1200
  }
994
1201
 
995
1202
  // show|hide translator icon (currently NOT supported)
996
1203
  // if (translation_enabled) {
997
- // logger.info('translator detected: google');
998
- // logger.info('initialize language selector');
1204
+ // logger.info('\n' + 'translator detected: google');
1205
+ // logger.info('\n' + 'initialize language selector');
999
1206
  // $('.goog-te-combo').addClass('form-control');
1000
1207
  // }
1001
1208
 
@@ -1005,11 +1212,11 @@ var j1 = (function () {
1005
1212
  // show|hide cookie icon
1006
1213
  if (j1.existsCookie(cookie_names.user_consent)) {
1007
1214
  // Display cookie icon
1008
- logText = 'show cookie icon';
1215
+ logText = '\n' + 'show cookie icon';
1009
1216
  logger.info(logText);
1010
1217
  $('#quickLinksCookieButton').css('display', 'block');
1011
1218
  } else {
1012
- logText = 'hide cookie icon';
1219
+ logText = '\n' + 'hide cookie icon';
1013
1220
  logger.info(logText);
1014
1221
  // Display cookie icon
1015
1222
  $('#quickLinksCookieButton').css('display', 'none');
@@ -1020,25 +1227,25 @@ var j1 = (function () {
1020
1227
  j1.scrollTo();
1021
1228
 
1022
1229
  if (user_session.previous_page !== user_session.current_page) {
1023
- logText = 'page change detected';
1230
+ logText = '\n' + 'page change detected';
1024
1231
  logger.info(logText);
1025
- logText = 'previous page: ' + user_session.previous_page;
1232
+ logText = '\n' + 'previous page: ' + user_session.previous_page;
1026
1233
  logger.info(logText);
1027
- logText = 'current page: ' + user_session.current_page;
1234
+ logText = '\n' + 'current page: ' + user_session.current_page;
1028
1235
  logger.info(logText);
1029
1236
  }
1030
1237
 
1031
1238
  // update sidebar for changed theme data
1032
- logger.info('update sidebar');
1239
+ logger.info('\n' + 'update sidebar');
1033
1240
  user_state = j1.readCookie(cookie_names.user_state);
1034
1241
  current_user_data = j1.mergeData(user_session, user_state);
1035
1242
  j1.core.navigator.updateSidebar(current_user_data);
1036
1243
 
1037
1244
  // set|log status
1038
1245
  state = 'finished';
1039
- logText = 'state: ' + state;
1246
+ logText = '\n' + 'state: ' + state;
1040
1247
  logger.info(logText);
1041
- logText = 'page finalized successfully';
1248
+ logText = '\n' + 'page finalized successfully';
1042
1249
  logger.info(logText);
1043
1250
 
1044
1251
  }, flickerTimeout);
@@ -1146,7 +1353,7 @@ var j1 = (function () {
1146
1353
  $(window).scrollTop($(window).scrollTop()-1);
1147
1354
  } // END if anchor_id
1148
1355
  } else if (anchor_id === '#') {
1149
- logger.info('bound click event to "#", suppress default action');
1356
+ logger.info('\n' + 'bound click event to "#", suppress default action');
1150
1357
  $(window).scrollTop($(window).scrollTop()+1);
1151
1358
  $(window).scrollTop($(window).scrollTop()-1);
1152
1359
  return false;
@@ -1184,12 +1391,12 @@ var j1 = (function () {
1184
1391
  }, // END appDetected
1185
1392
 
1186
1393
  // -------------------------------------------------------------------------
1187
- // xhrData()
1188
- // Load data asychronously using XHR|jQuery on an HTML element (e.g. <div>)
1394
+ // loadHTML()
1395
+ // Load HTML data asychronously using XHR|jQuery on an element (e.g. <div>)
1189
1396
  // specified by xhr_container_id, xhr_data_path (options)
1190
1397
  // -------------------------------------------------------------------------
1191
- xhrData: function (options, mod, status) {
1192
- var logger = log4javascript.getLogger('j1.adapter.xhrData');
1398
+ loadHTML: function (options, mod, status) {
1399
+ var logger = log4javascript.getLogger('j1.adapter.loadHTML');
1193
1400
  var selector = $('#' + options.xhr_container_id);
1194
1401
  var state = status;
1195
1402
  var observer_options = {
@@ -1203,12 +1410,12 @@ var j1 = (function () {
1203
1410
 
1204
1411
  var cb_load_closure = function(mod, id) {
1205
1412
  return function (responseTxt, statusTxt, xhr) {
1206
- var logger = log4javascript.getLogger('j1.adapter.xhrData');
1413
+ var logger = log4javascript.getLogger('j1.adapter.loadHTML');
1207
1414
  if ( statusTxt === 'success' ) {
1208
1415
  j1.setXhrDataState(id, statusTxt);
1209
1416
  j1.setXhrDomState(id, 'pending');
1210
1417
 
1211
- logText = 'data loaded successfully on id: ' +id;
1418
+ logText = '\n' + 'data loaded successfully on id: ' +id;
1212
1419
  logger.info(logText);
1213
1420
  state = true;
1214
1421
  }
@@ -1216,12 +1423,12 @@ var j1 = (function () {
1216
1423
  // jadams, 2020-07-21: to be checked why id could be UNDEFINED
1217
1424
  if (typeof(id) != "undefined") {
1218
1425
  state = 'failed';
1219
- logger.info('set state for ' +mod+ ' to: ' + state);
1426
+ logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
1220
1427
  // jadams, 2020-07-21: intermediate state should DISABLED
1221
1428
  // executeFunctionByName(mod + '.setState', window, state);
1222
1429
  j1.setXhrDataState(id, statusTxt);
1223
1430
  j1.setXhrDomState(id, 'pending');
1224
- logText = 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
1431
+ logText = '\n' + 'loading data failed on id: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
1225
1432
  logger.error(logText);
1226
1433
  state = false;
1227
1434
  }
@@ -1242,9 +1449,9 @@ var j1 = (function () {
1242
1449
 
1243
1450
  // failsafe - prevent XHR load errors
1244
1451
  if (options.xhr_data_element !== '') {
1245
- logger.info('XHR data element found: ' + options.xhr_data_element);
1452
+ logger.info('\n' + 'XHR data element found: ' + options.xhr_data_element);
1246
1453
  } else {
1247
- logger.warn('no XHR data element found, loading data aborted');
1454
+ logger.warn('\n' + 'no XHR data element found, loading data aborted');
1248
1455
  return;
1249
1456
  }
1250
1457
 
@@ -1266,30 +1473,68 @@ var j1 = (function () {
1266
1473
  function mutationHandler (mutationRecords) {
1267
1474
  mutationRecords.forEach ( function (mutation) {
1268
1475
  if (mutation.addedNodes.length) {
1269
- logger.info('XHR data loaded in the DOM: ' + id);
1476
+ logger.info('\n' + 'XHR data loaded in the DOM: ' + id);
1270
1477
  j1.setXhrDomState(id, 'success');
1271
1478
  }
1272
1479
  });
1273
1480
  }
1274
1481
  } else {
1275
1482
  // jadams, 2020-07-21: To be clarified why a id is "undefined"
1276
-
1277
1483
  // failsafe - prevent XHR load errors
1278
1484
  if (id != '#undefined') {
1279
- logText = 'data not loaded on id:' + id;
1485
+ logText = '\n' + 'data not loaded on id:' + id;
1280
1486
  logger.warn(logText);
1281
1487
  j1.setXhrDataState(id, 'not loaded');
1282
1488
  j1.setXhrDomState(id, 'not loaded');
1283
1489
  // Set processing state to 'finished' to complete module load
1284
1490
  state = 'finished';
1285
- logger.info('state: ' + state);
1491
+ logger.info('\n' + 'state: ' + state);
1286
1492
  // jadams, 2020-07-21: intermediate state should DISABLED
1287
1493
  // executeFunctionByName(mod + '.setState', window, state);
1288
1494
  state = false;
1289
1495
  }
1290
1496
  }
1291
1497
  return state;
1292
- }, // END xhrData
1498
+ }, // END loadHTML
1499
+
1500
+ // -------------------------------------------------------------------------
1501
+ // loadJS()
1502
+ // Load JS data asychronously using jQuery (XHR)
1503
+ // -------------------------------------------------------------------------
1504
+ loadJS: function (options, mod, status) {
1505
+ var logger = log4javascript.getLogger('j1.adapter.loadJS');
1506
+ var state = status;
1507
+ var logText;
1508
+
1509
+ var cb_load_closure = function(mod, id) {
1510
+ return function (responseTxt, statusTxt, xhr) {
1511
+ var logger = log4javascript.getLogger('j1.adapter.loadJS');
1512
+ if ( statusTxt === 'success' ) {
1513
+ j1.setXhrDataState(id, statusTxt);
1514
+
1515
+ logText = '\n' + 'data loaded successfully for: ' +id;
1516
+ logger.info(logText);
1517
+ state = true;
1518
+ }
1519
+ if ( statusTxt === 'error' ) {
1520
+ state = 'failed';
1521
+ logger.info('\n' + 'set state for ' +mod+ ' to: ' + state);
1522
+ j1.setXhrDataState(id, statusTxt);
1523
+ logText = '\n' + 'loading data failed for: ' +id+ ', error ' + xhr.status + ': ' + xhr.statusText;
1524
+ logger.error(logText);
1525
+ state = false;
1526
+ }
1527
+ };
1528
+ };
1529
+
1530
+ $.ajax({
1531
+ url: options.xhr_data_path,
1532
+ dataType: 'script',
1533
+ success: cb_load_closure(mod, options.xhr_data_element)
1534
+ });
1535
+
1536
+ return state;
1537
+ }, // END loadJS
1293
1538
 
1294
1539
  // -------------------------------------------------------------------------
1295
1540
  // readCookie (Vanilla JS)
@@ -1323,6 +1568,14 @@ var j1 = (function () {
1323
1568
  // https://developer.mozilla.org/de/docs/Web/HTTP/Headers/Set-Cookie/SameSite
1324
1569
  // https://www.smarketer.de/blog/chrome-update-80-cookies/
1325
1570
  // -------------------------------------------------------------------------
1571
+ // SESSION Cookies:
1572
+ // NOT putting an EXPIRES part in will create a session cookie.
1573
+ // -------------------------------------------------------------------------
1574
+ // REMOVING Cookies: Cookies get removed immediately, if the expires
1575
+ // part points to a PAST date (e.g. 01 Jan 1970 00:00:00 UTC).
1576
+ // -------------------------------------------------------------------------
1577
+ // MAX-AGE Cookies: To leave cookies for a specific time, set the expires
1578
+ // part into a FUTUTE date. FOR GDPR compliance, MAX-AGE is 365 days.
1326
1579
  // TODO:
1327
1580
  // Change attribute "Secure" to true, if HTTPS is used.
1328
1581
  // Checks and config changes are to be done.
@@ -1339,86 +1592,27 @@ var j1 = (function () {
1339
1592
  // must now also specify the Secure attribute (they require a secure
1340
1593
  // context/HTTPS).
1341
1594
  // -------------------------------------------------------------------------
1342
- //
1343
- // writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
1344
- // var defaults = {
1345
- // data: {},
1346
- // name: '',
1347
- // path: '/',
1348
- // expires: 0,
1349
- // samesite: 'Lax',
1350
- // http_only: false,
1351
- // secure: false
1352
- // };
1353
- // var settings = $.extend(defaults, options);
1354
- // var date = new Date();
1355
- // var timestamp_now = date.toISOString();
1356
- // var cookie_data = {};
1357
- // var data_json;
1358
- // var data_encoded;
1359
- //
1360
- // if (j1.existsCookie(settings.name)) {
1361
- // cookie_data = j1.readCookie(settings.name);
1362
- // cookie_data.timestamp = timestamp_now;
1363
- // cookie_data = j1.mergeData(cookie_data, settings.data);
1364
- // data_json = JSON.stringify( cookie_data );
1365
- // data_encoded = window.btoa(data_json);
1366
- //
1367
- // if (settings.expires > 0) {
1368
- // Cookies.set(settings.name, data_encoded, {
1369
- // expires: settings.expires,
1370
- // SameSite: settings.samesite
1371
- // });
1372
- // } else {
1373
- // Cookies.set(settings.name, data_encoded, {
1374
- // SameSite: settings.samesite
1375
- // });
1376
- // }
1377
- // } else {
1378
- // cookie_data = settings.data;
1379
- // data_json = JSON.stringify(settings.data);
1380
- // data_encoded = window.btoa(data_json);
1381
- //
1382
- // if (settings.expires > 0) {
1383
- // Cookies.set(settings.name, data_encoded, {
1384
- // expires: settings.expires,
1385
- // SameSite: settings.samesite
1386
- // });
1387
- // } else {
1388
- // Cookies.set(settings.name, data_encoded, {
1389
- // SameSite: settings.samesite
1390
- // });
1391
- // }
1392
- // }
1393
- //
1394
- // if (j1.existsCookie(settings.name)) {
1395
- // return cookie_data;
1396
- // } else {
1397
- // return false;
1398
- // }
1399
- //
1400
- // }, // END writeCookie
1401
-
1595
+ writeCookie: function (options /*name, data, [path, expires, domain, samesite, http_only, secure]*/) {
1596
+ var date = new Date();
1597
+ var timestamp_now = date.toISOString();
1598
+ var cookie_data = {};
1599
+ var data_json;
1600
+ var data_encoded;
1601
+ var expires;
1602
+ var stringifiedAttributes = '';
1402
1603
 
1403
- writeCookie: function (options /*name, data, [path, expires, samesite, http_only, secure]*/) {
1404
1604
  var defaults = {
1405
1605
  data: {},
1406
1606
  name: '',
1407
1607
  path: '/',
1408
1608
  expires: 0,
1609
+ domain: 'localhost',
1409
1610
  samesite: 'Strict',
1410
1611
  http_only: false,
1411
1612
  secure: false
1412
1613
  };
1413
- var settings = $.extend(defaults, options);
1414
1614
 
1415
- var date = new Date();
1416
- var timestamp_now = date.toISOString();
1417
- var cookie_data = {};
1418
- var data_json;
1419
- var data_encoded;
1420
- var expires;
1421
- var stringifiedAttributes = '';
1615
+ var settings = $.extend(defaults, options);
1422
1616
 
1423
1617
  cookie_data.timestamp = timestamp_now;
1424
1618
 
@@ -1433,26 +1627,21 @@ var j1 = (function () {
1433
1627
  data_encoded = window.btoa(data_json);
1434
1628
  }
1435
1629
 
1436
- // if (settings.path !== '/') {
1437
- stringifiedAttributes += '; ' + 'path=' + settings.path;
1438
- // }
1630
+ stringifiedAttributes += '; ' + 'path=' + settings.path;
1439
1631
 
1440
1632
  if (settings.expires > 0) {
1441
- settings.expires = new Date(new Date() * 1 + settings.expires * 864e+5);
1442
- stringifiedAttributes += '; ' + 'expires=' + settings.expires;
1633
+ date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
1634
+ stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
1443
1635
  }
1444
1636
 
1445
- // if (settings.samesite !== 'Strict') {
1446
- stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
1447
- // }
1637
+ stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
1448
1638
 
1449
- // stringify cookie attributes
1450
1639
  if (settings.secure) {
1451
1640
  stringifiedAttributes += '; ' + 'secure=' + settings.secure;
1452
- // document.cookie = settings.name + '=' + content +'; path=' + settings.path + '; ' + 'SameSite=' + settings.samesite + '; secure';
1453
1641
  }
1454
1642
 
1455
1643
  // write the cookie
1644
+ // document.cookie = settings.name + '=' + content + '; path=' + settings.path + '; domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + '; secure';
1456
1645
  document.cookie = settings.name + '=' + data_encoded + stringifiedAttributes;
1457
1646
 
1458
1647
  if (j1.existsCookie(settings.name)) {
@@ -1482,21 +1671,17 @@ var j1 = (function () {
1482
1671
  // -------------------------------------------------------------------------
1483
1672
  // removeCookie (Vanilla JS)
1484
1673
  // -------------------------------------------------------------------------
1485
- // removeCookie: function (options /*name [, path]*/) {
1486
- // var cookieExists;
1487
- // var defaults = {
1488
- // name: '',
1489
- // path: '/'
1490
- // };
1491
- // var settings = $.extend(defaults, options);
1492
- //
1493
- // Cookies.remove(settings.name, { path: settings.path });
1494
- //
1495
- // }, // END removeCookie
1496
- removeCookie: function (name) {
1497
- if (j1.findCookie(name)) {
1498
- // clear cookie content and set expiry date in the past
1499
- document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
1674
+ removeCookie: function (options /*name, [path, domain]*/) {
1675
+ var cookieExists;
1676
+ var defaults = {
1677
+ domain: 'localhost',
1678
+ path: '/'
1679
+ };
1680
+ var settings = $.extend(defaults, options);
1681
+
1682
+ if (j1.findCookie(settings.name)) {
1683
+ // clear cookie CONTENT and set expiry date in the PAST
1684
+ document.cookie = settings.name + '=; domain=' + settings.domain + '; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
1500
1685
  return true;
1501
1686
  } else {
1502
1687
  return false;
@@ -1666,11 +1851,11 @@ var j1 = (function () {
1666
1851
  });
1667
1852
 
1668
1853
  });
1669
- logger.info('met dependencies for: sidebarLoaded');
1854
+ logger.info('\n' + 'met dependencies for: sidebarLoaded');
1670
1855
  clearInterval(sidebarLoaded);
1671
1856
  return true;
1672
1857
  } else {
1673
- logger.error('no user data provided');
1858
+ logger.error('\n' + 'no user data provided');
1674
1859
  clearInterval(sidebarLoaded);
1675
1860
  return false;
1676
1861
  }
@@ -1724,11 +1909,11 @@ var j1 = (function () {
1724
1909
  });
1725
1910
 
1726
1911
  });
1727
- logger.info('met dependencies for: sidebarLoaded');
1912
+ logger.info('\n' + 'met dependencies for: sidebarLoaded');
1728
1913
  clearInterval(sidebarLoaded);
1729
1914
  return true;
1730
1915
  } else {
1731
- logger.error('no user data provided');
1916
+ logger.error('\n' + 'no user data provided');
1732
1917
  clearInterval(sidebarLoaded);
1733
1918
  return false;
1734
1919
  }
@@ -1767,11 +1952,11 @@ var j1 = (function () {
1767
1952
  var json_message = JSON.stringify(message);
1768
1953
 
1769
1954
  if ( receiver === 'j1' ) {
1770
- logText = 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
1955
+ logText = '\n' + 'send message from ' + sender + ' to' + receiver + ': ' + json_message;
1771
1956
  logger.debug(logText);
1772
1957
  executeFunctionByName('j1' + '.messageHandler', window, sender, message);
1773
1958
  } else {
1774
- logText = 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
1959
+ logText = '\n' + 'send message from ' + sender + ' to ' + receiver + ': ' + json_message;
1775
1960
  logger.debug(logText);
1776
1961
  //executeFunctionByName('j1.' + receiver + '.messageHandler', window, sender, message)
1777
1962
  executeFunctionByName(receiver + '.messageHandler', window, sender, message);
@@ -1787,7 +1972,7 @@ var j1 = (function () {
1787
1972
  // var json_message = JSON.stringify(message, undefined, 2); // multiline
1788
1973
  var json_message = JSON.stringify(message);
1789
1974
 
1790
- logText = 'received message from ' + sender + ': ' + json_message;
1975
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
1791
1976
  logger.debug(logText);
1792
1977
 
1793
1978
  // -----------------------------------------------------------------------
@@ -1795,7 +1980,7 @@ var j1 = (function () {
1795
1980
  // -----------------------------------------------------------------------
1796
1981
  if ( message.type === 'command' && message.action === 'module_initialized' ) {
1797
1982
  _this.setState('finished');
1798
- logger.info(message.text);
1983
+ logger.info('\n' + message.text);
1799
1984
  }
1800
1985
 
1801
1986
  //
@@ -1858,7 +2043,7 @@ var j1 = (function () {
1858
2043
  var bg_primary = j1.getStyleValue('bg-primary', 'background-color');
1859
2044
  var bg_secondary = j1.getStyleValue('bg-secondary', 'background-color');
1860
2045
 
1861
- logger.info('set color scheme for selected theme');
2046
+ logger.info('\n' + 'set color scheme for selected theme');
1862
2047
 
1863
2048
  // globals
1864
2049
  // -----------------------------------------------------------------------