j1-template 2021.1.10 → 2021.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/content_generator_app.html +1 -1
  3. data/_includes/themes/j1/layouts/content_generator_blog_archive.html +1 -1
  4. data/_includes/themes/j1/layouts/content_generator_collection.html +1 -1
  5. data/_includes/themes/j1/layouts/content_generator_page.html +4 -1
  6. data/_includes/themes/j1/layouts/content_generator_post.html +1 -1
  7. data/_includes/themes/j1/layouts/content_generator_raw.html +1 -1
  8. data/_includes/themes/j1/layouts/layout_metadata_generator.html +55 -0
  9. data/_includes/themes/j1/modules/connectors/comment/commento.html +31 -0
  10. data/_includes/themes/j1/modules/connectors/comment/custom-provider.html +7 -8
  11. data/_includes/themes/j1/modules/connectors/comment/disqus.html +12 -54
  12. data/_includes/themes/j1/modules/connectors/comment/facebook.html +7 -8
  13. data/_includes/themes/j1/modules/connectors/comment/hyvor.html +33 -0
  14. data/_includes/themes/j1/modules/connectors/comment/just-comments.html +31 -0
  15. data/_includes/themes/j1/modules/connectors/comments +3 -0
  16. data/_layouts/default.html +51 -0
  17. data/assets/data/disqus.js +81 -0
  18. data/assets/data/hyvor.js +72 -0
  19. data/assets/error_pages/HTTP204.html +4 -0
  20. data/assets/error_pages/HTTP400.html +4 -0
  21. data/assets/error_pages/HTTP401.html +4 -0
  22. data/assets/error_pages/HTTP403.html +4 -0
  23. data/assets/error_pages/HTTP404.html +4 -0
  24. data/assets/error_pages/HTTP444.html +93 -0
  25. data/assets/error_pages/HTTP500.html +4 -0
  26. data/assets/error_pages/HTTP501.html +4 -0
  27. data/assets/error_pages/HTTP502.html +4 -0
  28. data/assets/error_pages/HTTP503.html +4 -0
  29. data/assets/themes/j1/adapter/js/algolia.js +10 -10
  30. data/assets/themes/j1/adapter/js/asciidoctor.js +6 -6
  31. data/assets/themes/j1/adapter/js/attic.js +17 -17
  32. data/assets/themes/j1/adapter/js/bmd.js +6 -6
  33. data/assets/themes/j1/adapter/js/carousel.js +10 -10
  34. data/assets/themes/j1/adapter/js/clipboard.js +10 -10
  35. data/assets/themes/j1/adapter/js/cookieConsent.js +60 -41
  36. data/assets/themes/j1/adapter/js/fam.js +34 -34
  37. data/assets/themes/j1/adapter/js/framer.js +6 -6
  38. data/assets/themes/j1/adapter/js/j1.js +537 -237
  39. data/assets/themes/j1/adapter/js/justifiedGallery.js +11 -11
  40. data/assets/themes/j1/adapter/js/justifiedGalleryCustomizer.js +19 -19
  41. data/assets/themes/j1/adapter/js/lightbox.js +6 -6
  42. data/assets/themes/j1/adapter/js/logger.js +7 -7
  43. data/assets/themes/j1/adapter/js/mmenu.js +25 -25
  44. data/assets/themes/j1/adapter/js/navigator.js +58 -48
  45. data/assets/themes/j1/adapter/js/quicksearch.js +6 -6
  46. data/assets/themes/j1/adapter/js/rouge.js +7 -7
  47. data/assets/themes/j1/adapter/js/rtable.js +6 -6
  48. data/assets/themes/j1/adapter/js/themer.js +149 -96
  49. data/assets/themes/j1/adapter/js/toccer.js +9 -9
  50. data/assets/themes/j1/core/js/template.js +24 -4
  51. data/assets/themes/j1/core/js/template.js.map +1 -1
  52. data/assets/themes/j1/core/js/template.min.js +24 -4
  53. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  54. data/assets/themes/j1/modules/backstretch/js/backstretch.js +3 -3
  55. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +35 -23
  56. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +2 -2
  57. data/assets/themes/j1/modules/lunrSearch/js/quicksearch.js +1 -1
  58. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +74 -55
  59. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +75 -57
  60. data/lib/j1/version.rb +1 -1
  61. data/lib/starter_web/Gemfile +1 -1
  62. data/lib/starter_web/_config.yml +42 -24
  63. data/lib/starter_web/_data/j1_config.yml +22 -11
  64. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +11 -9
  65. data/lib/starter_web/_data/modules/defaults/themer.yml +2 -0
  66. data/lib/starter_web/_data/resources.yml +0 -4
  67. data/lib/starter_web/_includes/attributes.asciidoc +1 -1
  68. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  69. data/lib/starter_web/assets/images/modules/attics/matthew-dockery-1920x1280.jpg +0 -0
  70. data/lib/starter_web/index.html +3 -3
  71. data/lib/starter_web/package.json +1 -1
  72. data/lib/starter_web/pages/public/asciidoc_skeletons/book/book.adoc +3 -0
  73. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +3 -0
  74. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +3 -0
  75. data/lib/starter_web/pages/public/blog/navigator/archive.html +4 -0
  76. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +4 -0
  77. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +4 -0
  78. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +5 -1
  79. data/lib/starter_web/pages/public/blog/navigator/index.html +4 -0
  80. data/lib/starter_web/pages/public/cookieConsent.adoc +3 -0
  81. data/lib/starter_web/pages/public/learn/quickstart.adoc +473 -0
  82. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +0 -1
  83. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -1
  84. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +0 -2
  85. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +0 -2
  86. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +0 -1
  87. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +0 -1
  88. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +0 -1
  89. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +0 -1
  90. data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +0 -1
  91. data/lib/starter_web/pages/public/learn/where_to_go.adoc +0 -1
  92. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -1
  93. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -1
  94. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +81 -20
  95. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +34 -16
  96. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  97. data/lib/starter_web/utilsrv/package.json +1 -1
  98. metadata +10 -8
  99. data/assets/themes/j1/adapter/js/themer.1.js +0 -326
  100. data/assets/themes/j1/modules/util/js/js.cookie.js +0 -163
  101. data/assets/themes/j1/modules/util/js/lite-url.js +0 -203
  102. data/assets/themes/j1/modules/util/js/lite-url.min.js +0 -7
  103. data/assets/themes/j1/modules/util/js/platform.js +0 -1260
  104. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.org.asciidoc +0 -244
