j1-template 2022.0.5 → 2022.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/_layouts/default.html +0 -57
  3. data/assets/error_pages/HTTP444.html +4 -4
  4. data/assets/error_pages/HTTP445.html +3 -3
  5. data/assets/error_pages/HTTP446.html +110 -0
  6. data/assets/themes/j1/adapter/js/cookieConsent.js +64 -34
  7. data/assets/themes/j1/adapter/js/j1.js +114 -210
  8. data/assets/themes/j1/adapter/js/themer.js +0 -1
  9. data/assets/themes/j1/adapter/js/translator.js +146 -97
  10. data/assets/themes/j1/core/css/themes/unodark/bootstrap.css +6 -0
  11. data/assets/themes/j1/core/css/themes/unodark/bootstrap.min.css +1 -1
  12. data/assets/themes/j1/core/js/template.js +2 -6
  13. data/assets/themes/j1/core/js/template.min.js +1 -1
  14. data/assets/themes/j1/core/js/template.min.js.map +1 -1
  15. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.js +29 -13
  16. data/assets/themes/j1/modules/cookieConsent/js/cookieConsent.min.js +1 -1
  17. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +0 -1
  18. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  19. data/assets/themes/j1/modules/translator/js/translator.js +98 -63
  20. data/assets/themes/j1/modules/translator/js/translator.min.js +1 -1
  21. data/lib/j1/version.rb +1 -1
  22. data/lib/starter_web/Gemfile +1 -1
  23. data/lib/starter_web/_config.yml +2 -3
  24. data/lib/starter_web/_data/modules/cookies.yml +30 -0
  25. data/lib/starter_web/_data/modules/defaults/cookieconsent.yml +3 -3
  26. data/lib/starter_web/_data/modules/defaults/cookies.yml +112 -0
  27. data/lib/starter_web/_data/modules/navigator_menu.yml +10 -1
  28. data/lib/starter_web/_includes/attributes.asciidoc +6 -1
  29. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  30. data/lib/starter_web/package.json +1 -1
  31. data/lib/starter_web/pages/_test_pages/google-translate-tester.1.adoc +0 -2
  32. data/lib/starter_web/pages/_test_pages/google-translate-tester.4.adoc +0 -2
  33. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
  34. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
  35. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
  36. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
  37. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
  38. data/lib/starter_web/pages/public/blog/navigator/archive.html +1 -1
  39. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
  40. data/lib/starter_web/pages/public/learn/quickstart.adoc +1 -1
  41. data/lib/starter_web/pages/public/learn/roundtrip/100_present_images.adoc +1 -1
  42. data/lib/starter_web/pages/public/learn/roundtrip/100_present_videos.adoc +2 -2
  43. data/lib/starter_web/pages/public/learn/roundtrip/200_typography.adoc +1 -1
  44. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +1 -1
  45. data/lib/starter_web/pages/public/learn/roundtrip/400_asciidoc_extensions.adoc +1 -1
  46. data/lib/starter_web/pages/public/learn/roundtrip/410_bs_modals_extentions.adoc +1 -1
  47. data/lib/starter_web/pages/public/learn/roundtrip/420_responsive_tables_extensions.adoc +1 -1
  48. data/lib/starter_web/pages/public/learn/roundtrip/500_themes.adoc +1 -1
  49. data/lib/starter_web/pages/public/learn/roundtrip/600_quicksearch.adoc +1 -1
  50. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +2 -12
  51. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +2 -12
  52. data/lib/starter_web/pages/public/manuals/dropdown-help.adoc +1 -1
  53. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -1
  54. data/lib/starter_web/pages/public/previewer/preview_bootstrap_theme.adoc +1 -1
  55. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  56. data/lib/starter_web/utilsrv/package.json +1 -1
  57. metadata +5 -2
@@ -35,6 +35,9 @@ regenerate: true
35
35
 
36
36
  {% comment %} Set config data
37
37
  -------------------------------------------------------------------------------- {% endcomment %}
38
+ {% assign cookie_defaults = modules.defaults.cookies.defaults %}
39
+ {% assign cookie_settings = modules.cookies.settings %}
40
+
38
41
  {% assign translator_defaults = modules.defaults.translator.defaults %}
39
42
  {% assign translator_settings = modules.translator.settings %}
