j1-template 2021.2.9 → 2021.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f64e1d499ca9e8ece6d9a0cbe0801a435bca3c67cb88933a4d0612df00012015
4
- data.tar.gz: 50a27e100d831f61f1f4a0f5a9cf83b063faf91a229f58082c028f93da7ff400
3
+ metadata.gz: 91ee0616f0905e55586302ee465112ca879423feebacb51e93e04f92f4978189
4
+ data.tar.gz: c64b4a5cfab5cef176f43568c76c5ec0c2550fb7cc8a37df5e8ac97f5cbb957f
5
5
  SHA512:
6
- metadata.gz: fb2a39afa3c93c9c9a90bdf0842bd5682e707c6a4826a883e2891667ebee55fc4db3b58f5de1119f29925dd91c2458074a12641e1e61e1a161e39ac881dcb794
7
- data.tar.gz: 074bc700d955b9920639dfcbe8af2fe5612ab37e2769e5412039021b72a133661cccfd183bf3b9b20bd1e5fa724ac7e2a92a484d10df68f0b7fbb910991a689b
6
+ metadata.gz: 40b74cefa0cf230f69156a18b42e6df4932187c6b3b05083efdf11f6d84126e0bcc1279c375692a3360f539b183ab7de2b32a89eb584aadf8e039813bde69aba
7
+ data.tar.gz: 14207a1cd40024aaae0fe3c83a1aa0a72b36e2ba348315e3e2c06b0a8625b38be8405bbce5719c85bb1f00d8f6819e604803575f76a4dbbadb5c5010eca8b09a
@@ -174,7 +174,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
174
174
  logger.info('\n' + 'state: ' + _this.getState());
175
175
  logger.info('\n' + 'module is being initialized');
176
176
 