@@ -210,8 +210,8 @@ j1.adapter['navigator'] = (function (j1, window) {
210
210
 
211
211
  // initialize state flag
212
212
  _this.setState('started');
213
- logger.info('state: ' + _this.getState());
214
- logger.info('module is being initialized');
213
+ logger.info('\n' + 'state: ' + _this.getState());
214
+ logger.info('\n' + 'module is being initialized');
215
215
 
216
216
  // -----------------------------------------------------------------------
217
217
  // defaults
@@ -249,6 +249,8 @@ j1.adapter['navigator'] = (function (j1, window) {
249
249
  var themes_count;
250
250
  var max_count = 100;
251
251
 
252
+ var gaCookies = j1.findCookie('_ga');
253
+ var j1Cookies = j1.findCookie('j1');
252
254
 
253
255
  navDefaults = $.extend({}, {{navigator_defaults | replace: '=>', ':' }});
254
256
  navBarConfig = $.extend({}, {{nav_bar_options | replace: '=>', ':' }});
@@ -299,19 +301,19 @@ j1.adapter['navigator'] = (function (j1, window) {
299
301
  // -----------------------------------------------------------------------
300
302
  // data loader
301
303
  // -----------------------------------------------------------------------
302
- j1.xhrData({
304
+ j1.loadHTML({
303
305
  xhr_container_id: navQuicklinksOptions.xhr_container_id,
304
306
  xhr_data_path: navQuicklinksOptions.xhr_data_path,
305
307
  xhr_data_element: navQuicklinksOptions.xhr_data_element },
306
308
  'j1.adapter.navigator',
307
309
  null);
308
- j1.xhrData({
310
+ j1.loadHTML({
309
311
  xhr_container_id: navAuthClientConfig.xhr_container_id,
310
312
  xhr_data_path: navAuthClientConfig.xhr_data_path,
311
313
  xhr_data_element: navAuthClientConfig.xhr_data_element },
312
314
  'j1.adapter.navigator',
313
315
  null);
314
- j1.xhrData({
316
+ j1.loadHTML({
315
317
  xhr_container_id: navMenuOptions.xhr_container_id,
316
318
  xhr_data_path: navMenuOptions.xhr_data_path,
317
319
  xhr_data_element: navMenuOptions.xhr_data_element },
@@ -322,37 +324,45 @@ j1.adapter['navigator'] = (function (j1, window) {
322
324
  if (j1.xhrDOMState['#'+navQuicklinksOptions.xhr_container_id] === 'success' &&
323
325
  j1.xhrDOMState['#'+navAuthClientConfig.xhr_container_id] === 'success' &&
324
326
  j1.xhrDOMState['#'+navMenuOptions.xhr_container_id] === 'success' ) {
325
- // continue if all AJAX loads (xhrData) has finished
327
+ // continue if all AJAX loads (loadHTML) has finished
326
328
  _this.setState('processing');
327
- logger.info('status: ' + _this.getState());
328
- logger.info('initialize navigator core');
329
+ logger.info('\n' + 'status: ' + _this.getState());
330
+ logger.info('\n' + 'initialize navigator core');
329
331
 
330
332
  // Detect|Set J1 App status
331
333
  appDetected = j1.appDetected();
332
334
  authClientEnabled = j1.authEnabled();
333
- logger.info('application status detected: ' + appDetected);
335
+ logger.info('\n' + 'application status detected: ' + appDetected);
334
336
 
335
337
  j1.core.navigator.init (_this.navDefaults, _this.navMenuOptions);
336
338
 
337
339
  // load themes (to menu) if themer is enabled|finished
338
340
  if (themerEnabled) {
339
- logText = 'theme switcher: enabled';
341
+ logText = '\n' + 'theme switcher: enabled';
340
342
  logger.info(logText);
341
343
 
342
- // Detect|Set J1 UserState
344
+ // detect j1 user state cookie
343
345
  user_state_detected = j1.existsCookie(cookie_user_state_name);
346
+
347
+
344
348
  if (user_state_detected) {
345
349
  user_state = j1.readCookie(cookie_user_state_name);
350
+ } else {
351
+ logger.error('\n' + 'cookie not found: j1.user.state');
352
+ logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
353
+ j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
354
+ logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
355
+ gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
346
356
  }
347
357
 
348
358
  // jadams, 2021-07-03: wait until navigator CORE get finished
349
359
  var dependencies_met_page_finished = setInterval(function() {
350
360
  if (j1.adapter.navigator.getState() == 'core_initialized') {
351
- logText = 'load themes';
361
+ logText = '\n' + 'load themes';
352
362
  logger.info(logText);
353
363
 
354
364
  // load LOCAL themes from JSON data
355
- logText = 'load local themes (json file)';
365
+ logText = '\n' + 'load local themes (json file)';
356
366
  logger.info(logText);
357
367
  $('#local_themes').bootstrapThemeSwitcher({
358
368
  localFeed: themerOptions.localThemes
@@ -375,16 +385,16 @@ j1.adapter['navigator'] = (function (j1, window) {
375
385
  interval_count += 1;
376
386
  themes_count = document.getElementById("remote_themes").getElementsByTagName("li").length;
377
387
  if ( themes_count > 0 ) {
378
- logger.info('remote themes loaded: successfully');
379
- logger.info('remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
388
+ logger.info('\n' + 'remote themes loaded: successfully');
389
+ logger.info('\n' + 'remote themes loaded: successfully after: ' + interval_count * 25 + ' ms');
380
390
 
381
391
  clearInterval(dependencies_met_remote_themes_loaded);
382
392
  } else {
383
- logger.debug('wait for theme to be loaded: ' + user_state.theme_name);
393
+ logger.debug('\n' + 'wait for theme to be loaded: ' + user_state.theme_name);
384
394
  }
385
395
  if (interval_count > max_count) {
386
- logger.warn('remote themes loading: failed');
387
- logger.warn('continue processing');
396
+ logger.warn('\n' + 'remote themes loading: failed');
397
+ logger.warn('\n' + 'continue processing');
388
398
  clearInterval(dependencies_met_remote_themes_loaded);
389
399
  }
390
400
  clearInterval(dependencies_met_page_finished);
@@ -393,7 +403,7 @@ j1.adapter['navigator'] = (function (j1, window) {
393
403
  _this.setState('initialized');
394
404
  }, 25); // END 'dependencies_met_page_finished'
395
405
  } else {
396
- logText = 'theme switcher detected as: disabled';
406
+ logText = '\n' + 'theme switcher detected as: disabled';
397
407
  logger.info(logText);
398
408
  }
399
409
 
@@ -407,39 +417,39 @@ j1.adapter['navigator'] = (function (j1, window) {
407
417
  _this.setState('processing');
408
418
 
409
419
  // set general|global theme colors
410
- logger.info('initializing dynamic CSS styles');
420
+ logger.info('\n' + 'initializing dynamic CSS styles');
411
421
  _this.setCSS (
412
422
  navDefaults, navBarOptions, navMenuOptions,
413
423
  navQuicklinksOptions, navTopsearchOptions
414
424
  );
415
425
 
416
- logger.info('init auth client');
426
+ logger.info('\n' + 'init auth client');
417
427
  _this.initAuthClient(_this.navAuthManagerConfig);
418
428
 
419
429
  _this.setState('finished');
420
- logger.info('state: ' + _this.getState());
421
- logger.info('module initialized successfully');
422
- logger.info('met dependencies for: j1');
430
+ logger.info('\n' + 'state: ' + _this.getState());
431
+ logger.info('\n' + 'module initialized successfully');
432
+ logger.info('\n' + 'met dependencies for: j1');
423
433
  clearInterval(dependencies_met_initialized);
424
434
  }
425
435
  } else {
426
436
  _this.setState('processing');
427
437
 
428
438
  // set general|global theme colors
429
- logger.info('apply dynamic CSS styles');
439
+ logger.info('\n' + 'apply dynamic CSS styles');
430
440
  _this.setCSS (
431
441
  navDefaults, navBarOptions, navMenuOptions,
432
442
  navQuicklinksOptions, navTopsearchOptions
433
443
  );
434
444
 
435
- logger.info('init auth client');
445
+ logger.info('\n' + 'init auth client');
436
446
  _this.initAuthClient(_this.navAuthManagerConfig);
437
447
  _this.setState('finished');
438
- logger.info('state: ' + _this.getState());
448
+ logger.info('\n' + 'state: ' + _this.getState());
439
449
  clearInterval(dependencies_met_initialized);
440
450
  }
441
451
  }, 25); // END 'dependencies_met_initialized'
442
- logger.info('met dependencies for: themer');
452
+ logger.info('\n' + 'met dependencies for: themer');
443
453
  clearInterval(dependencies_met_load_menu_finished);
444
454
  }
445
455
  }, 25); // END 'dependencies_met_load_menu_finished'
@@ -526,7 +536,7 @@ j1.adapter['navigator'] = (function (j1, window) {
526
536
  do: false
527
537
  };
528
538
 
529
- logText = 'initialize button click events';
539
+ logText = '\n' + 'initialize button click events';
530
540
  logger.info(logText);
531
541
 
532
542
  // Manage button click events for modal "signInOutButton"
@@ -556,7 +566,7 @@ j1.adapter['navigator'] = (function (j1, window) {
556
566
  e.stopPropagation();
557
567
  signOut.providerSignOut = $('input:checkbox[name="providerSignOut"]').is(':checked');
558
568
  if(environment === 'development') {
559
- logText = 'provider signout set to: ' + signOut.providerSignOut;
569
+ logText = '\n' + 'provider signout set to: ' + signOut.providerSignOut;
560
570
  logger.info(logText);
561
571
  }
562
572
  });
@@ -565,7 +575,7 @@ j1.adapter['navigator'] = (function (j1, window) {
565
575
  // -----------------------------------------------------------------------
566
576
  $('#modalOmniSignOut').on('show.bs.modal', function() {
567
577
  var modal = $(this);
568
- logger.info('place current user data');
578
+ logger.info('\n' + 'place current user data');
569
579
  user_session = j1.readCookie(cookie_user_session_name);
570
580
  modal.find('.user-info').text('You are signed in to provider: ' + user_session.provider);
571
581
  }); // END SHOW modalOmniSignOut
@@ -576,18 +586,18 @@ j1.adapter['navigator'] = (function (j1, window) {
576
586
  if (signIn.do == true) {
577
587
  provider = signIn.provider.toLowerCase();
578
588
  allowed_users = signIn.users.toString();
579
- logText = 'provider detected: ' + provider;
589
+ logText = '\n' + 'provider detected: ' + provider;
580
590
  logger.info(logText);
581
591
 
582
592
  var route = '/authentication?request=signin&provider=' +provider+ '&allowed_users=' +allowed_users;
583
- logText = 'call middleware for signin on route: ' + route;
593
+ logText = '\n' + 'call middleware for signin on route: ' + route;
584
594
  logger.info(logText);
585
595
  window.location.href = route;
586
596
  } else {
587
597
  provider = signIn.provider.toLowerCase();
588
- logText = 'provider detected: ' + provider;
598
+ logText = '\n' + 'provider detected: ' + provider;
589
599
  logger.info(logText);
590
- logText = 'login declined for provider: ' +provider;
600
+ logText = '\n' + 'login declined for provider: ' +provider;
591
601
  logger.info(logText);
592
602
  }
593
603
  }); // END post events "modalOmniSignIn"
@@ -596,31 +606,31 @@ j1.adapter['navigator'] = (function (j1, window) {
596
606
  // -----------------------------------------------------------------------
597
607
  $('#modalOmniSignOut').on('hidden.bs.modal', function() {
598
608
  if (signOut.do == true) {
599
- logger.info('load active provider from cookie: ' + cookie_user_session_name);
609
+ logger.info('\n' + 'load active provider from cookie: ' + cookie_user_session_name);
600
610
 
601
611
  user_session = j1.readCookie(cookie_user_session_name);
602
612
  provider = user_session.provider;
603
613
  provider_url = user_session.provider_site_url;
604
614
 
605
- logText = 'provider detected: ' + provider;
615
+ logText = '\n' + 'provider detected: ' + provider;
606
616
  logger.info(logText);
607
- logText = 'initiate signout for provider: ' +provider;
617
+ logText = '\n' + 'initiate signout for provider: ' +provider;
608
618
  logger.info(logText);
609
619
 
610
620
  var route = '/authentication?request=signout&provider=' + provider + '&provider_signout=' + signOut.providerSignOut; // + '/logout/';
611
- logText = 'call middleware on route : ' +route;
621
+ logText = '\n' + 'call middleware on route : ' +route;
612
622
  logger.info(logText);
613
623
  window.location.href = route;
614
624
  } else {
615
625
  provider = signOut.provider.toLowerCase();
616
- logText = 'provider detected: ' + provider;
626
+ logText = '\n' + 'provider detected: ' + provider;
617
627
  logger.info(logText);
618
- logText = 'signout declined for provider: ' +provider ;
628
+ logText = '\n' + 'signout declined for provider: ' +provider ;
619
629
  logger.info(logText);
620
630
  }
621
631
  }); // END post events "modalSignOut"
622
632
 
623
- logText = 'initialize button click events completed';
633
+ logText = '\n' + 'initialize button click events completed';
624
634
  logger.info(logText);
625
635
 
626
636
  return true;
@@ -637,7 +647,7 @@ j1.adapter['navigator'] = (function (j1, window) {
637
647
  var gridBreakpoint_sm = '576px';
638
648
  var navPrimaryColor = navDefaults.nav_primary_color;
639
649
 
640
- logger.info('set dynamic styles for the theme loaded');
650
+ logger.info('\n' + 'set dynamic styles for the theme loaded');
641
651
 
642
652
  // Set|Resolve navMenuOptions
643
653
  // ------------------------------------------------------------------------
@@ -781,7 +791,7 @@ j1.adapter['navigator'] = (function (j1, window) {
781
791
  var theElement = null;
782
792
  var theLastPosition = {x:0,y:0};
783
793
 
784
- logText ='entered delayShowMenu';
794
+ logText = '\n' + 'entered delayShowMenu';
785
795
  logger.info(logText);
786
796
 
787
797
  // $('#navigator_nav_menu')
@@ -830,10 +840,10 @@ j1.adapter['navigator'] = (function (j1, window) {
830
840
  var json_message = JSON.stringify(message);
831
841
  _this.setState(message.action);
832
842
 
833
- logText = 'received message from ' + sender + ': ' + json_message;
843
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
834
844
  logger.info(logText);
835
845
 
836
- logText = 'set state to: ' + message.action;
846
+ logText = '\n' + 'set state to: ' + message.action;
837
847
  logger.info(logText);
838
848
 
839
849
  // -----------------------------------------------------------------------
@@ -843,10 +853,10 @@ j1.adapter['navigator'] = (function (j1, window) {
843
853
  //
844
854
  // Place handling of command|action here
845
855
  //
846
- logger.info(message.text);
856
+ logger.info('\n' + message.text);
847
857
  }
848
858
  if (message.type === 'command' && message.action === 'status') {
849
- logger.info('messageHandler: received - ' + message.action);
859
+ logger.info('\n' + 'messageHandler: received - ' + message.action);
850
860
  }
851
861
 
852
862
  //
@@ -108,8 +108,8 @@ j1.adapter['quicksearch'] = (function (j1, window) {
108
108
 
109
109
  // initialize state flag
110
110
  _this.setState('started');
111
- logger.info('state: ' + _this.getState());
112
- logger.info('module is being initialized');
111
+ logger.info('\n' + 'state: ' + _this.getState());
112
+ logger.info('\n' + 'module is being initialized');
113
113
 
114
114
  // -----------------------------------------------------------------------
115
115
  // defaults
@@ -128,7 +128,7 @@ j1.adapter['quicksearch'] = (function (j1, window) {
128
128
  // -----------------------------------------------------------------------
129
129
  // lunr_search initializer
130
130
  // -----------------------------------------------------------------------
131
- var log_text = 'module is being initialized';
131
+ var log_text = '\n' + 'module is being initialized';
132
132
  logger.info(log_text);
133
133
 
134
134
  var dependencies_met_j1_finished = setInterval(function() {
@@ -143,7 +143,7 @@ j1.adapter['quicksearch'] = (function (j1, window) {
143
143
  });
144
144
 
145
145
  _this.setState('finished');
146
- logger.info('state: ' + _this.getState());
146
+ logger.info('\n' + 'state: ' + _this.getState());
147
147
 
148
148
  clearInterval(dependencies_met_j1_finished);
149
149
  } // END dependencies_met_j1_finished
@@ -172,7 +172,7 @@ j1.adapter['quicksearch'] = (function (j1, window) {
172
172
  messageHandler: function (sender, message) {
173
173
  var json_message = JSON.stringify(message, undefined, 2);
174
174
 
175
- logText = 'received message from ' + sender + ': ' + json_message;
175
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
176
176
  logger.debug(logText);
177
177
 
178
178
  // -----------------------------------------------------------------------
@@ -182,7 +182,7 @@ j1.adapter['quicksearch'] = (function (j1, window) {
182
182
  //
183
183
  // Place handling of command|action here
184
184
  //
185
- logger.info(message.text);
185
+ logger.info('\n' + message.text);
186
186
  }
187
187
 
188
188
  //
@@ -111,8 +111,8 @@ j1.adapter['rouge'] = (function (j1, window) {
111
111
 
112
112
  // initialize state flag
113
113
  _this.setState('started');
114
- logger.info('state: ' + _this.getState());
115
- logger.info('module is being initialized');
114
+ logger.info('\n' + 'state: ' + _this.getState());
115
+ logger.info('\n' + 'module is being initialized');
116
116
 
117
117
  // -----------------------------------------------------------------------
118
118
  // Default module settings
@@ -125,7 +125,7 @@ j1.adapter['rouge'] = (function (j1, window) {
125
125
  // -----------------------------------------------------------------------
126
126
  // rouge initializer
127
127
  // -----------------------------------------------------------------------
128
- var log_text = 'Rouge is being initialized';
128
+ var log_text = '\n' + 'module is being initialized';
129
129
  logger.info(log_text);
130
130
 
131
131
  // Detect|Set J1 UserState
@@ -139,7 +139,7 @@ j1.adapter['rouge'] = (function (j1, window) {
139
139
  themeCss.includes('slate') ||
140
140
  themeCss.includes('superhero');
141
141
  } else {
142
- log_text = 'user_state cookie not found';
142
+ log_text = '\n' + 'user_state cookie not found';
143
143
  logger.warn(log_text);
144
144
  }
145
145
 
@@ -149,7 +149,7 @@ j1.adapter['rouge'] = (function (j1, window) {
149
149
  $('#selected').html("Current Selection: <div class='bg-primary mt-1 p-2'>"+$(this).text()+"</div>");
150
150
  });
151
151
  _this.setState('finished');
152
- logger.info('state: ' + _this.getState());
152
+ logger.info('\n' + 'state: ' + _this.getState());
153
153
  clearInterval(dependencies_met_j1_finished);
154
154
  } // END dependencies_met_j1_finished
155
155
  }, 25);
@@ -200,7 +200,7 @@ j1.adapter['rouge'] = (function (j1, window) {
200
200
  messageHandler: function (sender, message) {
201
201
  var json_message = JSON.stringify(message, undefined, 2);
202
202
 
203
- logText = 'received message from ' + sender + ': ' + json_message;
203
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
204
204
  logger.debug(logText);
205
205
 
206
206
  // -----------------------------------------------------------------------
@@ -210,7 +210,7 @@ j1.adapter['rouge'] = (function (j1, window) {
210
210
  //
211
211
  // Place handling of command|action here
212
212
  //
213
- logger.info(message.text);
213
+ logger.info('\n' + message.text);
214
214
  }
215
215
 
216
216
  //
@@ -79,8 +79,8 @@ j1.adapter['rtable'] = (function (j1, window) {
79
79
 
80
80
  // initialize state flag
81
81
  _this.setState('started');
82
- logger.info('state: ' + _this.getState());
83
- logger.info('module is being initialized');
82
+ logger.info('\n' + 'state: ' + _this.getState());
83
+ logger.info('\n' + 'module is being initialized');
84
84
 
85
85
  // -----------------------------------------------------------------------
86
86
  // Default module settings
@@ -93,7 +93,7 @@ j1.adapter['rtable'] = (function (j1, window) {
93
93
  // -----------------------------------------------------------------------
94
94
  // rtable initializer
95
95
  // -----------------------------------------------------------------------
96
- var log_text = 'rtable is being initialized';
96
+ var log_text = '\n' + 'rtable is being initialized';
97
97
  logger.info(log_text);
98
98
 
99
99
  // Add data attribute for tablesaw to all tables of a page
@@ -120,7 +120,7 @@ j1.adapter['rtable'] = (function (j1, window) {
120
120
  Tablesaw.init();
121
121
 
122
122
  _this.setState('finished');
123
- logger.info('state: ' + _this.getState());
123
+ logger.info('\n' + 'state: ' + _this.getState());
124
124
 
125
125
  clearInterval(dependencies_met_j1_finished);
126
126
  } // END dependencies_met_j1_finished
@@ -135,7 +135,7 @@ j1.adapter['rtable'] = (function (j1, window) {
135
135
  messageHandler: function (sender, message) {
136
136
  var json_message = JSON.stringify(message, undefined, 2);
137
137
 
138
- logText = 'received message from ' + sender + ': ' + json_message;
138
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
139
139
  logger.debug(logText);
140
140
 
141
141
  // -----------------------------------------------------------------------
@@ -145,7 +145,7 @@ j1.adapter['rtable'] = (function (j1, window) {
145
145
  //
146
146
  // Place handling of command|action here
147
147
  //
148
- logger.info(message.text);
148
+ logger.info('\n' + message.text);
149
149
  }
150
150
 
151
151
  //
@@ -103,6 +103,8 @@ j1.adapter['themer'] = (function (j1, window) {
103
103
  // ---------------------------------------------------------------------------
104
104
  var environment = '{{environment}}';
105
105
  var themerOptions = $.extend({}, {{themer_options | replace: '=>', ':' | replace: 'nil', '""' }});
106
+ var url = new liteURL(window.location.href);
107
+ var secure = (url.protocol.includes('https')) ? true : false;
106
108
  var user_state = {};
107
109
  var user_consent = {};
108
110
  var cookie_names = j1.getCookieNames();
@@ -114,6 +116,7 @@ j1.adapter['themer'] = (function (j1, window) {
114
116
  var _this;
115
117
  var logger;
116
118
  var logText;
119
+ var cookie_written;
117
120
 
118
121
  var cssExtension = (environment === 'production')
119
122
  ? '.min.css'
@@ -125,6 +128,16 @@ j1.adapter['themer'] = (function (j1, window) {
125
128
  var default_theme_css_name = default_theme_name.toLowerCase().replace(' ', '-');
126
129
  var default_theme_css = '{{asset_path}}/{{theme_base}}/' + default_theme_css_name + '/bootstrap' + cssExtension;
127
130
 
131
+ var interval_count = 0;
132
+ var max_count = themerOptions.retries;
133
+
134
+ var j1Cookies;
135
+ var gaCookies;
136
+
137
+ var url;
138
+ var baseUrl;
139
+ var error_page;
140
+
128
141
  // ---------------------------------------------------------------------------
129
142
  // helper functions
130
143
  // ---------------------------------------------------------------------------
@@ -152,105 +165,145 @@ j1.adapter['themer'] = (function (j1, window) {
152
165
  // -----------------------------------------------------------------------
153
166
  // globals
154
167
  // -----------------------------------------------------------------------
155
- _this = j1.adapter.themer;
156
- logger = log4javascript.getLogger('j1.adapter.themer');
168
+ _this = j1.adapter.themer;
169
+ url = new liteURL(window.location.href);
170
+ baseUrl = url.origin;
171
+ error_page = url.origin + '/204.html';
172
+ j1Cookies = j1.findCookie('j1');
173
+ gaCookies = j1.findCookie('_ga');
174
+ logger = log4javascript.getLogger('j1.adapter.themer');
157
175
 
158
176
  // initialize state flag
159
177
  _this.state = 'started';
160
- logger.info('state: ' + _this.getState());
161
-
162
- // detect|set user state cookie
163
- user_state_detected = j1.existsCookie(cookie_names.user_state);
164
- if (user_state_detected) {
165
- user_state = j1.readCookie(cookie_names.user_state);
166
- user_consent = j1.readCookie(cookie_names.user_consent);
167
- }
168
-
169
- // initial theme data
170
- if (user_state.theme_css === '') {
171
- user_state.theme_name = default_theme_name;
172
- user_state.theme_css = default_theme_css;
173
- user_state.theme_author = default_theme_author;
174
- user_state.theme_author_url = default_theme_author_url;
175
- }
176
-
177
- styleLoaded = styleSheetLoaded(user_state.theme_css);
178
- theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
179
-
180
- // skip loading theme UNO css file except NOT loaded
181
- if (!user_state.theme_name.includes('Uno') || !styleLoaded) {
182
- $('head').append(theme_css_html);
183
- }
184
-
185
- // store if theme_switcher is enabled
186
- user_state.theme_switcher = themerOptions.enabled;
187
-
188
- if (!user_consent.analyses || !user_consent.personalization) {
189
- // expire state cookie to session
190
- j1.writeCookie({
191
- name: cookie_names.user_state,
192
- data: user_state,
193
- samesite: 'Strict'
194
- });
195
- } else {
196
- j1.writeCookie({
197
- name: cookie_names.user_state,
198
- data: user_state,
199
- samesite: 'Strict',
200
- expires: 365
201
- });
202
- }
178
+ logger.info('\n' + 'state: ' + _this.getState());
179
+
180
+ // jadams, 2021-07-11: added dependecy on the user state cookie
181
+ // Found timing issues testing mobile devices (iPad)
182
+ var dependencies_met_user_state_available = setInterval (function () {
183
+ user_state_detected = j1.existsCookie(cookie_names.user_state);
184
+
185
+ // counter how often the check should be done for the existence
186
+ // of the user state cookie
187
+ interval_count += 1;
188
+ if (user_state_detected) {
189
+ user_state = j1.readCookie(cookie_names.user_state);
190
+ user_consent = j1.readCookie(cookie_names.user_consent);
191
+
192
+ logger.info('\n' + 'cookie ' + cookie_names.user_state + ' successfully loaded after: ' + interval_count * 25 + ' ms');
193
+
194
+ // initial theme data
195
+ if (user_state.theme_css === '') {
196
+ user_state.theme_name = default_theme_name;
197
+ user_state.theme_css = default_theme_css;
198
+ user_state.theme_author = default_theme_author;
199
+ user_state.theme_author_url = default_theme_author_url;
200
+ }
201
+
202
+ styleLoaded = styleSheetLoaded(user_state.theme_css);
203
+ theme_css_html = '<link rel="stylesheet" id="' + id + '" href="' + user_state.theme_css + '" type="text/css" />';
204
+
205
+ // check cookie consistency
206
+ if (Object.keys(user_state).length > 2) {
207
+ // loading theme CSS file except on UNO
208
+ if (!user_state.theme_name.includes('Uno') || !styleLoaded) {
209
+ $('head').append(theme_css_html);
210
+ }
211
+ } else {
212
+ logger.fatal('\n' + 'inconsistent state detected for cookie: ' + cookie_names.user_state);
213
+ }
214
+
215
+ // set the theme switcher state
216
+ user_state.theme_switcher = themerOptions.enabled;
217
+
218
+ // jadams, 2021-07-11: unclear why the cookie consent is checked here
219
+ if (!user_consent.analyses || !user_consent.personalization) {
220
+ // expire state cookie to session
221
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
222
+ cookie_written = j1.writeCookie({
223
+ name: cookie_names.user_state,
224
+ data: user_state,
225
+ samesite: 'Strict',
226
+ secure: secure,
227
+ expires: 0
228
+ });
229
+ if (!cookie_written) {
230
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
231
+ }
232
+ } else {
233
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_state);
234
+ cookie_written = j1.writeCookie({
235
+ name: cookie_names.user_state,
236
+ data: user_state,
237
+ samesite: 'Strict',
238
+ secure: secure,
239
+ expires: 365
240
+ });
241
+ if (!cookie_written) {
242
+ logger.error('\n' + 'failed to write cookie: ' + cookie_names.user_state);
243
+ }
244
+ }
245
+
246
+ if (themerOptions.enabled) {
247
+ // enable BS ThemeSwitcher
248
+ logger.info('\n' + 'themes detected as: enabled');
249
+ logger.info('\n' + 'theme is being initialized: ' + user_state.theme_name);
250
+
251
+ /* eslint-disable */
252
+ // load list of remote themes
253
+ $('#remote_themes').bootstrapThemeSwitcher.defaults = {
254
+ debug: themerOptions.debug,
255
+ saveToCookie: themerOptions.saveToCookie,
256
+ cssThemeLink: themerOptions.cssThemeLink,
257
+ cookieThemeName: themerOptions.cookieThemeName,
258
+ cookieDefaultThemeName: themerOptions.cookieDefaultThemeName,
259
+ cookieThemeCss: themerOptions.cookieThemeCss,
260
+ cookieThemeExtensionCss: themerOptions.cookieThemeExtensionCss,
261
+ cookieExpiration: themerOptions.cookieExpiration,
262
+ cookiePath: themerOptions.cookiePath,
263
+ defaultCssFile: themerOptions.defaultCssFile,
264
+ bootswatchApiUrl: themerOptions.bootswatchApiUrl,
265
+ bootswatchApiVersion: themerOptions.bootswatchApiVersion,
266
+ loadFromBootswatch: themerOptions.loadFromBootswatch,
267
+ localFeed: themerOptions.localThemes,
268
+ excludeBootswatch: themerOptions.excludeBootswatch,
269
+ includeBootswatch: themerOptions.includeBootswatch,
270
+ skipIncludeBootswatch: themerOptions.skipIncludeBootswatch
271
+ };
272
+ /* eslint-enable */
273
+
274
+ logger.info('\n' + 'theme loaded: ' + user_state.theme_name);
275
+ logger.info('\n' + 'theme css file: ' + user_state.theme_css);
276
+ _this.setState('finished');
277
+ logger.info('\n' + 'state: ' + _this.getState());
278
+ logger.info('\n' + 'module initialized successfully');
279
+ } else {
280
+ _this.setState('finished');
281
+ logger.info('\n' + 'state: ' + _this.getState());
282
+ logger.info('\n' + 'themes detected as: disabled');
283
+ }
284
+ clearInterval(dependencies_met_user_state_available);
285
+ }
203
286
 
204
- var dependencies_met_j1_finished = setInterval (function () {
205
- // jadams, 2021-01-03: dependency has to be checked in more detail
206
- // if (j1.getState() == 'finished') {
207
- if (true) {
208
- if (themerOptions.enabled) {
209
- // enable BS ThemeSwitcher
210
- logger.info('themes detected as: enabled');
211
- logger.info('theme is being initialized: ' + user_state.theme_name);
212
-
213
- // load list of remote themes
214
- //
215
- if ($('#remote_themes').length) {
216
- /* eslint-disable */
217
- // initialize Bootswatch Theme Switcher
218
- $('#remote_themes').bootstrapThemeSwitcher.defaults = {
219
- debug: themerOptions.debug,
220
- saveToCookie: themerOptions.saveToCookie,
221
- cssThemeLink: themerOptions.cssThemeLink,
222
- cookieThemeName: themerOptions.cookieThemeName,
223
- cookieDefaultThemeName: themerOptions.cookieDefaultThemeName,
224
- cookieThemeCss: themerOptions.cookieThemeCss,
225
- cookieThemeExtensionCss: themerOptions.cookieThemeExtensionCss,
226
- cookieExpiration: themerOptions.cookieExpiration,
227
- cookiePath: themerOptions.cookiePath,
228
- defaultCssFile: themerOptions.defaultCssFile,
229
- bootswatchApiUrl: themerOptions.bootswatchApiUrl,
230
- bootswatchApiVersion: themerOptions.bootswatchApiVersion,
231
- loadFromBootswatch: themerOptions.loadFromBootswatch,
232
- localFeed: themerOptions.localThemes,
233
- excludeBootswatch: themerOptions.excludeBootswatch,
234
- includeBootswatch: themerOptions.includeBootswatch,
235
- skipIncludeBootswatch: themerOptions.skipIncludeBootswatch
236
- }
237
- /* eslint-enable */
238
-
239
- logger.info('theme loaded: ' + user_state.theme_name);
240
- logger.info('theme css file: ' + user_state.theme_css);
241
- _this.setState('finished');
242
- logger.info('state: ' + _this.getState());
243
- logger.info('module initialized successfully');
244
- logger.info('met dependencies for: j1.adapter');
245
- }
246
- } else {
247
- _this.setState('finished');
248
- logger.info('state: ' + _this.getState());
249
- logger.info('themes detected as: disabled');
250
- }
251
- clearInterval(dependencies_met_j1_finished);
287
+ if (interval_count > max_count) {
288
+ logger.error('\n' + 'interval max count reached: ' + max_count);
289
+ logger.error('\n' + 'check failed after: ' + max_count * 25 + ' ms');
290
+ logger.error('\n' + 'loading cookie failed: ' + cookie_names.user_state);
291
+
292
+ logger.debug('\n' + 'j1 cookies found:' + j1Cookies.length);
293
+ j1Cookies.forEach(item => console.log('j1.core.switcher: ' + item));
294
+ logger.debug('\n' + 'ga cookies found:' + gaCookies.length);
295
+ gaCookies.forEach(item => console.log('j1.core.switcher: ' + item));
296
+
297
+ // jadams, 2021-07-15: redirect to homepage
298
+ // NOTE: UNCLEAR why it is needed to create the user state
299
+ // cookie THIS way
300
+ //
301
+ logger.warn('\n' + 'redirect to home page');
302
+ // window.location.href = error_page;
303
+ window.location.href = '/';
304
+ clearInterval(dependencies_met_user_state_available);
252
305
  }
253
- }, 25); // END 'dependencies_met_j1_finished'
306
+ }, 25); // END dependencies_met_user_state_available
254
307
  }, // END init
255
308
 
256
309
  // -------------------------------------------------------------------------
@@ -260,14 +313,14 @@ j1.adapter['themer'] = (function (j1, window) {
260
313
  messageHandler: function (sender, message) {
261
314
  var json_message = JSON.stringify(message, undefined, 2);
262
315
 
263
- logText = 'received message from ' + sender + ': ' + json_message;
316
+ logText = '\n' + 'received message from ' + sender + ': ' + json_message;
264
317
  logger.info(logText);
265
318
 
266
319
  // -----------------------------------------------------------------------
267
320
  // Process commands|actions
268
321
  // -----------------------------------------------------------------------
269
322
  if (message.type === 'command' && message.action === 'module_initialized') {
270
- logger.info(message.text);
323
+ logger.info('\n' + message.text);
271
324
  //
272
325
  // Place handling of other command|action here
273
326
  //