40
43
  {% assign tracking_enabled = template_config.analytics.enabled %}
@@ -42,6 +45,7 @@ regenerate: true
42
45
  {% comment %} Set config options
43
46
  -------------------------------------------------------------------------------- {% endcomment %}
44
47
  {% assign translator_options = translator_defaults | merge: translator_settings %}
48
+ {% assign cookie_options = cookie_defaults | merge: cookie_settings %}
45
49
 
46
50
  {% assign production = false %}
47
51
  {% if environment == 'prod' or environment == 'production' %}
@@ -94,7 +98,7 @@ j1.adapter['translator'] = (function (j1, window) {
94
98
  var baseUrl;
95
99
  var hostname;
96
100
  var domain;
97
- var cookie_domain;
101
+ var cookie_option_domain;
98
102
  var secure;
99
103
  var logText;
100
104
  var cookie_written;
@@ -104,6 +108,7 @@ j1.adapter['translator'] = (function (j1, window) {
104
108
  var head;
105
109
  var script;
106
110
  var languageList;
111
+ var domainAttribute;
107
112
 
108
113
  // ---------------------------------------------------------------------------
109
114
  // helper functions
@@ -111,43 +116,58 @@ j1.adapter['translator'] = (function (j1, window) {
111
116
 
112
117
  // ---------------------------------------------------------------------------
113
118
  // setCookie()
114
- // writes a flat cookie (not using an encoded JSON string)
119
+ // writes a FLAT cookie (not using an encoded JSON string)
115
120
  // ---------------------------------------------------------------------------
116
- function setCookie(options /*cName, cValue, expDays*/) {
117
- var defaults = {};
118
- var settings;
119
- var document_cookie;
120
- var stringifiedAttributes = '';
121
-
122
- defaults = {
123
- name: '',
124
- path: '/',
125
- expires: 0,
126
- domain: 'localhost',
127
- samesite: 'Strict',
128
- http_only: false,
129
- secure: false
130
- };
131
- settings = $.extend(defaults, options);
132
-
133
- stringifiedAttributes += '; ' + 'path=' + settings.path;
134
-
135
- if (settings.expires > 0) {
136
- date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
137
- stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
138
- }
139
-
140
- stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
141
-
142
- if (settings.secure) {
143
- stringifiedAttributes += '; ' + 'secure=' + settings.secure;
144
- }
145
-
146
- // document_cookie = settings.name + '=' + settings.data + '; path=' + settings.path + '; ' + 'domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + ';';
147
- document_cookie = settings.name + '=' + settings.data + stringifiedAttributes;
148
-
149
- document.cookie = document_cookie;
150
- };
121
+ // function setCookie(options /*cName, cValue, expDays*/) {
122
+ // var date = new Date();
123
+ // var timestamp_now = date.toISOString()
124
+ // var url = new liteURL(window.location.href);
125
+ // var baseUrl = url.origin;;
126
+ // var hostname = url.hostname;
127
+ // var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
128
+ // var domain_enabled = '{{cookie_options.domain}}';
129
+ // var defaults = {};
130
+ // var settings;
131
+ // var document_cookie;
132
+ // var stringifiedAttributes = '';
133
+ //
134
+ // defaults = {
135
+ // name: '',
136
+ // path: '/',
137
+ // expires: 0,
138
+ // domain: true,
139
+ // samesite: 'Lax',
140
+ // http_only: false,
141
+ // secure: false
142
+ // };
143
+ // settings = $.extend(defaults, options);
144
+ //
145
+ // stringifiedAttributes += '; ' + 'path=' + settings.path;
146
+ //
147
+ // if (settings.expires > 0) {
148
+ // date.setTime(date.getTime() + (settings.expires * 24 * 60 * 60 * 1000));
149
+ // stringifiedAttributes += '; ' + 'expires=' + date.toUTCString();
150
+ // }
151
+ //
152
+ // if (domain != hostname) {
153
+ // // settings.domain = domain_enabled ? '.' + domain : hostname;
154
+ // settings.domain = domain_enabled ? domain : hostname;
155
+ // } else {
156
+ // settings.domain = hostname;
157
+ // }
158
+ // stringifiedAttributes += '; ' + 'domain=' + settings.domain;
159
+ //
160
+ // stringifiedAttributes += '; ' + 'SameSite=' + settings.samesite;
161
+ //
162
+ // if (settings.secure) {
163
+ // stringifiedAttributes += '; ' + 'secure=' + settings.secure;
164
+ // }
165
+ //
166
+ // // document_cookie = settings.name + '=' + settings.data + '; path=' + settings.path + '; ' + 'domain=' + settings.domain + '; ' + 'SameSite=' + settings.samesite + ';';
167
+ // document_cookie = settings.name + '=' + settings.data + stringifiedAttributes;
168
+ //
169
+ // document.cookie = document_cookie;
170
+ // };
151
171
 
152
172
  // ---------------------------------------------------------------------------
153
173
  // Main object
@@ -168,7 +188,6 @@ j1.adapter['translator'] = (function (j1, window) {
168
188
  baseUrl = url.origin;
169
189
  hostname = url.hostname;
170
190
  domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
171
- cookie_domain = (domain.includes('.')) ? '.' + domain : domain;
172
191
  secure = (url.protocol.includes('https')) ? true : false;
173
192
  navigator_language = navigator.language || navigator.userLanguage; // userLanguage for MS IE compatibility
174
193
  translation_language = navigator_language.split('-')[0];
@@ -188,23 +207,8 @@ j1.adapter['translator'] = (function (j1, window) {
188
207
  'translationLanguage': translation_language,
189
208
  };
190
209
 
191
- // load|initialize user translate cookie
192
- if (j1.existsCookie(cookie_names.user_translate)) {
193
- user_translate = j1.readCookie(cookie_names.user_translate);
194
- } else {
195
- logger.debug('\n' + 'write to cookie : ' + cookie_names.user_translate);
196
- cookie_written = j1.writeCookie({
197
- name: cookie_names.user_translate,
198
- data: user_translate,
199
- samesite: 'Strict',
200
- secure: secure,
201
- expires: 365
202
- });
203
- }
204
-
205
210
  // initialize state flag
206
211
  _this.state = 'pending';
207
- // _this.settings.languageList = '/assets/data/ms_select.json';
208
212
 
209
213
  // -----------------------------------------------------------------------
210
214
  // Default module settings
@@ -229,7 +233,32 @@ j1.adapter['translator'] = (function (j1, window) {
229
233
  // initializer
230
234
  // -----------------------------------------------------------------------
231
235
  var dependencies_met_page_ready = setInterval (function (options) {
232
- user_consent = j1.readCookie(cookie_names.user_consent);
236
+ var expires = '{{cookie_options.expires}}';
237
+ var same_site = '{{cookie_options.same_site}}';
238
+ var option_domain = '{{cookie_options.domain}}';
239
+
240
+ user_consent = j1.readCookie(cookie_names.user_consent);
241
+
242
+ // set domain used by cookies
243
+ if (option_domain == 'auto') {
244
+ domainAttribute = domain ;
245
+ } else {
246
+ domainAttribute = '';
247
+ }
248
+
249
+ // load|initialize user translate cookie
250
+ if (j1.existsCookie(cookie_names.user_translate)) {
251
+ user_translate = j1.readCookie(cookie_names.user_translate);
252
+ } else {
253
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_translate);
254
+ cookie_written = j1.writeCookie({
255
+ name: cookie_names.user_translate,
256
+ data: user_translate,
257
+ samesite: same_site,
258
+ secure: secure,
259
+ expires: expires
260
+ });
261
+ }
233
262
 
234
263
  if ( j1.getState() === 'finished' ) {
235
264
  _this.setState('started');
@@ -257,16 +286,28 @@ j1.adapter['translator'] = (function (j1, window) {
257
286
  }
258
287
  }
259
288
 
260
- // update user_translate cookie
261
- user_translate.analysis = user_consent.analysis;
262
- user_translate.personalization = user_consent.personalization;
263
- cookie_written = j1.writeCookie({
264
- name: cookie_names.user_translate,
265
- data: user_translate,
266
- samesite: 'Strict',
267
- secure: secure,
268
- expires: 365
269
- });
289
+ // load|set user translate cookie
290
+ user_consent = j1.readCookie(cookie_names.user_consent);
291
+ if (!user_consent.analysis || !user_consent.personalization) {
292
+ // disable translation service
293
+ user_translate.translationEnabled = false;
294
+ cookie_written = j1.writeCookie({
295
+ name: cookie_names.user_translate,
296
+ data: user_translate,
297
+ secure: secure
298
+ });
299
+
300
+ // expire permanent cookie to session
301
+ j1.expireCookie({ name: cookie_names.user_translate });
302
+ } else {
303
+ logger.debug('\n' + 'write to cookie : ' + cookie_names.user_translate);
304
+ cookie_written = j1.writeCookie({
305
+ name: cookie_names.user_translate,
306
+ data: user_translate,
307
+ secure: secure,
308
+ expires: 365
309
+ });
310
+ }
270
311
 
271
312
  if (moduleOptions.dialogLanguage === 'auto') {
272
313
  moduleOptions.dialogLanguage = '{{contentLanguage}}';
@@ -274,7 +315,11 @@ j1.adapter['translator'] = (function (j1, window) {
274
315
 
275
316
  j1.translator = new Translator({
276
317
  contentURL: moduleOptions.contentURL, // dialog content (modals) for all supported languages
277
- cookieName: moduleOptions.cookieName, // the name of the User State Cookie (primary data)
318
+ cookieName: cookie_names.user_translate, // name of the translator cookie
319
+ cookieStorageDays: expires, // lifetime of a cookie [0..365], 0: session cookie
320
+ cookieSameSite: same_site, // restrict consent cookie
321
+ cookieDomain: domainAttribute, // set domain (hostname|domain)
322
+ cookieSecure: secure, // set
278
323
  cookieConsentName: moduleOptions.cookieConsentName, // the name of the Cookie Consent Cookie (secondary data)
279
324
  disableLanguageSelector: moduleOptions.disableLanguageSelector, // disable language dropdown for translation in dialog (modal)
280
325
  dialogContainerID: moduleOptions.dialogContainerID, // dest container, the dialog modal is loaded (dynamically)
@@ -288,7 +333,7 @@ j1.adapter['translator'] = (function (j1, window) {
288
333
  });
289
334
 
290
335
  // enable|disable translation (after callback)
291
- if (user_consent.analysis && user_consent.personalization && user_translate.translationEnabled) {
336
+ if (user_translate.analysis && user_translate.personalization && user_translate.translationEnabled) {
292
337
  if (moduleOptions.translatorName === 'google') {
293
338
  head.appendChild(script);
294
339
  if ($('google_translate_element')) {
@@ -298,18 +343,15 @@ j1.adapter['translator'] = (function (j1, window) {
298
343
  } else {
299
344
  if (moduleOptions.translatorName === 'google') {
300
345
  // remove all googtrans cookies that POTENTIALLY exists
301
- Cookies.remove('googtrans', { domain: cookie_domain });
346
+ Cookies.remove('googtrans', { domain: domainAttribute });
302
347
  Cookies.remove('googtrans', { domain: hostname });
303
348
  Cookies.remove('googtrans');
304
349
  }
305
350
  }
306
351
 
307
- // Click events moved to Navigator (core)
308
- //
309
- // $('#quickLinksTranslateButton').click(function(e) {
310
- // logger.info('\n' + 'call default action');
311
- // j1.translator.showDialog();
312
- // });
352
+ // -------------------------------------------------------------------
353
+ // NOTE: Click events moved to Navigator (core)
354
+ // -------------------------------------------------------------------
313
355
 
314
356
  _this.setState('finished');
315
357
  logger.info('\n' + 'state: ' + _this.getState());
@@ -376,36 +418,38 @@ j1.adapter['translator'] = (function (j1, window) {
376
418
 
377
419
  // -------------------------------------------------------------------------
378
420
  // cbGoogle()
379
- // Called by the translator CORE module after the user made the
380
- // selection for a translation|language
421
+ // Called by the translator CORE module after the user has made
422
+ // the selection for a translation|language
381
423
  // -------------------------------------------------------------------------
382
424
  cbGoogle: function () {
383
- var logger = log4javascript.getLogger('j1.adapter.translator.cbGoogle');
384
- var cookie_names = j1.getCookieNames();
385
- var user_state = j1.readCookie(cookie_names.user_state);
386
- var user_consent = j1.readCookie(cookie_names.user_consent);
387
- var user_translate = j1.readCookie(cookie_names.user_translate);
388
- var msDropdown = document.getElementById('dropdownJSON').msDropdown;
389
- var selectedTranslationLanguage;
425
+ var logger = log4javascript.getLogger('j1.adapter.translator.cbGoogle');
426
+ var msDropdown = document.getElementById('dropdownJSON').msDropdown;
427
+ // var cookie_names = j1.getCookieNames();
428
+ // var user_consent = j1.readCookie(cookie_names.user_consent);
429
+ // var user_translate = j1.readCookie(cookie_names.user_translate);
430
+ // var url = new liteURL(window.location.href);
431
+ // var baseUrl = url.origin;;
432
+ // var hostname = url.hostname;
433
+ // var domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
434
+ // var cookie_option_domain = '{{cookie_options.domain}}';
435
+ // var same_site = '{{cookie_options.same_site}}';
390
436
  var srcLang;
391
437
  var destLang;
392
438
  var transCode;
439
+ var domainAttribute;
440
+ var selectedTranslationLanguage;
441
+
442
+ // set domain used by cookies
443
+ // if (cookie_option_domain == 'auto') {
444
+ // domainAttribute = domain ;
445
+ // } else {
446
+ // // domainAttribute = hostname;
447
+ // domainAttribute = '';
448
+ // }
393
449
 
394
450
  selectedTranslationLanguage = msDropdown.value;
395
451
  logger.info('\n' + 'selected translation language: ' + selectedTranslationLanguage);
396
452
 
397
- // update cookie consent settings
398
- user_consent.analysis = user_translate.analysis;
399
- user_consent.personalization = user_translate.personalization;
400
-
401
- cookie_written = j1.writeCookie({
402
- name: cookie_names.user_consent,
403
- data: user_consent,
404
- samesite: 'Strict',
405
- secure: secure,
406
- expires: 365
407
- });
408
-
409
453
  // set content language
410
454
  if (moduleOptions.contentLanguage === 'auto') {
411
455
  srcLang = '{{contentLanguage}}';
@@ -415,7 +459,7 @@ j1.adapter['translator'] = (function (j1, window) {
415
459
 
416
460
  // translation language MUST be DIFFERENT from content language
417
461
  if (srcLang == selectedTranslationLanguage ) {
418
- Cookies.remove('googtrans', { domain: cookie_domain });
462
+ Cookies.remove('googtrans', { domain: domainAttribute });
419
463
  Cookies.remove('googtrans', { domain: hostname });
420
464
  Cookies.remove('googtrans');
421
465
  location.reload(true);
@@ -426,11 +470,16 @@ j1.adapter['translator'] = (function (j1, window) {
426
470
  transCode = '/' + srcLang + '/' + selectedTranslationLanguage;
427
471
 
428
472
  // remove all googtrans cookies that POTENTIALLY exists
429
- Cookies.remove('googtrans', { domain: cookie_domain });
473
+ Cookies.remove('googtrans', { domain: domainAttribute });
430
474
  Cookies.remove('googtrans', { domain: hostname });
431
475
  Cookies.remove('googtrans');
432
476
 
433
- // write the googtrans cookie w/o DOMAIN!
477
+ // -----------------------------------------------------------------------
478
+ // NOTE: googtrans cookie will be rewritten (by Google!?) for
479
+ // attributes 'SameSite' and 'Domain'. This results for 'SameSite'
480
+ // in an empty field and two cookies (host+domain) if domain option
481
+ // is enabled!!!
482
+ // -----------------------------------------------------------------------
434
483
  Cookies.set('googtrans', transCode);
435
484
 
436
485
  // reload current page (skip cache)
@@ -8557,6 +8557,12 @@ table tr.even, table tr.alt, table tr:nth-of-type(even) {
8557
8557
  color: #bdbdbd;
8558
8558
  border-bottom: 1px dotted #424242 !important; }
8559
8559
 
8560
+ .series-exerpt {
8561
+ color: #e0e0e0; }
8562
+
8563
+ .series-navigation ul li a {
8564
+ background-color: #e0e0e0; }
8565
+
8560
8566
  /*
8561
8567
  # -----------------------------------------------------------------------------
8562
8568
  # ~/100_template_css/scss/theme_uno_dark/extentions/_tags.scss