j1-template 2021.1.4 → 2021.1.9

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