177
- j1.cookieConsent = new BootstrapCookieConsent({
177
+ j1.cookieConsent = new CookieConsent ({
178
178
  contentURL: moduleOptions.contentURL, // dialog content (modals) for all supported languages
179
179
  cookieName: moduleOptions.cookieName, // name of the consent cookie
180
180
  cookieSameSite: moduleOptions.cookieSameSite, // restrict consent cookie
@@ -183,7 +183,7 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
183
183
  reloadPageOnChange: moduleOptions.reloadPageOnChange, // reload if setzings has changed
184
184
  dialogContainerID: moduleOptions.dialogContainerID, // container, the dialog modal is (dynamically) loaded
185
185
  xhrDataElement: moduleOptions.xhrDataElement, // container for all language-specific dialogs (modals)
186
- postSelectionCallback: function () {j1.adapter.cookieConsent.cbCookie()}
186
+ postSelectionCallback: moduleOptions.postSelectionCallback, // callback function, called after the user has made his selection
187
187
  });
188
188
 
189
189
  _this.setState('finished');
@@ -303,7 +303,8 @@ j1.adapter['cookieConsent'] = (function (j1, window) {
303
303
  name: cookie_names.user_translate,
304
304
  data: user_translate,
305
305
  samesite: 'Strict',
306
- secure: secure
306
+ secure: secure,
307
+ expires: 365
307
308
  });
308
309
 
309
310
  }
@@ -87,7 +87,6 @@ j1.adapter['translator'] = (function (j1, window) {
87
87
  var user_translate = {};
88
88
  var _this;
89
89
  var $modal;
90
- var domain;
91
90
  var cookie_names;
92
91
  var user_consent;
93
92
  var logger;
@@ -95,7 +94,7 @@ j1.adapter['translator'] = (function (j1, window) {
95
94
  var baseUrl;
96
95
  var hostname;
97
96
  var domain;
98
- var cookie_sub_domains;
97
+ var cookie_domain;
99
98
  var secure;
100
99
  var logText;
101
100
  var cookie_written;
@@ -170,6 +169,7 @@ j1.adapter['translator'] = (function (j1, window) {
170
169
  baseUrl = url.origin;
171
170
  hostname = url.hostname;
172
171
  domain = hostname.substring(hostname.lastIndexOf('.', hostname.lastIndexOf('.') - 1) + 1);
172
+ cookie_domain = (domain.includes('.')) ? '.' + domain : domain;
173
173
  secure = (url.protocol.includes('https')) ? true : false;
174
174
  modal_language = "{{site.language}}";
175
175
  navigator_language = navigator.language || navigator.userLanguage; // userLanguage for MS IE compatibility
@@ -190,13 +190,6 @@ j1.adapter['translator'] = (function (j1, window) {
190
190
  'translationLanguage': translation_language,
191
191
  };
192
192
 
193
- // set sub domain settings for cookies
194
- if(domain !== 'localhost') {
195
- cookie_sub_domains = '.' + hostname;
196
- } else {
197
- cookie_sub_domains = hostname;
198
- }
199
-
200
193
  // load|initialize user translate cookie
201
194
  if (j1.existsCookie(cookie_names.user_translate)) {
202
195
  user_translate = j1.readCookie(cookie_names.user_translate);
@@ -206,6 +199,7 @@ j1.adapter['translator'] = (function (j1, window) {
206
199
  name: cookie_names.user_translate,
207
200
  data: user_translate,
208
201
  samesite: 'Strict',
202
+ secure: secure,
209
203
  expires: 365
210
204
  });
211
205
  }
@@ -272,7 +266,8 @@ j1.adapter['translator'] = (function (j1, window) {
272
266
  name: cookie_names.user_translate,
273
267
  data: user_translate,
274
268
  samesite: 'Strict',
275
- secure: secure
269
+ secure: secure,
270
+ expires: 365
276
271
  });
277
272
 
278
273
  j1.translator = new Translator({
@@ -300,7 +295,10 @@ j1.adapter['translator'] = (function (j1, window) {
300
295
  }
301
296
  } else {
302
297
  if (moduleOptions.translatorName === 'google') {
303
- j1.removeCookie({name: 'googtrans', domain: domain});
298
+ // remove all googtrans cookies that POTENTIALLY exists
299
+ Cookies.remove('googtrans', { domain: cookie_domain });
300
+ Cookies.remove('googtrans', { domain: hostname });
301
+ Cookies.remove('googtrans');
304
302
  }
305
303
  }
306
304
 
@@ -395,7 +393,7 @@ j1.adapter['translator'] = (function (j1, window) {
395
393
  data: user_consent,
396
394
  samesite: 'Strict',
397
395
  secure: secure,
398
- expires: 0
396
+ expires: 365
399
397
  });
400
398
 
401
399
  // set transCode settings
@@ -403,11 +401,13 @@ j1.adapter['translator'] = (function (j1, window) {
403
401
  destLang = translation_language;
404
402
  transCode = '/' + srcLang + '/' + selectedTranslationLanguage;
405
403
 
406
- // write the googtrans cookie
407
- setCookie({
408
- name: 'googtrans',
409
- data: transCode
410
- });
404
+ // remove all googtrans cookies that POTENTIALLY exists
405
+ Cookies.remove('googtrans', { domain: cookie_domain });
406
+ Cookies.remove('googtrans', { domain: hostname });
407
+ Cookies.remove('googtrans');
408
+
409
+ // write the googtrans cookie w/o DOMAIN!
410
+ Cookies.set('googtrans', transCode);
411
411
 
412
412
  // reload current page (skip cache)
413
413
  location.reload(true);
@@ -37,7 +37,7 @@
37
37
  /* eslint JSUnfilteredForInLoop: "off" */
38
38
  // -----------------------------------------------------------------------------
39
39
 
40
- function BootstrapCookieConsent(props) {
40
+ function CookieConsent(props) {
41
41
  var logger = log4javascript.getLogger('j1.core.bsCookieConsent');
42
42
  var self = this;
43
43
  var detailedSettingsShown = false;
@@ -58,11 +58,12 @@ function BootstrapCookieConsent(props) {
58
58
  contentURL: '/assets/data/cookieconsent', // URL contain the consent dialogs (modals) for ALL supported languages
59
59
  cookieName: 'j1.user.translate', // name of the cookie, in which the configuration is stored
60
60
  cookieStorageDays: 365, // duration the configuration cookie is stored on the client
61
- postSelectionCallback: undefined, // callback function, called after the user has made his selection
61
+ postSelectionCallback: '', // callback function, called after the user has made his selection
62
62
  whitelisted: [], // pages NO consent modal dialog is issued
63
63
  xhrDataElement: 'consent-data', // src container for all language-specific consent dialogs (taken from contentURL)
64
64
  dialogContainerID: 'consent-modal', // dest container, the dialog modal is loaded (dynamically)
65
65
  cookieSameSite: 'Strict', // restrict the consent cookie to first-party (do NOT send cookie to other domains)
66
+ cookieSecure: true
66
67
  };
67
68
 
68
69
  // merge property settings
@@ -128,6 +129,59 @@ function BootstrapCookieConsent(props) {
128
129
  }
129
130
  };
130
131
 
132
+ // ---------------------------------------------------------------------------
133
+ // extend()
134
+ // deep merge of two objects
135
+ // ---------------------------------------------------------------------------
136
+ function extend () {
137
+ var extended = {};
138
+ var deep = false;
139
+ var i = 0;
140
+ var length = arguments.length;
141
+
142
+ // Check if a deep merge
143
+ if ( Object.prototype.toString.call( arguments[0] ) === '[object Boolean]' ) {
144
+ deep = arguments[0];
145
+ i++;
146
+ }
147
+
148
+ // Merge the object into the extended object
149
+ var merge = function (obj) {
150
+ for ( var prop in obj ) {
151
+ if ( Object.prototype.hasOwnProperty.call( obj, prop ) ) {
152
+ // If deep merge and property is an object, merge properties
153
+ if ( deep && Object.prototype.toString.call(obj[prop]) === '[object Object]' ) {
154
+ extended[prop] = extend( true, extended[prop], obj[prop] );
155
+ } else {
156
+ extended[prop] = obj[prop];
157
+ }
158
+ }
159
+ }
160
+ };
161
+
162
+ // Loop through each object and conduct a merge
163
+ for ( ; i < length; i++ ) {
164
+ var obj = arguments[i];
165
+ merge(obj);
166
+ }
167
+ return extended;
168
+ }
169
+
170
+ // ---------------------------------------------------------------------------
171
+ // executeFunctionByName()
172
+ // execute a function by NAME (functionName) in a browser context
173
+ // (e.g. window) the function is published
174
+ // ---------------------------------------------------------------------------
175
+ function executeFunctionByName (functionName, context /*, args */) {
176
+ var args = Array.prototype.slice.call(arguments, 2);
177
+ var namespaces = functionName.split('.');
178
+ var func = namespaces.pop();
179
+ for(var i = 0; i < namespaces.length; i++) {
180
+ context = context[namespaces[i]];
181
+ }
182
+ return context[func].apply(context, args);
183
+ }
184
+
131
185
  function showDialog(options) {
132
186
  Events.documentReady(function () {
133
187
 
@@ -143,11 +197,17 @@ function BootstrapCookieConsent(props) {
143
197
  document.body.append(self.modal);
144
198
  self.$modal = $(self.modal);
145
199
 
146
- if (self.props.postSelectionCallback) {
147
- self.$modal.on("hidden.bs.modal", function () {
148
- self.props.postSelectionCallback();
149
- });
150
- }
200
+ // ---------------------------------------------------------------------
201
+ // register events for the dialog (modal)
202
+ // ---------------------------------------------------------------------
203
+
204
+ // ---------------------------------------------------------------------
205
+ // on 'hidden'
206
+ // ---------------------------------------------------------------------
207
+ self.$modal.on('hidden.bs.modal', function () {
208
+ // process settings after the user has made his selections
209
+ executeFunctionByName (self.props.postSelectionCallback, window);
210
+ }); // END modal on 'hidden'
151
211
 
152
212
  // load modal content
153
213
  //
@@ -253,12 +313,12 @@ function BootstrapCookieConsent(props) {
253
313
  }
254
314
 
255
315
  function agreeAll() {
256
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.cookieSameSite, self.props.cookieSecure);
316
+ Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(true)), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
257
317
  self.$modal.modal('hide');
258
318
  }
259
319
 
260
320
  function doNotAgree() {
261
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays, self.props.cookieSameSite, self.props.cookieSecure);
321
+ Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions(false)), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
262
322
 
263
323
  // jadams, 2021-07-15: all cookies NOT longer supported by j1.expireCookie
264
324
  // TODO: Create loop over all cookies found in page
@@ -271,7 +331,7 @@ function BootstrapCookieConsent(props) {
271
331
  }
272
332
 
273
333
  function saveSettings() {
274
- Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.cookieSameSite, self.props.cookieSecure);
334
+ Cookie.set(self.props.cookieName, JSON.stringify(gatherOptions()), self.props.cookieStorageDays, self.props.cookieSameSite, cookieSecure);
275
335
  self.$modal.modal('hide');
276
336
  }
277
337
 
data/lib/j1/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module J1
2
- VERSION = '2021.2.9'
2
+ VERSION = '2021.2.10'
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', '~> 2021.2.9'
56
+ gem 'j1-template', '~> 2021.2.10'
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: 2021.2.9
56
+ version: 2021.2.10
57
57
 
58
58
  # version
59
59
  # ------------------------------------------------------------------------------
@@ -27,7 +27,6 @@ settings:
27
27
 
28
28
  enabled: true
29
29
  show_cookie_icon: true
30
- reloadPageOnChange: true
31
30
 
32
31
  # ------------------------------------------------------------------------------
33
32
  # END config
@@ -25,6 +25,8 @@ about_config:
25
25
  defaults:
26
26
 
27
27
  enabled: false
28
+
29
+ reloadPageOnChange: true
28
30
  autoShowDialog: true # show consent dialog if NO consent cookie found
29
31
  dialogLanguage: content # auto|content|one of dialogLanguages
30
32
  dialogLanguages: [en, de] # supported dialog (modal) languages, defaults to FIRST language defined by languages
@@ -36,7 +38,7 @@ defaults:
36
38
  whitelisted: [ '/pages/public/legal/en/privacy' ] # pages NO consent issued, currently NOT supported
37
39
  xhrDataElement: consent-data # container for all language-specific consent modals (taken from contentURL)
38
40
  dialogContainerID: consent-dialog # container, the dialog modal is (dynamically) loaded
39
- postSelectionCallback: j1.adapter.cookieConsent.cbCookie # currently hardcoded
41
+ postSelectionCallback: j1.adapter.cookieConsent.cbCookie # called after the user has made his selection
40
42
 
41
43
  modal_settings:
42
44
 
@@ -46,7 +46,7 @@ defaults:
46
46
  #
47
47
  google:
48
48
 
49
- postSelectionCallback: "j1.adapter.translator.cbGoogle" # callback to run the translation
49
+ postSelectionCallback: j1.adapter.translator.cbGoogle # callback to run the translation
50
50
  hideSuggestionBox: true # disable suggestions on translated text
51
51
  hidePoweredBy: true # disable label "Powered by Google"
52
52
  hideTopFrame: true # disable the (google) translator frame
@@ -433,7 +433,7 @@ end::tables[]
433
433
  // -----------------------------------------------------------------------------
434
434
  tag::products[]
435
435
  :j1--license: MIT License
436
- :j1--version: 2021.2.9
436
+ :j1--version: 2021.2.10
437
437
  :j1--site-name: Jekyll One
438
438
  end::products[]
439
439
 
@@ -364,6 +364,6 @@ end
364
364
 
365
365
  module Jekyll
366
366
  module J1LunrSearch
367
- VERSION = '2021.2.9'
367
+ VERSION = '2021.2.10'
368
368
  end
369
369
  end
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": true,
3
3
  "name": "j1_starter",
4
- "version": "2021.2.9",
4
+ "version": "2021.2.10",
5
5
  "description": "J1 Template Starter Web",
6
6
  "homepage": "https://your.site",
7
7
  "author": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": true,
3
3
  "name": "utls",
4
- "version": "2021.2.9",
4
+ "version": "2021.2.10",
5
5
  "description": "J1 Template Utility Server",
6
6
  "homepage": "https://jekyll.one",
7
7
  "author": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": true,
3
3
  "name": "utls",
4
- "version": "2021.2.9",
4
+ "version": "2021.2.10",
5
5
  "description": "J1 Template Utility Server",
6
6
  "homepage": "https://jekyll.one",
7
7
  "author": {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: j1-template
3
3
  version: !ruby/object:Gem::Version
4
- version: 2021.2.9
4
+ version: 2021.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - juergen_jekyll_one