j1-template 2023.0.7 → 2023.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/procedures/layouts/module_writer.proc +1 -1
  3. data/_includes/themes/j1/procedures/posts/collate_timeline.proc +1 -1
  4. data/assets/data/banner.html +2 -2
  5. data/assets/data/panel.html +4 -4
  6. data/assets/error_pages/HTTP204.html +23 -4
  7. data/assets/error_pages/HTTP400.html +2 -2
  8. data/assets/error_pages/HTTP401.html +2 -2
  9. data/assets/error_pages/HTTP403.html +2 -2
  10. data/assets/error_pages/HTTP404.html +2 -2
  11. data/assets/error_pages/HTTP444.html +2 -2
  12. data/assets/error_pages/HTTP445.html +2 -2
  13. data/assets/error_pages/HTTP446.html +2 -2
  14. data/assets/error_pages/HTTP447.html +2 -2
  15. data/assets/error_pages/HTTP448.html +2 -2
  16. data/assets/error_pages/HTTP500.html +2 -2
  17. data/assets/error_pages/HTTP501.html +2 -2
  18. data/assets/error_pages/HTTP502.html +2 -2
  19. data/assets/error_pages/HTTP503.html +2 -2
  20. data/assets/themes/j1/adapter/js/attic.js +36 -4
  21. data/assets/themes/j1/adapter/js/j1.js +293 -253
  22. data/assets/themes/j1/adapter/js/masterslider.js +16 -15
  23. data/assets/themes/j1/adapter/js/scroller.js +11 -4
  24. data/assets/themes/j1/adapter/js/themer.js +5 -1
  25. data/assets/themes/j1/adapter/js/waves.js +15 -6
  26. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +75 -3
  27. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  28. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +55 -8
  29. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  30. data/lib/j1/version.rb +1 -1
  31. data/lib/starter_web/Gemfile +1 -1
  32. data/lib/starter_web/README.md +5 -5
  33. data/lib/starter_web/_config.yml +3 -3
  34. data/lib/starter_web/_data/blocks/panel.yml +9 -9
  35. data/lib/starter_web/_data/j1_config.yml +10 -2
  36. data/lib/starter_web/_data/layouts/home.yml +1 -1
  37. data/lib/starter_web/_data/modules/attics.yml +17 -14
  38. data/lib/starter_web/_data/modules/defaults/attics.yml +18 -11
  39. data/lib/starter_web/_data/modules/defaults/blog_navigator.yml +44 -44
  40. data/lib/starter_web/_data/modules/defaults/navigator.yml +2 -0
  41. data/lib/starter_web/_data/modules/defaults/waves.yml +1 -1
  42. data/lib/starter_web/_data/resources.yml +145 -146
  43. data/lib/starter_web/_data/templates/feed.xml +1 -1
  44. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  45. data/lib/starter_web/assets/images/modules/attics/1920x1280/clem-onojeghuo.jpg +0 -0
  46. data/lib/starter_web/assets/images/modules/attics/themes-1920x1280-bw.jpg +0 -0
  47. data/lib/starter_web/package.json +1 -1
  48. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  49. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
  50. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
  51. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
  52. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
  53. data/lib/starter_web/pages/public/learn/roundtrip/present_images.adoc +7 -0
  54. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +5 -6
  55. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  56. data/lib/starter_web/utilsrv/package.json +1 -1
  57. metadata +4 -2
