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
@@ -38,7 +38,7 @@
38
38
 
39
39
  'use strict';
40
40
  function CookieConsent(props) {
41
- var logger = log4javascript.getLogger('j1.core.bsCookieConsent');
41
+ var logger = log4javascript.getLogger('j1.core.CookieConsent');
42
42
  var self = this;
43
43
  var detailedSettingsShown = false;
44
44
  var url = new liteURL(window.location.href);
@@ -56,14 +56,10 @@ function CookieConsent(props) {
56
56
  dialogLanguage: 'content', // language used for the consent dialog (modal)
57
57
  dialogLanguages: ['en','de'], // supported languages for the consent dialog (modal), defaults to first in array
58
58
  contentURL: '/assets/data/cookieconsent', // URL contain the consent dialogs (modals) for ALL supported languages
59
- cookieName: 'j1.user.translate', // name of the cookie, in which the configuration is stored
60
- cookieStorageDays: 365, // duration the configuration cookie is stored on the client
61
59
  postSelectionCallback: '', // callback function, called after the user has made his selection
62
60
  whitelisted: [], // pages NO consent modal dialog is issued
63
61
  xhrDataElement: 'consent-data', // src container for all language-specific consent dialogs (taken from contentURL)
64
- dialogContainerID: 'consent-modal', // dest container, the dialog modal is loaded (dynamically)
65
- cookieSameSite: 'Strict', // restrict the consent cookie to first-party (do NOT send cookie to other domains)
66
- cookieSecure: true
62
+ dialogContainerID: 'consent-modal' // dest container, the dialog modal is loaded (dynamically)
67
63
  };
68
64
 
69
65
  // merge property settings
@@ -87,7 +83,7 @@ function CookieConsent(props) {
87
83
  this.props.cookieSecure = cookieSecure;
88
84
 
89
85
  var Cookie = {
90
- set: function (name, value, days, cookieSameSite, cookieSecure) {
86
+ set: function (name, value, days, cookieSameSite, cookieDomain, cookieSecure) {
91
87
  var value_encoded = window.btoa(value);
92
88
  var expires = '; expires=Thu, 01 Jan 1970 00:00:00 UTC';
93
89
  if (days>0) {
@@ -96,9 +92,9 @@ function CookieConsent(props) {
96
92
  expires = "; expires=" + date.toUTCString();
97
93
  }
98
94
  if (cookieSecure) {
99
- document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; cookieSameSite=' + cookieSameSite + '; ' + 'cookieSecure=' + cookieSecure + ';';
95
+ document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; SameSite=' + cookieSameSite + '; ' + 'Domain=' + cookieDomain + '; ' + 'Secure=' + cookieSecure + ';';
100
96
  } else {
101
- document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; cookieSameSite=' + cookieSameSite + ';';
97
+ document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; SameSite=' + cookieSameSite + ';' + 'Domain=' + cookieDomain + '; ';
102
98
  }
103
99
  },
104
100
  get: function (name) {
@@ -319,20 +315,41 @@ function CookieConsent(props) {
319
315
  }
320
316
 
321
317
  function agreeAll() {
322
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
318
+ Cookie.set(
319
+ self.props.cookieName,
320
+ JSON.stringify(gatherOptions(true)),
321
+ self.props.cookieStorageDays,
322
+ self.props.cookieSameSite,
323
+ self.props.cookieDomain,
324
+ cookieSecure
325
+ );
323
326
  self.$modal.modal('hide');
324
327
  }
325
328
 
326
329
  function doNotAgree() {
327
330
  // Remove consent cookie
328
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), 0, self.props.cookieSameSite, cookieSecure);
331
+ Cookie.set(
332
+ self.props.cookieName,
333
+ JSON.stringify(gatherOptions(false)),
334
+ 0,
335
+ self.props.cookieSameSite,
336
+ self.props.cookieDomain,
337
+ cookieSecure
338
+ );
329
339
  self.$modal.modal('hide');
330
340
  // redirect to error page: blocked site
331
341
  window.location.href = '/445.html';
332
342
  }
333
343
 
334
344
  function saveSettings() {
335
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
345
+ Cookie.set(
346
+ self.props.cookieName,
347
+ JSON.stringify(gatherOptions()),
348
+ self.props.cookieStorageDays,
349
+ self.props.cookieSameSite,
350
+ self.props.cookieDomain,
351
+ cookieSecure
352
+ );
336
353
  self.$modal.modal('hide');
337
354
  }
338
355
 
@@ -346,7 +363,6 @@ function CookieConsent(props) {
346
363
 
347
364
  // API functions
348
365
  // ---------------------------------------------------------------------------
349
-
350
366
  logger.info('\n' + 'initializing core module finished');
351
367
  logger.info('\n' + 'state: finished');
352
368
 
@@ -24,4 +24,4 @@
24
24
  # outside of J1 Template!
25
25
  # -----------------------------------------------------------------------------
26
26
  */
27
- "use strict";function CookieConsent(d){var v=log4javascript.getLogger("j1.core.bsCookieConsent");var p=this;var q=false;var e=new liteURL(window.location.href);var c=(e.protocol.includes("https"))?true:false;var j;var g;var t;v.info("\ninitializing core module: started");v.info("\nstate: started");this.props={autoShowDialog:true,dialogLanguage:"content",dialogLanguages:["en","de"],contentURL:"/assets/data/cookieconsent",cookieName:"j1.user.translate",cookieStorageDays:365,postSelectionCallback:"",whitelisted:[],xhrDataElement:"consent-data",dialogContainerID:"consent-modal",cookieSameSite:"Strict",cookieSecure:true};for(var f in d){this.props[f]=d[f]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;this.props.cookieSecure=c;var h={set:function(z,B,D,A,x){var C=window.btoa(B);var w="; expires=Thu, 01 Jan 1970 00:00:00 UTC";if(D>0){var y=new Date();y.setTime(y.getTime()+(D*24*60*60*1000));w="; expires="+y.toUTCString()}if(x){document.cookie=z+"="+(C||"")+w+"; Path=/; cookieSameSite="+A+"; cookieSecure="+x+";"}else{document.cookie=z+"="+(C||"")+w+"; Path=/; cookieSameSite="+A+";"}},get:function(x){var A=x+"=";var w=document.cookie.split(";");for(var y=0;y<w.length;y++){var C=w[y];while(C.charAt(0)===" "){C=C.substring(1,C.length)}if(C.indexOf(A)===0){var B=C.substring(A.length,C.length);var z=window.atob(B);return z}}return undefined}};var n={documentReady:function(w){if(document.readyState!=="loading"){w()}else{document.addEventListener("DOMContentLoaded",w)}}};function u(){var w={};var x=false;var y=0;var z=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){x=arguments[0];y++}var B=function(C){for(var D in C){if(Object.prototype.hasOwnProperty.call(C,D)){if(x&&Object.prototype.toString.call(C[D])==="[object Object]"){w[D]=u(true,w[D],C[D])}else{w[D]=C[D]}}}};for(;y<z;y++){var A=arguments[y];B(A)}return w}function i(B,y){var w=Array.prototype.slice.call(arguments,2);var A=B.split(".");var z=A.pop();for(var x=0;x<A.length;x++){y=y[A[x]]}return y[z].apply(y,w)}function m(w){n.documentReady(function(){p.modal=document.getElementById(p.props.dialogContainerID);if(!p.modal){v.info("\nload consent modal");p.modal=document.createElement("div");p.modal.id=p.props.dialogContainerID;p.modal.style.display="none";p.modal.setAttribute("class","modal fade");p.modal.setAttribute("tabindex","-1");p.modal.setAttribute("role","dialog");p.modal.setAttribute("aria-labelledby",p.props.dialogContainerID);document.body.append(p.modal);p.$modal=$(p.modal);p.$modal.on("hidden.bs.modal",function(){i(p.props.postSelectionCallback,window)});var x=p.props.contentURL+"/index.html";$.get(x).done(function(y){v.info("\nloading consent modal: successfully");p.modal.innerHTML=y;p.modal.innerHTML=$("#"+p.props.xhrDataElement).eq(0).html();p.modal.style.display="block";$(p.modal).modal({backdrop:"static",keyboard:false});p.$buttonDoNotAgree=$("#bccs-buttonDoNotAgree");p.$buttonAgree=$("#bccs-buttonAgree");p.$buttonSave=$("#bccs-buttonSave");p.$buttonAgreeAll=$("#bccs-buttonAgreeAll");v.info("\nload/initialze options from cookie");l();k();$("#bccs-options").on("hide.bs.collapse",function(){q=false;l()}).on("show.bs.collapse",function(){q=true;l()});v.info("\ninitialze event handler");p.$buttonDoNotAgree.click(function(){b()});p.$buttonAgree.click(function(){o()});p.$buttonSave.click(function(){$("#bccs-options").collapse("hide");s();k()});p.$buttonAgreeAll.click(function(){$("#bccs-options").collapse("hide");o();k()});p.$modal.modal("show")}).fail(function(){v.error("\nloading consent modal: failed");v.warn("\nprobably no `contentURL` set")})}else{p.$modal.modal("show")}}.bind(this))}function k(){var y=p.getSettings();if(y){for(var x in y){var w=p.$modal.find("#bccs-options .bccs-option[data-name='"+x+"'] input[type='checkbox']");w.prop("checked",y[x])}}}function l(){if(q){p.$buttonDoNotAgree.hide();p.$buttonAgree.hide();p.$buttonSave.show();p.$buttonAgreeAll.show()}else{p.$buttonDoNotAgree.show();p.$buttonAgree.show();p.$buttonSave.hide();p.$buttonAgreeAll.hide()}}function a(x){var w=p.$modal.find("#bccs-options .bccs-option");var z={};for(var A=0;A<w.length;A++){var C=w[A];var y=C.getAttribute("data-name");if(y==="necessary"){z[y]=true}else{if(x===undefined){var B=$(C).find("input[type='checkbox']");z[y]=B.prop("checked")}else{z[y]=!!x}}}return z}function o(){h.set(p.props.cookieName,JSON.stringify(a(true)),p.props.cookieStorageDays,p.props.cookieSameSite,c);p.$modal.modal("hide")}function b(){h.set(p.props.cookieName,JSON.stringify(a(false)),0,p.props.cookieSameSite,c);p.$modal.modal("hide");window.location.href="/445.html"}function s(){h.set(p.props.cookieName,JSON.stringify(a()),p.props.cookieStorageDays,p.props.cookieSameSite,c);p.$modal.modal("hide")}t=(this.props.whitelisted.indexOf(window.location.pathname)>-1);var r=h.get(this.props.cookieName);if((r===undefined||r==="false")&&this.props.autoShowDialog&&!t){m()}v.info("\ninitializing core module finished");v.info("\nstate: finished");this.showDialog=function(){t=(this.props.whitelisted.indexOf(window.location.pathname)>-1);if(!t){m()}};this.getSettings=function(x){var w=h.get(p.props.cookieName);if(w){var y=JSON.parse(h.get(p.props.cookieName));if(x===undefined){return y}else{if(y){return y[x]}else{return false}}}else{return undefined}}};
27
+ "use strict";function CookieConsent(d){var v=log4javascript.getLogger("j1.core.CookieConsent");var p=this;var q=false;var e=new liteURL(window.location.href);var c=(e.protocol.includes("https"))?true:false;var j;var g;var t;v.info("\ninitializing core module: started");v.info("\nstate: started");this.props={autoShowDialog:true,dialogLanguage:"content",dialogLanguages:["en","de"],contentURL:"/assets/data/cookieconsent",postSelectionCallback:"",whitelisted:[],xhrDataElement:"consent-data",dialogContainerID:"consent-modal"};for(var f in d){this.props[f]=d[f]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;this.props.cookieSecure=c;var h={set:function(w,C,E,z,D,A){var B=window.btoa(C);var x="; expires=Thu, 01 Jan 1970 00:00:00 UTC";if(E>0){var y=new Date();y.setTime(y.getTime()+(E*24*60*60*1000));x="; expires="+y.toUTCString()}if(A){document.cookie=w+"="+(B||"")+x+"; Path=/; SameSite="+z+"; Domain="+D+"; Secure="+A+";"}else{document.cookie=w+"="+(B||"")+x+"; Path=/; SameSite="+z+";Domain="+D+"; "}},get:function(x){var A=x+"=";var w=document.cookie.split(";");for(var y=0;y<w.length;y++){var C=w[y];while(C.charAt(0)===" "){C=C.substring(1,C.length)}if(C.indexOf(A)===0){var B=C.substring(A.length,C.length);var z=window.atob(B);return z}}return undefined}};var n={documentReady:function(w){if(document.readyState!=="loading"){w()}else{document.addEventListener("DOMContentLoaded",w)}}};function u(){var w={};var x=false;var y=0;var z=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){x=arguments[0];y++}var B=function(C){for(var D in C){if(Object.prototype.hasOwnProperty.call(C,D)){if(x&&Object.prototype.toString.call(C[D])==="[object Object]"){w[D]=u(true,w[D],C[D])}else{w[D]=C[D]}}}};for(;y<z;y++){var A=arguments[y];B(A)}return w}function i(B,y){var w=Array.prototype.slice.call(arguments,2);var A=B.split(".");var z=A.pop();for(var x=0;x<A.length;x++){y=y[A[x]]}return y[z].apply(y,w)}function m(w){n.documentReady(function(){p.modal=document.getElementById(p.props.dialogContainerID);if(!p.modal){v.info("\nload consent modal");p.modal=document.createElement("div");p.modal.id=p.props.dialogContainerID;p.modal.style.display="none";p.modal.setAttribute("class","modal fade");p.modal.setAttribute("tabindex","-1");p.modal.setAttribute("role","dialog");p.modal.setAttribute("aria-labelledby",p.props.dialogContainerID);document.body.append(p.modal);p.$modal=$(p.modal);p.$modal.on("hidden.bs.modal",function(){i(p.props.postSelectionCallback,window)});var x=p.props.contentURL+"/index.html";$.get(x).done(function(y){v.info("\nloading consent modal: successfully");p.modal.innerHTML=y;p.modal.innerHTML=$("#"+p.props.xhrDataElement).eq(0).html();p.modal.style.display="block";$(p.modal).modal({backdrop:"static",keyboard:false});p.$buttonDoNotAgree=$("#bccs-buttonDoNotAgree");p.$buttonAgree=$("#bccs-buttonAgree");p.$buttonSave=$("#bccs-buttonSave");p.$buttonAgreeAll=$("#bccs-buttonAgreeAll");v.info("\nload/initialze options from cookie");l();k();$("#bccs-options").on("hide.bs.collapse",function(){q=false;l()}).on("show.bs.collapse",function(){q=true;l()});v.info("\ninitialze event handler");p.$buttonDoNotAgree.click(function(){b()});p.$buttonAgree.click(function(){o()});p.$buttonSave.click(function(){$("#bccs-options").collapse("hide");s();k()});p.$buttonAgreeAll.click(function(){$("#bccs-options").collapse("hide");o();k()});p.$modal.modal("show")}).fail(function(){v.error("\nloading consent modal: failed");v.warn("\nprobably no `contentURL` set")})}else{p.$modal.modal("show")}}.bind(this))}function k(){var y=p.getSettings();if(y){for(var x in y){var w=p.$modal.find("#bccs-options .bccs-option[data-name='"+x+"'] input[type='checkbox']");w.prop("checked",y[x])}}}function l(){if(q){p.$buttonDoNotAgree.hide();p.$buttonAgree.hide();p.$buttonSave.show();p.$buttonAgreeAll.show()}else{p.$buttonDoNotAgree.show();p.$buttonAgree.show();p.$buttonSave.hide();p.$buttonAgreeAll.hide()}}function a(x){var w=p.$modal.find("#bccs-options .bccs-option");var z={};for(var A=0;A<w.length;A++){var C=w[A];var y=C.getAttribute("data-name");if(y==="necessary"){z[y]=true}else{if(x===undefined){var B=$(C).find("input[type='checkbox']");z[y]=B.prop("checked")}else{z[y]=!!x}}}return z}function o(){h.set(p.props.cookieName,JSON.stringify(a(true)),p.props.cookieStorageDays,p.props.cookieSameSite,p.props.cookieDomain,c);p.$modal.modal("hide")}function b(){h.set(p.props.cookieName,JSON.stringify(a(false)),0,p.props.cookieSameSite,p.props.cookieDomain,c);p.$modal.modal("hide");window.location.href="/445.html"}function s(){h.set(p.props.cookieName,JSON.stringify(a()),p.props.cookieStorageDays,p.props.cookieSameSite,p.props.cookieDomain,c);p.$modal.modal("hide")}t=(this.props.whitelisted.indexOf(window.location.pathname)>-1);var r=h.get(this.props.cookieName);if((r===undefined||r==="false")&&this.props.autoShowDialog&&!t){m()}v.info("\ninitializing core module finished");v.info("\nstate: finished");this.showDialog=function(){t=(this.props.whitelisted.indexOf(window.location.pathname)>-1);if(!t){m()}};this.getSettings=function(x){var w=h.get(p.props.cookieName);if(w){var y=JSON.parse(h.get(p.props.cookieName));if(x===undefined){return y}else{if(y){return y[x]}else{return false}}}else{return undefined}}};
@@ -168,7 +168,6 @@
168
168
  j1.writeCookie({
169
169
  name: cookie_names.user_state,
170
170
  data: user_state,
171
- samesite: 'Strict',
172
171
  secure: secure,
173
172
  expires: 365
174
173
  });
@@ -19,4 +19,4 @@
19
19
  # The original version cannot be used with J1 for theme menu creation!
20
20
  # -----------------------------------------------------------------------------
21
21
  */
22
- ;(function(d,h,o,g){var b=d.fn.bootstrapThemeSwitcher;var e=j1.getCookieNames();var p=j1.findCookie("_ga");var q=j1.findCookie("j1");var f=new liteURL(h.location.href);var j=f.hostname;var s=j.substring(j.lastIndexOf(".",j.lastIndexOf(".")-1)+1);var l=(f.protocol.includes("https"))?true:false;var r=log4javascript.getLogger("j1.core.switcher");var i;var c;var m={};var k;var a;var n=function(u,t){this.$element=d(u);this.settings=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,t);this.themesList=[];this.getThemes();return this};n.prototype={clear:function(){r.debug("\nbootstrapThemeSwitcher.clear");return this.$element.each(function(){this.$element.empty()})},update:function(){r.debug("\nbootstrapThemeSwitcher.update");this.getThemes()},checkStyleSheetByName:function(t){var w=false;var x="/"+t+"/";var v=new RegExp(x,"i");for(var u=0;u<o.styleSheets.length;u++){if(v.test(o.styleSheets[u].href)){w=true;break}}return w},switchTheme:function(t,z){var A=d(this);var w=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,A.data("bootstrapThemeSwitcher"));var v=w.cssThemeLink;var u=w.debug;var y=this.settings.includeBootswatch;var x;var B;c=j1.existsCookie(e.user_state);if(c){r.debug("\ncookie found: "+e.user_state);m=j1.readCookie(e.user_state)}else{r.error("\ncookie not found: "+e.user_state);r.debug("\nj1 cookies found:"+q.length);q.forEach(function(C){console.log("j1.core.switcher: "+C)});r.debug("\nga cookies found:"+p.length);p.forEach(function(C){console.log("j1.core.switcher: "+C)})}x=m.theme_name;B=m.theme_css;if(typeof z==="undefined"){z=this.settings.defaultCssFile}if(typeof t==="undefined"){t=z}if(w.saveToCookie){if(typeof Cookies==="undefined"){if(u==="true"){r.error("\ncookies library not present")}return false}m.theme_name=t;m.theme_css=z;if(!(m.theme_name.includes("Uno")||m.theme_name=="Bootstrap")){m.theme_author="Bootswatch";m.theme_author_url="https://bootswatch.com/"}else{m.theme_author="J1 Team";m.theme_author_url="https://jekyll.one/"}r.debug("\nwrite to cookie : "+e.user_state);j1.writeCookie({name:e.user_state,data:m,samesite:"Strict",secure:l,expires:365});location.reload(true)}else{r.debug("\nwrite to cookie : disabled");r.warn("\nselected theme not activated: "+t)}},loadThemeFromCookie:function(t){if(typeof Cookies==="undefined"){r.error("\ncookies library not present");return false}var u=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,t);c=j1.existsCookie(e.user_state);if(c){r.info("\ncookie found: "+e.user_state);m=j1.readCookie(e.user_state)}else{r.error("\ncookie not found: "+e.user_state);r.debug("\nj1 cookies found:"+q.length);q.forEach(function(x){console.log("j1.core.switcher: "+x)});r.debug("\nga cookies found:"+p.length);p.forEach(function(x){console.log("j1.core.switcher: "+x)})}var w=m.theme_name;var v=m.theme_css;this.switchTheme(w,v)},addTheme:function(u,t,w,v){if(typeof w==="undefined"){w=0}if(typeof v==="undefined"){v=0}this.themesList.splice(w,v,{name:u,css:t});this.addThemesToControl()},addThemesToControl:function(){if(typeof this.$element==="undefined"){r.error("\nbootstrapThemeSelector|addThemesToControl: Element is undefined");return false}if(typeof this.themesList==="undefined"){r.error("\nbootstrapThemeSelector|addThemesToControl: Themes is undefined");return false}if(this.settings.excludeBootswatch){var A;if(this.settings.excludeBootswatch.indexOf(",")!==-1){A=this.settings.excludeBootswatch.replace(/ /g,"").split(",")}else{A=[];A.push(this.settings.excludeBootswatch)}var w=this.themesList;d.each(w,function(E,F){if(F&&F.name){if(d.inArray(F.name,A)!==-1){w.splice(E,1)}}});this.themesList=w}var v=this;if(this.$element.is("ul")){var B=d(this);var x=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,B.data("bootstrapThemeSwitcher"));var u=x.cssThemeLink;var t=x.debug;var y;c=j1.existsCookie(e.user_state);if(c){r.debug("\nuser state cookie found");m=j1.readCookie(e.user_state)}else{r.error("\nuser state NOT cookie found");r.debug("\nj1 cookies found:"+q.length);q.forEach(function(E){console.log("j1.core.switcher: "+E)});r.debug("\nga cookies found:"+p.length);p.forEach(function(E){console.log("j1.core.switcher: "+E)})}y=m.theme_name;if(t==="true"){r.debug("\nbootstrapThemeSelector: UL element selected")}this.$element.empty();var D;var C="#9E9E9E";d.each(this.themesList,function(F,G){if(v.$element[0].id.includes("mmenu")){D="mmenu-item"}else{D="dropdown-item"}if(G.name===y){if(v.$element[0].id.includes("mmenu")){D="mmenu-item active"}else{D="dropdown-item active"}}var E=d("<li />").attr("class",D).append('<a href="#"><i class="mdi mdi-view-quilt mdi-18px mr-2" style="color: '+C+'"></i>'+G.name+"</a>").on("click",function(){if(x.loadFromBootswatch){v.switchTheme(G.name,G.css)}else{v.switchTheme(G.name,G.cssCdn)}d(this).parent().find("li").removeClass("active");d(this).addClass("active")});v.$element.append(E)})}else{if(this.$element.is("select")){r.debug("\nbootstrapThemeSelector: SELECT element selected");this.$element.empty();var z;d.each(this.themesList,function(E,F){z=null;if(F.name===y){z="selected"}if(x.loadFromBootswatch){v.$element.append("<option "+z+" value='"+F.css+"'>"+F.name+"</option>")}else{v.$element.append("<option "+z+" value='"+F.cssCdn+"'>"+F.name+"</option>")}});this.$element.on("change",function(){var E=d("option:selected",this);v.switchTheme(E.text(),E.val())})}else{r.info("\nbootstrapThemeSelector: no UL or SELECT element found");r.error("\nbootstrapThemeSelector: failed")}}},getThemes:function(){var t=this;if(this.settings.localFeed!==null&&this.settings.localFeed!==""){d.ajax({url:this.settings.localFeed,dataType:"json",success:function(u){t.themesList=u.themes;t.addThemesToControl()},error:function(u,w,v){r.error("\nfailed to retrieve the local feed from: '"+t.settings.localFeed+"'")}})}else{d.ajax({url:this.settings.bootswatchApiUrl+"/"+this.settings.bootswatchApiVersion+".json",dataType:"json",success:function(u){if(typeof u.themes==="undefined"){return null}t.themesList=u.themes;t.themesList.splice(0,0,{name:"default",css:t.settings.defaultCssFile});t.addThemesToControl()}})}},themes:function(t){if(typeof t==="undefined"){return this.themesList}else{this.themesList=t}}};d.fn.bootstrapThemeSwitcher=function(v){var x;var u=Array.prototype.slice.call(arguments,1);var y=d(this);var w=y.data("bootstrapThemeSwitcher");var t=typeof v==="object"&&v;if(!w){y.data("bootstrapThemeSwitcher",(w=new n(this,t)))}if(typeof v==="string"){x=w[v].apply(w,u)}return(typeof x==="undefined")?y:x};d.fn.bootstrapThemeSwitcher.defaults={debug:false,saveToCookie:true,cssThemeLink:"bootstrapTheme",cookieThemeName:"bootstrapTheme.name",cookieThemeCss:"boostrapTheme.css",cookieExpiration:365,cookiePath:"/",defaultCssFile:"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css",bootswatchApiUrl:"https://bootswatch.com/api/",bootswatchApiVersion:"4",loadFromBootswatch:true,localFeed:"",excludeBootswatch:""};d.fn.bootstrapThemeSwitcher.Constructor=n;d.fn.bootstrapThemeSwitcher.noConflict=function(){d.fn.BootstrapThemeSwitcher=b;return this}})(jQuery,window,document);
22
+ ;(function(d,h,o,g){var b=d.fn.bootstrapThemeSwitcher;var e=j1.getCookieNames();var p=j1.findCookie("_ga");var q=j1.findCookie("j1");var f=new liteURL(h.location.href);var j=f.hostname;var s=j.substring(j.lastIndexOf(".",j.lastIndexOf(".")-1)+1);var l=(f.protocol.includes("https"))?true:false;var r=log4javascript.getLogger("j1.core.switcher");var i;var c;var m={};var k;var a;var n=function(u,t){this.$element=d(u);this.settings=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,t);this.themesList=[];this.getThemes();return this};n.prototype={clear:function(){r.debug("\nbootstrapThemeSwitcher.clear");return this.$element.each(function(){this.$element.empty()})},update:function(){r.debug("\nbootstrapThemeSwitcher.update");this.getThemes()},checkStyleSheetByName:function(t){var w=false;var x="/"+t+"/";var v=new RegExp(x,"i");for(var u=0;u<o.styleSheets.length;u++){if(v.test(o.styleSheets[u].href)){w=true;break}}return w},switchTheme:function(t,z){var A=d(this);var w=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,A.data("bootstrapThemeSwitcher"));var v=w.cssThemeLink;var u=w.debug;var y=this.settings.includeBootswatch;var x;var B;c=j1.existsCookie(e.user_state);if(c){r.debug("\ncookie found: "+e.user_state);m=j1.readCookie(e.user_state)}else{r.error("\ncookie not found: "+e.user_state);r.debug("\nj1 cookies found:"+q.length);q.forEach(function(C){console.log("j1.core.switcher: "+C)});r.debug("\nga cookies found:"+p.length);p.forEach(function(C){console.log("j1.core.switcher: "+C)})}x=m.theme_name;B=m.theme_css;if(typeof z==="undefined"){z=this.settings.defaultCssFile}if(typeof t==="undefined"){t=z}if(w.saveToCookie){if(typeof Cookies==="undefined"){if(u==="true"){r.error("\ncookies library not present")}return false}m.theme_name=t;m.theme_css=z;if(!(m.theme_name.includes("Uno")||m.theme_name=="Bootstrap")){m.theme_author="Bootswatch";m.theme_author_url="https://bootswatch.com/"}else{m.theme_author="J1 Team";m.theme_author_url="https://jekyll.one/"}r.debug("\nwrite to cookie : "+e.user_state);j1.writeCookie({name:e.user_state,data:m,secure:l,expires:365});location.reload(true)}else{r.debug("\nwrite to cookie : disabled");r.warn("\nselected theme not activated: "+t)}},loadThemeFromCookie:function(t){if(typeof Cookies==="undefined"){r.error("\ncookies library not present");return false}var u=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,t);c=j1.existsCookie(e.user_state);if(c){r.info("\ncookie found: "+e.user_state);m=j1.readCookie(e.user_state)}else{r.error("\ncookie not found: "+e.user_state);r.debug("\nj1 cookies found:"+q.length);q.forEach(function(x){console.log("j1.core.switcher: "+x)});r.debug("\nga cookies found:"+p.length);p.forEach(function(x){console.log("j1.core.switcher: "+x)})}var w=m.theme_name;var v=m.theme_css;this.switchTheme(w,v)},addTheme:function(u,t,w,v){if(typeof w==="undefined"){w=0}if(typeof v==="undefined"){v=0}this.themesList.splice(w,v,{name:u,css:t});this.addThemesToControl()},addThemesToControl:function(){if(typeof this.$element==="undefined"){r.error("\nbootstrapThemeSelector|addThemesToControl: Element is undefined");return false}if(typeof this.themesList==="undefined"){r.error("\nbootstrapThemeSelector|addThemesToControl: Themes is undefined");return false}if(this.settings.excludeBootswatch){var A;if(this.settings.excludeBootswatch.indexOf(",")!==-1){A=this.settings.excludeBootswatch.replace(/ /g,"").split(",")}else{A=[];A.push(this.settings.excludeBootswatch)}var w=this.themesList;d.each(w,function(E,F){if(F&&F.name){if(d.inArray(F.name,A)!==-1){w.splice(E,1)}}});this.themesList=w}var v=this;if(this.$element.is("ul")){var B=d(this);var x=d.extend({},d.fn.bootstrapThemeSwitcher.defaults,B.data("bootstrapThemeSwitcher"));var u=x.cssThemeLink;var t=x.debug;var y;c=j1.existsCookie(e.user_state);if(c){r.debug("\nuser state cookie found");m=j1.readCookie(e.user_state)}else{r.error("\nuser state NOT cookie found");r.debug("\nj1 cookies found:"+q.length);q.forEach(function(E){console.log("j1.core.switcher: "+E)});r.debug("\nga cookies found:"+p.length);p.forEach(function(E){console.log("j1.core.switcher: "+E)})}y=m.theme_name;if(t==="true"){r.debug("\nbootstrapThemeSelector: UL element selected")}this.$element.empty();var D;var C="#9E9E9E";d.each(this.themesList,function(F,G){if(v.$element[0].id.includes("mmenu")){D="mmenu-item"}else{D="dropdown-item"}if(G.name===y){if(v.$element[0].id.includes("mmenu")){D="mmenu-item active"}else{D="dropdown-item active"}}var E=d("<li />").attr("class",D).append('<a href="#"><i class="mdi mdi-view-quilt mdi-18px mr-2" style="color: '+C+'"></i>'+G.name+"</a>").on("click",function(){if(x.loadFromBootswatch){v.switchTheme(G.name,G.css)}else{v.switchTheme(G.name,G.cssCdn)}d(this).parent().find("li").removeClass("active");d(this).addClass("active")});v.$element.append(E)})}else{if(this.$element.is("select")){r.debug("\nbootstrapThemeSelector: SELECT element selected");this.$element.empty();var z;d.each(this.themesList,function(E,F){z=null;if(F.name===y){z="selected"}if(x.loadFromBootswatch){v.$element.append("<option "+z+" value='"+F.css+"'>"+F.name+"</option>")}else{v.$element.append("<option "+z+" value='"+F.cssCdn+"'>"+F.name+"</option>")}});this.$element.on("change",function(){var E=d("option:selected",this);v.switchTheme(E.text(),E.val())})}else{r.info("\nbootstrapThemeSelector: no UL or SELECT element found");r.error("\nbootstrapThemeSelector: failed")}}},getThemes:function(){var t=this;if(this.settings.localFeed!==null&&this.settings.localFeed!==""){d.ajax({url:this.settings.localFeed,dataType:"json",success:function(u){t.themesList=u.themes;t.addThemesToControl()},error:function(u,w,v){r.error("\nfailed to retrieve the local feed from: '"+t.settings.localFeed+"'")}})}else{d.ajax({url:this.settings.bootswatchApiUrl+"/"+this.settings.bootswatchApiVersion+".json",dataType:"json",success:function(u){if(typeof u.themes==="undefined"){return null}t.themesList=u.themes;t.themesList.splice(0,0,{name:"default",css:t.settings.defaultCssFile});t.addThemesToControl()}})}},themes:function(t){if(typeof t==="undefined"){return this.themesList}else{this.themesList=t}}};d.fn.bootstrapThemeSwitcher=function(v){var x;var u=Array.prototype.slice.call(arguments,1);var y=d(this);var w=y.data("bootstrapThemeSwitcher");var t=typeof v==="object"&&v;if(!w){y.data("bootstrapThemeSwitcher",(w=new n(this,t)))}if(typeof v==="string"){x=w[v].apply(w,u)}return(typeof x==="undefined")?y:x};d.fn.bootstrapThemeSwitcher.defaults={debug:false,saveToCookie:true,cssThemeLink:"bootstrapTheme",cookieThemeName:"bootstrapTheme.name",cookieThemeCss:"boostrapTheme.css",cookieExpiration:365,cookiePath:"/",defaultCssFile:"https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css",bootswatchApiUrl:"https://bootswatch.com/api/",bootswatchApiVersion:"4",loadFromBootswatch:true,localFeed:"",excludeBootswatch:""};d.fn.bootstrapThemeSwitcher.Constructor=n;d.fn.bootstrapThemeSwitcher.noConflict=function(){d.fn.BootstrapThemeSwitcher=b;return this}})(jQuery,window,document);
@@ -37,6 +37,46 @@ function Translator(props) {
37
37
  var navigator_language;
38
38
  var translation_language;
39
39
 
40
+ // ---------------------------------------------------------------------------
41
+ // Cookie()
42
+ // manage cookies
43
+ // ---------------------------------------------------------------------------
44
+ var Cookie = {
45
+ set: function (name, value, days, cookieSameSite, cookieDomain, cookieSecure) {
46
+ var value_encoded = window.btoa(value);
47
+ var expires = '; expires=Thu, 01 Jan 1970 00:00:00 UTC';
48
+ if (days>0) {
49
+ var date = new Date();
50
+ date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
51
+ expires = "; expires=" + date.toUTCString();
52
+ }
53
+ if (cookieSecure) {
54
+ document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; SameSite=' + cookieSameSite + '; ' + 'Domain=' + cookieDomain + '; ' + 'Secure=' + cookieSecure + ';';
55
+ } else {
56
+ document.cookie = name + "=" + (value_encoded || '') + expires + '; Path=/; SameSite=' + cookieSameSite + ';' + 'Domain=' + cookieDomain + '; ';
57
+ }
58
+ },
59
+ get: function (name) {
60
+ var nameEQ = name + '=';
61
+ var ca = document.cookie.split(';');
62
+ for (var i = 0; i < ca.length; i++) {
63
+ var c = ca[i];
64
+ while (c.charAt(0) === ' ') {
65
+ c = c.substring(1, c.length);
66
+ }
67
+ if (c.indexOf(nameEQ) === 0) {
68
+ var value_encoded = c.substring(nameEQ.length, c.length);
69
+ var value = window.atob(value_encoded);
70
+ return value;
71
+ }
72
+ }
73
+ return undefined;
74
+ }
75
+ };
76
+
77
+ logger.info('\n' + 'initializing core module: started');
78
+ logger.info('\n' + 'state: started');
79
+
40
80
  // ---------------------------------------------------------------------------
41
81
  // default property settings
42
82
  // ---------------------------------------------------------------------------
@@ -45,7 +85,7 @@ function Translator(props) {
45
85
  cookieName: 'j1.user.state', // the name of the User State Cookie (primary data)
46
86
  cookieConsentName: 'j1.user.consent', // the name of the Cookie Consent Cookie (secondary data)
47
87
  cookieStorageDays: 365, // the duration the cookie is stored on the client
48
- cookieSameSite: 'Strict', // restrict consent cookie to first-party, do NOT send cookie to other domains
88
+ cookieSameSite: 'Lax', // restrict consent cookie to first-party, do NOT send cookie to other domains
49
89
  cookieSecure: cookieSecure, // secure flag on cookies
50
90
  translationEnabled: false, // enable|disable translation on first page view
51
91
  disableLanguageSelector: false, // disable language dropdown for translation in dialog (modal)
@@ -84,46 +124,33 @@ function Translator(props) {
84
124
  logger.info('\n' + 'initializing core module: started');
85
125
  logger.info('\n' + 'state: started');
86
126
 
87
- // ---------------------------------------------------------------------------
88
- // internal functions
89
- // ---------------------------------------------------------------------------
127
+ var translationDefaultSettings = {
128
+ "translatorName": "google",
129
+ "translationEnabled": false,
130
+ "translateAllPages": true,
131
+ "useLanguageFromBrowser": true,
132
+ "translationLanguage": "de",
133
+ "analysis": true,
134
+ "personalization": true
135
+ };
136
+
137
+ var translatorCookie = Cookie.get(self.props.cookieName);
138
+ if (!translatorCookie) {
139
+ logger.info('\n' + 'initializing translator cookie: ' + self.props.cookieName);
140
+ // enable and write all settings required for translation (translation cookie)
141
+ Cookie.set(
142
+ self.props.cookieName,
143
+ JSON.stringify(translationDefaultSettings),
144
+ self.props.cookieStorageDays,
145
+ self.props.cookieSameSite,
146
+ self.props.cookieDomain,
147
+ self.props.cookieSecure
148
+ );
149
+ }
90
150
 
91
151
  // ---------------------------------------------------------------------------
92
- // Cookie()
93
- // manage cookies
152
+ // internal functions
94
153
  // ---------------------------------------------------------------------------
95
- var Cookie = {
96
- set: function (name, value, days, samesite, secure) {
97
- var value_encoded = window.btoa(value);
98
- var expires = '';
99
- if (days) {
100
- var date = new Date();
101
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
102
- expires = '; expires=' + date.toUTCString();
103
- }
104
- if (secure) {
105
- document.cookie = name + '=' + (value_encoded || '') + expires + '; Path=/; SameSite=' + samesite + '; ' + 'secure=' + secure + ';';
106
- } else {
107
- document.cookie = name + '=' + (value_encoded || '') + expires + '; Path=/; SameSite=' + samesite + ';';
108
- }
109
- },
110
- get: function (name) {
111
- var nameEQ = name + '=';
112
- var ca = document.cookie.split(';');
113
- for (var i = 0; i < ca.length; i++) {
114
- var c = ca[i];
115
- while (c.charAt(0) === ' ') {
116
- c = c.substring(1, c.length);
117
- }
118
- if (c.indexOf(nameEQ) === 0) {
119
- var value_encoded = c.substring(nameEQ.length, c.length);
120
- var value = window.atob(value_encoded);
121
- return value;
122
- }
123
- }
124
- return undefined;
125
- }
126
- };
127
154
 
128
155
  // ---------------------------------------------------------------------------
129
156
  // global event handler
@@ -486,11 +513,15 @@ function Translator(props) {
486
513
  // On 'agreeAll', enable ALL settings required for translation
487
514
  // ---------------------------------------------------------------------------
488
515
  function agreeAll() {
489
- var translationSettings = gatherOptions(true);
490
- var consentSettings = {};
516
+ var consentSettings = JSON.parse(Cookie.get(self.props.cookieConsentName));
517
+ var translationSettings = JSON.parse(Cookie.get(self.props.cookieName));
491
518
 
492
- // enable and write all settings required for translation (consent cookie)
493
- consentSettings = JSON.parse(Cookie.get(self.props.cookieConsentName));
519
+ // enable all settings required for translation
520
+ translationSettings.analysis = true;
521
+ translationSettings.personalization = true;
522
+ translationSettings.translationEnabled = true;
523
+
524
+ // overload user consent settings (consent cookie)
494
525
  consentSettings.analysis = translationSettings.analysis;
495
526
  consentSettings.personalization = translationSettings.personalization;
496
527
 
@@ -498,17 +529,19 @@ function Translator(props) {
498
529
  self.props.cookieConsentName,
499
530
  JSON.stringify(consentSettings),
500
531
  self.props.cookieStorageDays,
501
- self.props.sameSite,
502
- self.props.secure
532
+ self.props.cookieSameSite,
533
+ self.props.cookieDomain,
534
+ self.props.cookieSecure
503
535
  );
504
536
 
505
- // enable and write all settings required for translation (translation cookie)
537
+ // write all settings required for translation (translation cookie)
506
538
  Cookie.set(
507
539
  self.props.cookieName,
508
540
  JSON.stringify(translationSettings),
509
541
  self.props.cookieStorageDays,
510
- self.props.sameSite,
511
- self.props.secure
542
+ self.props.cookieSameSite,
543
+ self.props.cookieDomain,
544
+ self.props.cookieSecure
512
545
  );
513
546
 
514
547
  self.$modal.modal('hide');
@@ -519,15 +552,17 @@ function Translator(props) {
519
552
  // process current settings from checkboxes for button `doNotAgree`
520
553
  // ---------------------------------------------------------------------------
521
554
  function doNotAgree() {
522
- var settings = gatherOptions();
555
+ var translationSettings = gatherOptions();
523
556
 
524
- settings.translationEnabled = false;
557
+ // disable all settings required for translation (translation cookie)
558
+ translationSettings.translationEnabled = false;
525
559
  Cookie.set(
526
560
  self.props.cookieName,
527
- JSON.stringify(settings),
561
+ JSON.stringify(translationSettings),
528
562
  self.props.cookieStorageDays,
529
- self.props.sameSite,
530
- self.props.secure
563
+ self.props.cookieSameSite,
564
+ self.props.cookieDomain,
565
+ self.props.cookieSecure
531
566
  );
532
567
  self.$modal.modal('hide');
533
568
  }
@@ -537,29 +572,29 @@ function Translator(props) {
537
572
  // write current settings from checkboxes to cookie
538
573
  // ---------------------------------------------------------------------------
539
574
  function saveSettings() {
540
- var settings;
541
- var consentSettings = {};
575
+ var translationSettings = gatherOptions();
576
+ var consentSettings = JSON.parse(Cookie.get(self.props.cookieConsentName));
542
577
 
543
578
  // update all cookies required for (google-)translation
544
579
  //
545
- settings = gatherOptions();
546
- consentSettings = JSON.parse(Cookie.get(self.props.cookieConsentName));
547
- consentSettings.analysis = settings.analysis;
548
- consentSettings.personalization = settings.personalization;
580
+ consentSettings.analysis = translationSettings.analysis;
581
+ consentSettings.personalization = translationSettings.personalization;
549
582
 
550
583
  Cookie.set(
551
584
  self.props.cookieConsentName,
552
585
  JSON.stringify(consentSettings),
553
586
  self.props.cookieStorageDays,
554
- self.props.sameSite,
555
- self.props.secure
587
+ self.props.cookieSameSite,
588
+ self.props.cookieDomain,
589
+ self.props.cookieSecure
556
590
  );
557
591
  Cookie.set(
558
592
  self.props.cookieName,
559
- JSON.stringify(gatherOptions()),
593
+ JSON.stringify(translationSettings),
560
594
  self.props.cookieStorageDays,
561
- self.props.sameSite,
562
- self.props.secure
595
+ self.props.cookieSameSite,
596
+ self.props.cookieDomain,
597
+ self.props.cookieSecure
563
598
  );
564
599
  self.$modal.modal('hide');
565
600
  }
@@ -12,4 +12,4 @@
12
12
  # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
13
13
  # -----------------------------------------------------------------------------
14
14
  */
15
- "use strict";function Translator(d){var p=this;var u=log4javascript.getLogger("j1.core.translator");var l=new liteURL(window.location.href);var c=(l.protocol.includes("https"))?true:false;var q=false;var g;var s;this.props={contentURL:"/assets/data/translator",cookieName:"j1.user.state",cookieConsentName:"j1.user.consent",cookieStorageDays:365,cookieSameSite:"Strict",cookieSecure:c,translationEnabled:false,disableLanguageSelector:false,translatorName:"google",translationLanguages:"all",translationLanguage:"auto",translateAllPages:true,hideSuggestionBox:true,hidePoweredBy:true,hideTopFrame:true,dialogLanguage:"content",dialogLanguages:["en","de"],dialogContainerID:"translator-modal",xhrDataElement:"",postSelectionCallback:"",};for(var e in d){this.props[e]=d[e]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;u.info("\ninitializing core module: started");u.info("\nstate: started");var f={set:function(x,z,C,y,A){var B=window.btoa(z);var v="";if(C){var w=new Date();w.setTime(w.getTime()+(C*24*60*60*1000));v="; expires="+w.toUTCString()}if(A){document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+"; secure="+A+";"}else{document.cookie=x+"="+(B||"")+v+"; Path=/; SameSite="+y+";"}},get:function(w){var z=w+"=";var v=document.cookie.split(";");for(var x=0;x<v.length;x++){var B=v[x];while(B.charAt(0)===" "){B=B.substring(1,B.length)}if(B.indexOf(z)===0){var A=B.substring(z.length,B.length);var y=window.atob(A);return y}}return undefined}};var n={documentReady:function(v){if(document.readyState!=="loading"){v()}else{document.addEventListener("DOMContentLoaded",v)}}};function t(){var v={};var w=false;var x=0;var y=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){w=arguments[0];x++}var A=function(B){for(var C in B){if(Object.prototype.hasOwnProperty.call(B,C)){if(w&&Object.prototype.toString.call(B[C])==="[object Object]"){v[C]=t(true,v[C],B[C])}else{v[C]=B[C]}}}};for(;x<y;x++){var z=arguments[x];A(z)}return v}function h(A,x){var v=Array.prototype.slice.call(arguments,2);var z=A.split(".");var y=z.pop();for(var w=0;w<z.length;w++){x=x[z[w]]}return x[y].apply(x,v)}function j(w){var v;var x=t({size:0,width:250,multiple:false,selectedIndex:1,enableAutoFilter:false,visibleRows:null,},w);v="#"+x.selector;$.ajax({url:x.url,dataType:"json",success:function(A){var z=[];if(p.props.translationLanguages.includes("all")){z=A[x.elm]}else{for(var y=0;y<A[x.elm].length;y++){if(p.props.translationLanguages.includes(A[x.elm][y].value)){z.push(A[x.elm][y])}}}if(x.visibleRows>z.length){x.visibleRows=z.length}MsDropdown.make(v,{byJson:{data:z,name:x.name,size:x.size,width:x.width,multiple:x.multiple,},enableAutoFilter:x.enableAutoFilter,visibleRows:x.visibleRows,})},error:function(y,A,z){u.error("\nfailed to retrieve JSON data from: "+x.url)}})}function m(){n.documentReady(function(){p.modal=document.getElementById(p.props.dialogContainerID);if(!p.modal){u.info("\nload consent modal");p.modal=document.createElement("div");p.modal.id=p.props.dialogContainerID;p.modal.style.display="none";p.modal.setAttribute("class","modal fade");p.modal.setAttribute("tabindex","-1");p.modal.setAttribute("role","dialog");p.modal.setAttribute("aria-labelledby",p.props.dialogContainerID);document.body.append(p.modal);p.$modal=$(p.modal);p.$modal.on("show.bs.modal",function(){var w;var x;u.info("\nshow.bs.modal: entered");$.when(j({url:"/assets/data/iso-639-language-codes-flags.json",elm:"iso-639-languages",selector:"dropdownJSON",width:400,visibleRows:8,})).then(function(y){u.info("\ncreating msDropdown from JSON data: finished")})});p.$modal.on("shown.bs.modal",function(){var w;var x;x=setInterval(function(){if(typeof document.getElementById("dropdownJSON").msDropdown!=="undefined"){w=document.getElementById("dropdownJSON").msDropdown;if(!w.length){u.error("\nno msDropdown found in translation dialog");p.$modal.hide()}else{if(p.props.translationLanguage==="auto"){g=navigator.language||navigator.userLanguage;s=g.split("-")[0]}else{s=p.props.translationLanguage}w.selectedIndex=$("#dropdownJSON option[value="+s+"]").index();if(p.props.disableLanguageSelector){w.disabled=true}$("#dropdownJSON").show();$("body").addClass("stop-scrolling");u.info("\nmsDropdown successfully loaded in translation dialog");clearInterval(x)}}},25)});p.$modal.on("hidden.bs.modal",function(){$("body").removeClass("stop-scrolling");h(p.props.postSelectionCallback,window)});var v=p.props.contentURL+"/index.html";$.get(v).done(function(w){u.info("\nloading consent modal: successfully");p.modal.innerHTML=w;p.modal.innerHTML=$("#"+p.props.xhrDataElement).eq(0).html();p.modal.style.display="block";$(p.modal).modal({backdrop:"static",keyboard:false});p.$buttonDoNotAgree=$("#translator-buttonDoNotAgree");p.$buttonAgree=$("#translator-buttonAgree");p.$buttonSave=$("#translator-buttonSave");p.$buttonAgreeAll=$("#translator-buttonAgreeAll");u.info("\nload/initialze options from cookie");k();i();$("#google-options").on("hide.bs.collapse",function(){q=false;k()}).on("show.bs.collapse",function(){q=true;k()});u.info("\ninitialze button event handler");p.$buttonDoNotAgree.click(function(){b()});p.$buttonAgree.click(function(){o()});p.$buttonSave.click(function(){$("#google-options").collapse("hide");r();i()});p.$buttonAgreeAll.click(function(){$("#google-options").collapse("hide");o()});p.$modal.modal("show")}).fail(function(){u.error("\nloading translator dialog (modal): failed");u.warn("\nprobably no|wrong `contentURL` set")})}else{p.$modal.modal("show")}}.bind(this))}function i(){var x=p.getSettings();if(x){for(var w in x){var v=p.$modal.find("#google-options .translator-option[data-name="+w+'] input[type="checkbox"]');v.prop("checked",x[w])}}}function k(){if(q){p.$buttonDoNotAgree.hide();p.$buttonAgree.hide();p.$buttonSave.show();p.$buttonAgreeAll.show()}else{p.$buttonDoNotAgree.show();p.$buttonAgree.show();p.$buttonSave.hide();p.$buttonAgreeAll.hide()}}function a(w){var v=p.$modal.find("#google-options .translator-option");var y={};for(var z=0;z<v.length;z++){var B=v[z];var x=B.getAttribute("data-name");if(x==="necessary"){y[x]=true}else{if(w===undefined){var A=$(B).find('input[type="checkbox"]');y[x]=A.prop("checked")}else{y[x]=!!w}}}return y}function o(){var w=a(true);var v={};v=JSON.parse(f.get(p.props.cookieConsentName));v.analysis=w.analysis;v.personalization=w.personalization;f.set(p.props.cookieConsentName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);f.set(p.props.cookieName,JSON.stringify(w),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}function b(){var v=a();v.translationEnabled=false;f.set(p.props.cookieName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}function r(){var w;var v={};w=a();v=JSON.parse(f.get(p.props.cookieConsentName));v.analysis=w.analysis;v.personalization=w.personalization;f.set(p.props.cookieConsentName,JSON.stringify(v),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);f.set(p.props.cookieName,JSON.stringify(a()),p.props.cookieStorageDays,p.props.sameSite,p.props.secure);p.$modal.modal("hide")}this.showDialog=function(){m()};this.getSettings=function(w){var v=f.get(p.props.cookieName);if(v){var x=JSON.parse(f.get(p.props.cookieName));if(w===undefined){return x}else{if(x){return x[w]}else{return false}}}else{return undefined}};u.info("\ninitializing core module finished");u.info("\nstate: finished")};
15
+ "use strict";function Translator(d){var q=this;var w=log4javascript.getLogger("j1.core.translator");var m=new liteURL(window.location.href);var c=(m.protocol.includes("https"))?true:false;var r=false;var h;var u;var g={set:function(x,D,F,A,E,B){var C=window.btoa(D);var y="; expires=Thu, 01 Jan 1970 00:00:00 UTC";if(F>0){var z=new Date();z.setTime(z.getTime()+(F*24*60*60*1000));y="; expires="+z.toUTCString()}if(B){document.cookie=x+"="+(C||"")+y+"; Path=/; SameSite="+A+"; Domain="+E+"; Secure="+B+";"}else{document.cookie=x+"="+(C||"")+y+"; Path=/; SameSite="+A+";Domain="+E+"; "}},get:function(y){var B=y+"=";var x=document.cookie.split(";");for(var z=0;z<x.length;z++){var D=x[z];while(D.charAt(0)===" "){D=D.substring(1,D.length)}if(D.indexOf(B)===0){var C=D.substring(B.length,D.length);var A=window.atob(C);return A}}return undefined}};w.info("\ninitializing core module: started");w.info("\nstate: started");this.props={contentURL:"/assets/data/translator",cookieName:"j1.user.state",cookieConsentName:"j1.user.consent",cookieStorageDays:365,cookieSameSite:"Lax",cookieSecure:c,translationEnabled:false,disableLanguageSelector:false,translatorName:"google",translationLanguages:"all",translationLanguage:"auto",translateAllPages:true,hideSuggestionBox:true,hidePoweredBy:true,hideTopFrame:true,dialogLanguage:"content",dialogLanguages:["en","de"],dialogContainerID:"translator-modal",xhrDataElement:"",postSelectionCallback:"",};for(var f in d){this.props[f]=d[f]}if(this.props.dialogLanguage.indexOf("-")!==-1){this.props.dialogLanguage=this.props.dialogLanguage.split("-")[0]}if(!this.props.dialogLanguages.includes(this.props.dialogLanguage)){this.props.dialogLanguage=this.props.dialogLanguages[0]}this.props.xhrDataElement=this.props.xhrDataElement+"-"+this.props.dialogLanguage;w.info("\ninitializing core module: started");w.info("\nstate: started");var s={translatorName:"google",translationEnabled:false,translateAllPages:true,useLanguageFromBrowser:true,translationLanguage:"de",analysis:true,personalization:true};var e=g.get(q.props.cookieName);if(!e){w.info("\ninitializing translator cookie: "+q.props.cookieName);g.set(q.props.cookieName,JSON.stringify(s),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure)}var o={documentReady:function(x){if(document.readyState!=="loading"){x()}else{document.addEventListener("DOMContentLoaded",x)}}};function v(){var x={};var y=false;var z=0;var A=arguments.length;if(Object.prototype.toString.call(arguments[0])==="[object Boolean]"){y=arguments[0];z++}var C=function(D){for(var E in D){if(Object.prototype.hasOwnProperty.call(D,E)){if(y&&Object.prototype.toString.call(D[E])==="[object Object]"){x[E]=v(true,x[E],D[E])}else{x[E]=D[E]}}}};for(;z<A;z++){var B=arguments[z];C(B)}return x}function i(C,z){var x=Array.prototype.slice.call(arguments,2);var B=C.split(".");var A=B.pop();for(var y=0;y<B.length;y++){z=z[B[y]]}return z[A].apply(z,x)}function k(y){var x;var z=v({size:0,width:250,multiple:false,selectedIndex:1,enableAutoFilter:false,visibleRows:null,},y);x="#"+z.selector;$.ajax({url:z.url,dataType:"json",success:function(C){var B=[];if(q.props.translationLanguages.includes("all")){B=C[z.elm]}else{for(var A=0;A<C[z.elm].length;A++){if(q.props.translationLanguages.includes(C[z.elm][A].value)){B.push(C[z.elm][A])}}}if(z.visibleRows>B.length){z.visibleRows=B.length}MsDropdown.make(x,{byJson:{data:B,name:z.name,size:z.size,width:z.width,multiple:z.multiple,},enableAutoFilter:z.enableAutoFilter,visibleRows:z.visibleRows,})},error:function(A,C,B){w.error("\nfailed to retrieve JSON data from: "+z.url)}})}function n(){o.documentReady(function(){q.modal=document.getElementById(q.props.dialogContainerID);if(!q.modal){w.info("\nload consent modal");q.modal=document.createElement("div");q.modal.id=q.props.dialogContainerID;q.modal.style.display="none";q.modal.setAttribute("class","modal fade");q.modal.setAttribute("tabindex","-1");q.modal.setAttribute("role","dialog");q.modal.setAttribute("aria-labelledby",q.props.dialogContainerID);document.body.append(q.modal);q.$modal=$(q.modal);q.$modal.on("show.bs.modal",function(){var y;var z;w.info("\nshow.bs.modal: entered");$.when(k({url:"/assets/data/iso-639-language-codes-flags.json",elm:"iso-639-languages",selector:"dropdownJSON",width:400,visibleRows:8,})).then(function(A){w.info("\ncreating msDropdown from JSON data: finished")})});q.$modal.on("shown.bs.modal",function(){var y;var z;z=setInterval(function(){if(typeof document.getElementById("dropdownJSON").msDropdown!=="undefined"){y=document.getElementById("dropdownJSON").msDropdown;if(!y.length){w.error("\nno msDropdown found in translation dialog");q.$modal.hide()}else{if(q.props.translationLanguage==="auto"){h=navigator.language||navigator.userLanguage;u=h.split("-")[0]}else{u=q.props.translationLanguage}y.selectedIndex=$("#dropdownJSON option[value="+u+"]").index();if(q.props.disableLanguageSelector){y.disabled=true}$("#dropdownJSON").show();$("body").addClass("stop-scrolling");w.info("\nmsDropdown successfully loaded in translation dialog");clearInterval(z)}}},25)});q.$modal.on("hidden.bs.modal",function(){$("body").removeClass("stop-scrolling");i(q.props.postSelectionCallback,window)});var x=q.props.contentURL+"/index.html";$.get(x).done(function(y){w.info("\nloading consent modal: successfully");q.modal.innerHTML=y;q.modal.innerHTML=$("#"+q.props.xhrDataElement).eq(0).html();q.modal.style.display="block";$(q.modal).modal({backdrop:"static",keyboard:false});q.$buttonDoNotAgree=$("#translator-buttonDoNotAgree");q.$buttonAgree=$("#translator-buttonAgree");q.$buttonSave=$("#translator-buttonSave");q.$buttonAgreeAll=$("#translator-buttonAgreeAll");w.info("\nload/initialze options from cookie");l();j();$("#google-options").on("hide.bs.collapse",function(){r=false;l()}).on("show.bs.collapse",function(){r=true;l()});w.info("\ninitialze button event handler");q.$buttonDoNotAgree.click(function(){b()});q.$buttonAgree.click(function(){p()});q.$buttonSave.click(function(){$("#google-options").collapse("hide");t();j()});q.$buttonAgreeAll.click(function(){$("#google-options").collapse("hide");p()});q.$modal.modal("show")}).fail(function(){w.error("\nloading translator dialog (modal): failed");w.warn("\nprobably no|wrong `contentURL` set")})}else{q.$modal.modal("show")}}.bind(this))}function j(){var z=q.getSettings();if(z){for(var y in z){var x=q.$modal.find("#google-options .translator-option[data-name="+y+'] input[type="checkbox"]');x.prop("checked",z[y])}}}function l(){if(r){q.$buttonDoNotAgree.hide();q.$buttonAgree.hide();q.$buttonSave.show();q.$buttonAgreeAll.show()}else{q.$buttonDoNotAgree.show();q.$buttonAgree.show();q.$buttonSave.hide();q.$buttonAgreeAll.hide()}}function a(y){var x=q.$modal.find("#google-options .translator-option");var A={};for(var B=0;B<x.length;B++){var D=x[B];var z=D.getAttribute("data-name");if(z==="necessary"){A[z]=true}else{if(y===undefined){var C=$(D).find('input[type="checkbox"]');A[z]=C.prop("checked")}else{A[z]=!!y}}}return A}function p(){var x=JSON.parse(g.get(q.props.cookieConsentName));var y=JSON.parse(g.get(q.props.cookieName));y.analysis=true;y.personalization=true;y.translationEnabled=true;x.analysis=y.analysis;x.personalization=y.personalization;g.set(q.props.cookieConsentName,JSON.stringify(x),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure);g.set(q.props.cookieName,JSON.stringify(y),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure);q.$modal.modal("hide")}function b(){var x=a();x.translationEnabled=false;g.set(q.props.cookieName,JSON.stringify(x),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure);q.$modal.modal("hide")}function t(){var y=a();var x=JSON.parse(g.get(q.props.cookieConsentName));x.analysis=y.analysis;x.personalization=y.personalization;g.set(q.props.cookieConsentName,JSON.stringify(x),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure);g.set(q.props.cookieName,JSON.stringify(y),q.props.cookieStorageDays,q.props.cookieSameSite,q.props.cookieDomain,q.props.cookieSecure);q.$modal.modal("hide")}this.showDialog=function(){n()};this.getSettings=function(y){var x=g.get(q.props.cookieName);if(x){var z=JSON.parse(g.get(q.props.cookieName));if(y===undefined){return z}else{if(z){return z[y]}else{return false}}}else{return undefined}};w.info("\ninitializing core module finished");w.info("\nstate: finished")};
data/lib/j1/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module J1
2
- VERSION = '2022.0.5'
2
+ VERSION = '2022.0.9'
3
3
  end
@@ -53,7 +53,7 @@ gem 'jekyll', '~> 4.2'
53
53
 
54
54
  # Theme Rubies, default: J1 Template (NOT used for the development system)
55
55
  #
56
- gem 'j1-template', '~> 2022.0.5'
56
+ gem 'j1-template', '~> 2022.0.9'
57
57
 
58
58
  # ------------------------------------------------------------------------------
59
59
  # PRODUCTION: Gem needed for the Jekyll and J1 prod environment
@@ -53,7 +53,7 @@ environment: development
53
53
  # ------------------------------------------------------------------------------
54
54
  # Sets the build version of J1 Template Gem
55
55
  #
56
- version: 2022.0.5
56
+ version: 2022.0.9
57
57
 
58
58
  # version
59
59
  # ------------------------------------------------------------------------------
@@ -729,7 +729,7 @@ defaults:
729
729
  follow: false
730
730
 
731
731
  personalization: false
732
- exclude_from_search: false
732
+ exclude_from_search: true
733
733
 
734
734
  analytics: false
735
735
  comments: false
@@ -737,7 +737,6 @@ defaults:
737
737
  youtube: false
738
738
  vimeo: false
739
739
 
740
-
741
740
  # ==============================================================================
742
741
  # 6. LAYOUT configuration
743
742
  #
@@ -0,0 +1,30 @@
1
+ # ------------------------------------------------------------------------------
2
+ # ~/_data/modules/cookies.yml
3
+ # User configuration settings for J1 Cookie module
4
+ #
5
+ # Product/Info:
6
+ # https://jekyll.one
7
+ #
8
+ # Copyright (C) 2021 Juergen Adams
9
+ #
10
+ # J1 Template is licensed under the MIT License.
11
+ # See: https://github.com/jekyll-one/J1 Template/blob/master/LICENSE
12
+ # ------------------------------------------------------------------------------
13
+
14
+ # ------------------------------------------------------------------------------
15
+ # Description (used for J1 CC only)
16
+ #
17
+ description:
18
+
19
+ title: Cookies
20
+ scope: User settings
21
+ location: _data/modules/cookies.yml
22
+
23
+ # ------------------------------------------------------------------------------
24
+ # User configuration settings
25
+ #
26
+ settings:
27
+ check_cookies: true
28
+
29
+ # ------------------------------------------------------------------------------
30
+ # END config
@@ -31,9 +31,9 @@ defaults:
31
31
  dialogLanguage: content # auto|content|one of dialogLanguages
32
32
  dialogLanguages: [en, de] # supported dialog (modal) languages, defaults to FIRST language defined by languages
33
33
  contentURL: /assets/data/cookieconsent # dialog content (modals) for all supported languages
34
- cookieName: j1.user.consent # name of the user consent cookie
35
- cookieStorageDays: 365 # duration the consent cookie is stored
36
- cookieSameSite: Strict # restrict consent cookie to first-party, do NOT send cookie to other domains
34
+ # cookieName: j1.user.consent # name of the user consent cookie
35
+ # cookieStorageDays: 365 # duration the consent cookie is stored
36
+ # cookieSameSite: Strict # restrict consent cookie to first-party, do NOT send cookie to other domains
37
37
  reloadPageOnChange: true # reload current page if user settings has been changed
38
38
  whitelisted: [ '/pages/public/legal/en/privacy' ] # pages NO consent issued, currently NOT supported
39
39
  xhrDataElement: consent-data # container for all language-specific consent modals (taken from contentURL)