@@ -162,6 +162,11 @@ var j1 = (function (options) {
162
162
  var checkCookies = {{cookie_options.checkCookies}};
163
163
  var expireCookiesOnRequiredOnly = ('{{cookie_options.expireCookiesOnRequiredOnly}}' === 'true') ? true: false;
164
164
 
165
+ // animation on page load
166
+ var bodyAnimation = ('{{template_config.body.animation}}' === 'true') ? true: false;
167
+ var bodyAnimationType = '{{template_config.body.animation_type}}';
168
+ var bodyAnimationDuration = '{{template_config.body.animation_duration}}';
169
+
165
170
  // defaults for dynamic pages
166
171
  var timeoutScrollDynamicPages = '{{template_config.timeoutScrollDynamicPages}}';
167
172
  var scrollDynamicPagesTopOnChange = '{{template_config.scrollDynamicPagesTopOnChange}}';
@@ -171,8 +176,8 @@ var j1 = (function (options) {
171
176
  var pageHeight;
172
177
  var pageBaseHeight; // height of a page dynamic detected in ResizeObserver
173
178
 
174
- var growthRatio = 100;
175
- var previousGrowthRatio = 100;
179
+ var growthRatio = 0.00;
180
+ var previousGrowthRatio = 0.00;
176
181
  var previousPageHeight;
177
182
  var documentHeight;
178
183
 
@@ -388,7 +393,12 @@ var j1 = (function (options) {
388
393
  }
389
394
  }
390
395
 
391
- j1.registerEvents(logger);
396
+ var dependencies_met_page_loaded = setInterval (function () {
397
+ if (j1.getState() == 'finished') {
398
+ j1.registerEvents(logger);
399
+ }
400
+ clearInterval(dependencies_met_page_loaded);
401
+ }, 25); // END dependencies_met_page_loaded
392
402
 
393
403
  // detect middleware (mode 'app') and update user session cookie
394
404
  // -----------------------------------------------------------------------
@@ -547,15 +557,14 @@ var j1 = (function (options) {
547
557
  // -----------------------------------------------------------------------
548
558
  // additional BS helpers from j1.core
549
559
  // -----------------------------------------------------------------------
560
+
550
561
  j1.core.bsFormClearButton();
551
562
 
552
563
  // finalize and display current page
553
564
  j1.displayPage();
554
565
 
555
566
  // scroll to an anchor in current page if given in URL
556
- setTimeout (function() {
557
- j1.scrollToAnchor();
558
- }, timeoutScrollDynamicPages);
567
+ j1.scrollToAnchor();
559
568
  },
560
569
 
561
570
  // -------------------------------------------------------------------------
@@ -921,119 +930,28 @@ var j1 = (function (options) {
921
930
  }
922
931
  }
923
932
 
924
- // show the page delayed
925
- setTimeout (function() {
926
- // display page
927
- $('#no_flicker').css('display', 'block');
928
-
929
- // jadams, 2021-12-06: Check if access to cookies for this site failed.
930
- // Possibly, a third-party domain or an attacker tries to access it.
931
- if (checkCookies) {
932
- var j1Cookies = j1.findCookie('j1');
933
- if (!j1.existsCookie(cookie_names.user_state)) {
934
- logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
935
- logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
936
- // redirect to error page: blocked content
937
- window.location.href = '/446.html';
938
- } else {
939
- logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
940
- }
941
- }
942
-
943
- // manage Dropcaps if translation is enabled|disabled
944
- // -----------------------------------------------------------------
945
- if (user_translate.translationEnabled) {
946
- logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
947
- logger.debug('\n' + 'skipped processing of dropcaps');
948
- } else {
949
- // initialize dropcaps
950
- logger.info('\n' + 'post processing: createDropCap');
951
- j1.core.createDropCap();
952
- }
953
-
954
- // TODO: should MOVED to Cookiebar ???
955
- // show|hide cookie icon
956
- if (j1.existsCookie(cookie_names.user_consent)) {
957
- // Display cookie icon
958
- logText = '\n' + 'show cookie icon';
959
- logger.info(logText);
960
- $('#quickLinksCookieButton').css('display', 'block');
961
- } else {
962
- logText = '\n' + 'hide cookie icon';
963
- logger.info(logText);
964
- // Display cookie icon
965
- $('#quickLinksCookieButton').css('display', 'none');
966
- }
967
-
968
- // TODO: should MOVED to ControlCenter Adapter ???
969
- // -----------------------------------------------------------------
970
- // show cc icon (currently NOT supported)
971
- // $('#quickLinksControlCenterButton').css('display', 'block');
972
-
973
- if (j1.authEnabled()) {
974
- if (user_session.authenticated === 'true') {
975
- // set signout
976
- logger.info('\n' + 'show signout icon');
977
- $('#navLinkSignInOut').attr('data-bs-target','#modalOmniSignOut');
978
- $('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
979
- } else {
980
- // set signin
981
- logger.info('\n' + 'show signin icon');
982
- $('#navLinkSignInOut').attr('data-bs-target','#modalOmniSignIn');
983
- $('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
984
- }
985
- logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
986
- $('#quickLinksSignInOutButton').css('display', 'block');
987
- }
988
-
989
- // TODO: should MOVED to Themer ???
990
- // jadams, 2021-07-25: hide|show themes menu on cookie consent
991
- // (analysis|personalization) settings. BootSwatch is a 3rd party
992
- // is using e.g GA. Because NO control is possible on 3rd parties,
993
- // for GDPR compliance, themes feature may disabled on
994
- // privacy settings
995
- if (!user_consent.personalization) {
996
- logger.debug('\n' + 'disable themes feature because of privacy settings');
997
- logger.debug('\n' + 'personalization not allowed, privacy settings for personalization: ' + user_consent.personalization);
998
- $("#themes_menu").hide();
999
- } else {
1000
- $("#themes_menu").show();
1001
- }
1002
-
1003
- // detect if a loaded page has been chenged
1004
- if (user_session.previous_page !== user_session.current_page) {
1005
- logText = '\n' + 'page change detected';
1006
- logger.info(logText);
1007
- logText = '\n' + 'previous page: ' + user_session.previous_page;
1008
- logger.info(logText);
1009
- logText = '\n' + 'current page: ' + user_session.current_page;
1010
- logger.info(logText);
1011
- }
1012
-
1013
- // update sidebar for changed theme data
1014
- logger.info('\n' + 'update sidebar');
1015
- user_state = j1.readCookie(cookie_names.user_state);
1016
- current_user_data = j1.mergeData(user_session, user_state);
1017
- j1.core.navigator.updateSidebar(current_user_data);
1018
-
1019
- // set|log status
1020
- state = 'finished';
1021
- j1.setState(state);
1022
- logText = '\n' + 'state: ' + state;
1023
- logger.info(logText);
1024
- logText = '\n' + 'page finalized successfully';
1025
- logger.info(logText);
1026
- }, flickerTimeout);
1027
- });
1028
- } else {
1029
- // web mode
1030
- // ---------------------------------------------------------------------
1031
- setTimeout (function() {
1032
- logger.info('\n' + 'state: finished');
1033
- logger.info('\n' + 'page initialization: finished');
933
+ // enable (body) animation on page load if enabled
934
+ if (bodyAnimation) {
935
+ var body_animation_fadein = '<style id="body_animation">';
936
+ body_animation_fadein += ' body {';
937
+ body_animation_fadein += ' animation: fadeInAnimation ease ' + bodyAnimationDuration + 's;';
938
+ body_animation_fadein += ' animation-iteration-count: 1;';
939
+ body_animation_fadein += ' animation-fill-mode: forwards;';
940
+ body_animation_fadein += ' }';
941
+ body_animation_fadein += ' @keyframes fadeInAnimation {';
942
+ body_animation_fadein += ' 0% {';
943
+ body_animation_fadein += ' opacity: 0;';
944
+ body_animation_fadein += ' }';
945
+ body_animation_fadein += ' 100% {';
946
+ body_animation_fadein += ' opacity: 1;';
947
+ body_animation_fadein += ' }';
948
+ body_animation_fadein += ' }';
949
+ body_animation_fadein += '</style>';
950
+ $('head').append(body_animation_fadein);
951
+ }
1034
952
 
1035
- // display the page loaded
1036
- $('#no_flicker').css('display', 'block');
953
+ // display the page loaded is managed by module "themer"
954
+ // $('#no_flicker').css('display', 'block');
1037
955
 
1038
956
  // jadams, 2021-12-06: Check if access to cookies for this site failed.
1039
957
  // Possibly, a third-party domain or an attacker tries to access it.
@@ -1045,64 +963,21 @@ var j1 = (function (options) {
1045
963
  // redirect to error page: blocked content
1046
964
  window.location.href = '/446.html';
1047
965
  } else {
1048
-
1049
966
  logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
1050
967
  }
1051
968
  }
1052
969
 
1053
- // jadams, 2021-11-19: test code for 'tapTarget' of 'materializeCss'
1054
- // See:
1055
- // https://stackoverflow.com/questions/49422111/opening-tap-target-in-materialize-css-for-2-seconds
1056
- // -------------------------------------------------------------------
1057
- // $('#features').tapTarget();
1058
- // $('#features').click(function(e) {
1059
- // logger.info('\n' + 'call default action');
1060
- // $('#features').tapTarget('open');
1061
- // });
1062
-
1063
- // jadams, 2021-11-19: additional code for accordions (collapsible)
1064
- // used e.g for the 'SERVICE Panel'
1065
- // -------------------------------------------------------------------
1066
- // Add minus icon for collapse element which is open by default
1067
- $(".collapse.show").each(function(){
1068
- $(this).prev(".card-header").addClass("highlight");
1069
- });
1070
-
1071
- // Highlight open collapsed element
1072
- $(".card-header .btn").click(function(){
1073
- $(".card-header").not($(this).parents()).removeClass("highlight");
1074
- $(this).parents(".card-header").toggleClass("highlight");
1075
- });
1076
-
1077
970
  // manage Dropcaps if translation is enabled|disabled
1078
- // -------------------------------------------------------------------
971
+ // -----------------------------------------------------------------
1079
972
  if (user_translate.translationEnabled) {
1080
- logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
1081
- logger.debug('\n' + 'skipped processing of dropcaps');
973
+ logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
974
+ logger.debug('\n' + 'skipped processing of dropcaps');
1082
975
  } else {
1083
- // initialize dropcaps
1084
- logger.info('\n' + 'post processing: createDropCap');
1085
- j1.core.createDropCap();
976
+ // initialize dropcaps
977
+ logger.info('\n' + 'post processing: createDropCap');
978
+ j1.core.createDropCap();
1086
979
  }
1087
980
 
1088
- logger.info('\n' + 'mode detected: web');
1089
- logger.info('\n' + 'hide signin icon');
1090
- $('#quickLinksSignInOutButton').css('display', 'none');
1091
-
1092
- user_session.current_page = current_url.pathname;
1093
- logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
1094
- cookie_written = j1.writeCookie({
1095
- name: cookie_names.user_session,
1096
- data: user_session,
1097
- secure: secure,
1098
- expires: 0
1099
- });
1100
-
1101
- // TODO: should MOVED to ControlCenter Adapter ???
1102
- // -----------------------------------------------------------------
1103
- // show cc icon (currently NOT supported)
1104
- // $('#quickLinksControlCenterButton').css('display', 'block');
1105
-
1106
981
  // TODO: should MOVED to Cookiebar ???
1107
982
  // show|hide cookie icon
1108
983
  if (j1.existsCookie(cookie_names.user_consent)) {
@@ -1117,6 +992,27 @@ var j1 = (function (options) {
1117
992
  $('#quickLinksCookieButton').css('display', 'none');
1118
993
  }
1119
994
 
995
+ // TODO: should MOVED to ControlCenter Adapter ???
996
+ // -----------------------------------------------------------------
997
+ // show cc icon (currently NOT supported)
998
+ // $('#quickLinksControlCenterButton').css('display', 'block');
999
+
1000
+ if (j1.authEnabled()) {
1001
+ if (user_session.authenticated === 'true') {
1002
+ // set signout
1003
+ logger.info('\n' + 'show signout icon');
1004
+ $('#navLinkSignInOut').attr('data-bs-target','#modalOmniSignOut');
1005
+ $('#iconSignInOut').removeClass('mdi-login').addClass('mdi-logout');
1006
+ } else {
1007
+ // set signin
1008
+ logger.info('\n' + 'show signin icon');
1009
+ $('#navLinkSignInOut').attr('data-bs-target','#modalOmniSignIn');
1010
+ $('#iconSignInOut').removeClass('mdi-logout').addClass('mdi-login');
1011
+ }
1012
+ logger.info('\n' + 'authentication detected as: ' + user_session.authenticated);
1013
+ $('#quickLinksSignInOutButton').css('display', 'block');
1014
+ }
1015
+
1120
1016
  // TODO: should MOVED to Themer ???
1121
1017
  // jadams, 2021-07-25: hide|show themes menu on cookie consent
1122
1018
  // (analysis|personalization) settings. BootSwatch is a 3rd party
@@ -1144,29 +1040,6 @@ var j1 = (function (options) {
1144
1040
  // update sidebar for changed theme data
1145
1041
  logger.info('\n' + 'update sidebar');
1146
1042
  user_state = j1.readCookie(cookie_names.user_state);
1147
-
1148
- if (template_version_changed) {
1149
- if (typeof template_previous_version == 'undefined') template_previous_version = 'na';
1150
- logger.warn('\n' + 'template version detected as changed');
1151
- logger.warn('\n' + 'template version previous|current: ' + template_previous_version + '|' + template_version);
1152
- // Update the user_state cookie
1153
- // TODO: replace theme_version by template_version as they
1154
- // are alwas the same
1155
- // disable: user_state.theme_version = template_version;
1156
- //
1157
- user_state.template_version = template_version;
1158
- cookie_written = j1.writeCookie({
1159
- name: cookie_names.user_state,
1160
- data: user_state,
1161
- secure: secure,
1162
- expires: 365
1163
- });
1164
- logger.warn('\n' + 'template version updated to: ' + template_version);
1165
- } else {
1166
- logger.info('\n' + 'template version detected: ' + user_state.template_version);
1167
- }
1168
-
1169
- // set current user data
1170
1043
  current_user_data = j1.mergeData(user_session, user_state);
1171
1044
  j1.core.navigator.updateSidebar(current_user_data);
1172
1045
 
@@ -1177,7 +1050,182 @@ var j1 = (function (options) {
1177
1050
  logger.info(logText);
1178
1051
  logText = '\n' + 'page finalized successfully';
1179
1052
  logger.info(logText);
1180
- }, flickerTimeout);
1053
+
1054
+ });
1055
+ } else {
1056
+ // web mode
1057
+ // ---------------------------------------------------------------------
1058
+
1059
+ logger.info('\n' + 'state: finished');
1060
+ logger.info('\n' + 'page initialization: finished');
1061
+
1062
+ // enable (body) animation on page load if enabled
1063
+ if (bodyAnimation) {
1064
+ var body_animation_fadein = '<style id="body_animation">';
1065
+ body_animation_fadein += ' body {';
1066
+ body_animation_fadein += ' animation: fadeInAnimation ease ' + bodyAnimationDuration + 's;';
1067
+ body_animation_fadein += ' animation-iteration-count: 1;';
1068
+ body_animation_fadein += ' animation-fill-mode: forwards;';
1069
+ body_animation_fadein += ' }';
1070
+ body_animation_fadein += ' @keyframes fadeInAnimation {';
1071
+ body_animation_fadein += ' 0% {';
1072
+ body_animation_fadein += ' opacity: 0;';
1073
+ body_animation_fadein += ' }';
1074
+ body_animation_fadein += ' 100% {';
1075
+ body_animation_fadein += ' opacity: 1;';
1076
+ body_animation_fadein += ' }';
1077
+ body_animation_fadein += ' }';
1078
+ body_animation_fadein += '</style>';
1079
+
1080
+ $('head').append(body_animation_fadein);
1081
+ }
1082
+
1083
+ // display the page loaded is managed by module "themer"
1084
+ // $('#no_flicker').css('display', 'block');
1085
+
1086
+ // jadams, 2021-12-06: Check if access to cookies for this site failed.
1087
+ // Possibly, a third-party domain or an attacker tries to access it.
1088
+ if (checkCookies) {
1089
+ var j1Cookies = j1.findCookie('j1');
1090
+ if (!j1.existsCookie(cookie_names.user_state)) {
1091
+ logger.error('\n' + 'Access to cookie failed or cookie not found: ' + cookie_names.user_state);
1092
+ logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
1093
+ // redirect to error page: blocked content
1094
+ window.location.href = '/446.html';
1095
+ } else {
1096
+
1097
+ logger.info('\n' + 'j1 cookies found:' + j1Cookies.length);
1098
+ }
1099
+ }
1100
+
1101
+ // jadams, 2021-11-19: test code for 'tapTarget' of 'materializeCss'
1102
+ // See:
1103
+ // https://stackoverflow.com/questions/49422111/opening-tap-target-in-materialize-css-for-2-seconds
1104
+ // -------------------------------------------------------------------
1105
+ // $('#features').tapTarget();
1106
+ // $('#features').click(function(e) {
1107
+ // logger.info('\n' + 'call default action');
1108
+ // $('#features').tapTarget('open');
1109
+ // });
1110
+
1111
+ // jadams, 2021-11-19: additional code for accordions (collapsible)
1112
+ // used e.g for the 'SERVICE Panel'
1113
+ // -------------------------------------------------------------------
1114
+ // Add minus icon for collapse element which is open by default
1115
+ $(".collapse.show").each(function(){
1116
+ $(this).prev(".card-header").addClass("highlight");
1117
+ });
1118
+
1119
+ // Highlight open collapsed element
1120
+ $(".card-header .btn").click(function(){
1121
+ $(".card-header").not($(this).parents()).removeClass("highlight");
1122
+ $(this).parents(".card-header").toggleClass("highlight");
1123
+ });
1124
+
1125
+ // manage Dropcaps if translation is enabled|disabled
1126
+ // -------------------------------------------------------------------
1127
+ if (user_translate.translationEnabled) {
1128
+ logger.info('\n' + 'translation enabled: ' + user_translate.translationEnabled);
1129
+ logger.debug('\n' + 'skipped processing of dropcaps');
1130
+ } else {
1131
+ // initialize dropcaps
1132
+ logger.info('\n' + 'post processing: createDropCap');
1133
+ j1.core.createDropCap();
1134
+ }
1135
+
1136
+ logger.info('\n' + 'mode detected: web');
1137
+ logger.info('\n' + 'hide signin icon');
1138
+ $('#quickLinksSignInOutButton').css('display', 'none');
1139
+
1140
+ user_session.current_page = current_url.pathname;
1141
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_session);
1142
+ cookie_written = j1.writeCookie({
1143
+ name: cookie_names.user_session,
1144
+ data: user_session,
1145
+ secure: secure,
1146
+ expires: 0
1147
+ });
1148
+
1149
+ // TODO: should MOVED to ControlCenter Adapter ???
1150
+ // -----------------------------------------------------------------
1151
+ // show cc icon (currently NOT supported)
1152
+ // $('#quickLinksControlCenterButton').css('display', 'block');
1153
+
1154
+ // TODO: should MOVED to Cookiebar ???
1155
+ // show|hide cookie icon
1156
+ if (j1.existsCookie(cookie_names.user_consent)) {
1157
+ // Display cookie icon
1158
+ logText = '\n' + 'show cookie icon';
1159
+ logger.info(logText);
1160
+ $('#quickLinksCookieButton').css('display', 'block');
1161
+ } else {
1162
+ logText = '\n' + 'hide cookie icon';
1163
+ logger.info(logText);
1164
+ // Display cookie icon
1165
+ $('#quickLinksCookieButton').css('display', 'none');
1166
+ }
1167
+
1168
+ // TODO: should MOVED to Themer ???
1169
+ // jadams, 2021-07-25: hide|show themes menu on cookie consent
1170
+ // (analysis|personalization) settings. BootSwatch is a 3rd party
1171
+ // is using e.g GA. Because NO control is possible on 3rd parties,
1172
+ // for GDPR compliance, themes feature may disabled on
1173
+ // privacy settings
1174
+ if (!user_consent.personalization) {
1175
+ logger.debug('\n' + 'disable themes feature because of privacy settings');
1176
+ logger.debug('\n' + 'personalization not allowed, privacy settings for personalization: ' + user_consent.personalization);
1177
+ $("#themes_menu").hide();
1178
+ } else {
1179
+ $("#themes_menu").show();
1180
+ }
1181
+
1182
+ // detect if a loaded page has been chenged
1183
+ if (user_session.previous_page !== user_session.current_page) {
1184
+ logText = '\n' + 'page change detected';
1185
+ logger.info(logText);
1186
+ logText = '\n' + 'previous page: ' + user_session.previous_page;
1187
+ logger.info(logText);
1188
+ logText = '\n' + 'current page: ' + user_session.current_page;
1189
+ logger.info(logText);
1190
+ }
1191
+
1192
+ // update sidebar for changed theme data
1193
+ logger.info('\n' + 'update sidebar');
1194
+ user_state = j1.readCookie(cookie_names.user_state);
1195
+
1196
+ if (template_version_changed) {
1197
+ if (typeof template_previous_version == 'undefined') template_previous_version = 'na';
1198
+ logger.warn('\n' + 'template version detected as changed');
1199
+ logger.warn('\n' + 'template version previous|current: ' + template_previous_version + '|' + template_version);
1200
+ // Update the user_state cookie
1201
+ // TODO: replace theme_version by template_version as they
1202
+ // are alwas the same
1203
+ // disable: user_state.theme_version = template_version;
1204
+ //
1205
+ user_state.template_version = template_version;
1206
+ cookie_written = j1.writeCookie({
1207
+ name: cookie_names.user_state,
1208
+ data: user_state,
1209
+ secure: secure,
1210
+ expires: 365
1211
+ });
1212
+ logger.warn('\n' + 'template version updated to: ' + template_version);
1213
+ } else {
1214
+ logger.info('\n' + 'template version detected: ' + user_state.template_version);
1215
+ }
1216
+
1217
+ // set current user data
1218
+ current_user_data = j1.mergeData(user_session, user_state);
1219
+ j1.core.navigator.updateSidebar(current_user_data);
1220
+
1221
+ // set|log status
1222
+ state = 'finished';
1223
+ j1.setState(state);
1224
+ logText = '\n' + 'state: ' + state;
1225
+ logger.info(logText);
1226
+ logText = '\n' + 'page finalized successfully';
1227
+ logger.info(logText);
1228
+
1181
1229
  }
1182
1230
  },
1183
1231
 
@@ -2315,11 +2363,14 @@ var j1 = (function (options) {
2315
2363
  var logger = log4javascript.getLogger('j1.adapter.scrollToAnchor');
2316
2364
 
2317
2365
  var dependencies_met_page_displayed = setInterval (function () {
2318
- if (j1.getState() == 'finished' && j1['pageMonitor'].currentGrowthRatio >= 100) {
2366
+ var pageState = $('#no_flicker').css("display");
2367
+ if (j1.getState() == 'finished' && pageState == 'block' && j1['pageMonitor'].pageType !== 'unknown') {
2319
2368
  if (j1['pageMonitor'].pageType == 'static') {
2320
- logger.info('\n' + 'Scroller: Scroll static page')
2321
- const scrollOffset = j1.getScrollOffset();
2322
- j1.scrollTo(scrollOffset);
2369
+ setTimeout (function() {
2370
+ logger.info('\n' + 'Scroller: Scroll static page')
2371
+ const scrollOffset = j1.getScrollOffset();
2372
+ j1.scrollTo(scrollOffset);
2373
+ }, 1000);
2323
2374
  clearInterval(dependencies_met_page_displayed);
2324
2375
  } else if (j1['pageMonitor'].pageType == 'dynamic') {
2325
2376
  setTimeout (function() {
@@ -2387,75 +2438,64 @@ var j1 = (function (options) {
2387
2438
 
2388
2439
  j1['pageMonitor'].eventNo += 1;
2389
2440
 
2390
- if (!j1['pageMonitor'].pageBaseHeight) {
2391
- // set INITAIL page properties
2392
- //
2393
- pageBaseHeight = documentHeight;
2441
+ // Skip first Observer events as data returne found unusable
2442
+ if (j1['pageMonitor'].eventNo == 2) {
2443
+ // Set initial data from second event
2444
+ j1['pageMonitor'].pageBaseHeight = document.body.scrollHeight;
2445
+ j1['pageMonitor'].currentPageHeight = document.body.scrollHeight;
2446
+ j1['pageMonitor'].previousPageHeight = document.body.scrollHeight;
2447
+ j1['pageMonitor'].previousGrowthRatio = 0.00;
2448
+
2449
+ pageBaseHeight = document.body.scrollHeight;
2394
2450
  previousGrowthRatio = 100;
2395
2451
  growthRatio = 0.00;
2396
-
2397
- j1['pageMonitor'].pageBaseHeight = documentHeight;
2398
- j1['pageMonitor'].currentPageHeight = documentHeight;
2399
- j1['pageMonitor'].previousGrowthRatio = previousGrowthRatio;
2400
- j1['pageMonitor'].growthRatio = growthRatio;
2401
2452
  } else {
2402
- // set PREVIOUS page properties taken from GLOBAL vars
2403
- //
2404
- j1['pageMonitor'].previousPageHeight = pageHeight;
2405
- j1['pageMonitor'].previousGrowthRatio = previousGrowthRatio;
2406
- }
2407
-
2408
- // collect 'pageHeight' from 'entries'
2409
- // NOTE: each entry is an instance of ResizeObserverEntry
2410
- for (const entry of entries) {
2411
- pageBaseHeight = j1['pageMonitor'].pageBaseHeight;
2412
-
2413
- // get the page height (rounded to int) from observer
2414
- //
2415
- pageHeight = Math.round(entry.contentRect.height);
2416
- j1['pageMonitor'].currentPageHeight = pageHeight;
2417
-
2418
- // total growth ratio
2419
- pageGrowthRatio = pageHeight / pageBaseHeight * 100;
2420
- pageGrowthRatio = pageGrowthRatio.toFixed(2);
2421
-
2422
- j1['pageMonitor'].currentGrowthRatio = pageGrowthRatio;
2423
-
2424
- growthRatio = ((pageGrowthRatio / previousGrowthRatio) - 1) * 100;
2425
- growthRatio = growthRatio.toFixed(2);
2426
- j1['pageMonitor'].growthRatio = growthRatio;
2427
- }
2428
-
2429
- // detect the page 'type'
2430
- //
2431
- if (growthRatio > 0) {
2432
- // scroll the page to top if content has grown
2433
- //
2434
- if (scrollDynamicPagesTopOnChange) {
2435
- // limit scrolling to reduce the flicker (for chromium browsers)
2436
- if (j1['pageMonitor'].eventNo > 3) {
2437
- window.scrollTo(0, 0);
2453
+ // collect 'pageHeight' from 'entries'
2454
+ // NOTE: each entry is an instance of ResizeObserverEntry
2455
+ for (const entry of entries) {
2456
+ pageBaseHeight = j1['pageMonitor'].pageBaseHeight;
2457
+ if (pageBaseHeight > 0) {
2458
+ // get the page height (rounded to int) from observer
2459
+ //
2460
+ pageHeight = Math.round(entry.contentRect.height);
2461
+ j1['pageMonitor'].currentPageHeight = pageHeight;
2462
+
2463
+ // total growth ratio
2464
+ pageGrowthRatio = pageHeight / pageBaseHeight * 100;
2465
+ pageGrowthRatio = pageGrowthRatio.toFixed(2);
2466
+
2467
+ j1['pageMonitor'].currentGrowthRatio = pageGrowthRatio;
2468
+
2469
+ growthRatio = ((pageGrowthRatio / previousGrowthRatio) - 1) * 100;
2470
+ growthRatio = growthRatio.toFixed(2);
2471
+ j1['pageMonitor'].growthRatio = growthRatio;
2438
2472
  }
2439
2473
  }
2440
- // set the page type to 'dynamic' if content has grown
2441
- //
2442
- j1['pageMonitor'].pageType = 'dynamic';
2474
+ // detect the page 'type'
2475
+ if (growthRatio >= 10) {
2476
+ j1['pageMonitor'].pageType = 'dynamic';
2443
2477
 
2444
- logger.debug('\n' + 'Observer: previousPageHeight|currentPageHeight (px): ', j1['pageMonitor'].previousPageHeight + '|' + pageHeight);
2445
- logger.debug('\n' + 'Observer: growthRatio relative|absolute (%): ', growthRatio + '|' + pageGrowthRatio);
2478
+ // logger.debug('\n' + 'Observer: previousPageHeight|currentPageHeight (px): ', j1['pageMonitor'].previousPageHeight + '|' + pageHeight);
2479
+ // logger.debug('\n' + 'Observer: growthRatio relative|absolute (%): ', growthRatio + '|' + pageGrowthRatio);
2446
2480
 
2447
- } else {
2448
- // set the page type to 'static' if no growth detected
2449
- //
2450
- j1['pageMonitor'].pageType = 'static';
2451
- }
2452
- });
2481
+ logger.debug('\n' + 'Observer: page growthRatio (%): ', j1['pageMonitor'].growthRatio);
2482
+ logger.debug('\n' + 'Observer: page detected as: dynamic');
2483
+
2484
+ } else {
2485
+ // set the page type to 'static' if low growth detected
2486
+ //
2487
+ logger.debug('\n' + 'Observer: page growthRatio (%): ', j1['pageMonitor'].growthRatio);
2488
+ j1['pageMonitor'].pageType = 'static';
2489
+ logger.debug('\n' + 'Observer: page detected as: static');
2490
+ }
2491
+ } // END Observer data evaluation
2492
+ }); // END Observer
2453
2493
 
2454
2494
  // monitor the page growth if visible
2455
- var dependencies_met_page_displayed = setInterval (function () {
2495
+ var dependencies_met_page_finished = setInterval (function () {
2456
2496
  if (j1.getState() == 'finished') {
2457
2497
  observer.observe(document.querySelector('body')); // observer.observe(document.querySelector('#content'));
2458
- clearInterval(dependencies_met_page_displayed);
2498
+ clearInterval(dependencies_met_page_finished);
2459
2499
  }
2460
2500
  }, 25);
2461
2501