chefcookie 2.7.7 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [2.7.6](https://github.com/vielhuber/chefcookie/compare/2.7.6...2.7.6)
7
+ #### [2.7.8](https://github.com/vielhuber/chefcookie/compare/2.7.8...2.7.8)
8
+
9
+ #### [2.7.8](https://github.com/vielhuber/chefcookie/compare/2.7.7...2.7.8)
10
+
11
+ > 16 January 2023
12
+
13
+ - Build minified version. [`8cd4853`](https://github.com/vielhuber/chefcookie/commit/8cd4853c8443efcd535891b870f5e076e31f5463)
14
+
15
+ #### [2.7.7](https://github.com/vielhuber/chefcookie/compare/2.7.6...2.7.7)
16
+
17
+ > 16 January 2023
18
+
19
+ - Improve position of page during open banner, improve cleanup. [`9505cda`](https://github.com/vielhuber/chefcookie/commit/9505cda2394eef379dc576f0c0cb172270531b4f)
20
+ - Update changelog. [`6cab245`](https://github.com/vielhuber/chefcookie/commit/6cab2459c44dd1c1a287a6e760902366791efaa9)
21
+ - Improve position of page during open banner, improve cleanup. [`26890bc`](https://github.com/vielhuber/chefcookie/commit/26890bcfcf9db93e7b23bfa0be687a77f27040a8)
8
22
 
9
23
  #### [2.7.6](https://github.com/vielhuber/chefcookie/compare/2.7.5...2.7.6)
10
24
 
package/README.md CHANGED
@@ -80,6 +80,7 @@ const cc = new chefcookie({
80
80
  scripts_selection: 'collapse', // false|true|'collapse'
81
81
  debug_log: false,
82
82
  consent_tracking: null, // '/wp-json/v1/track-consent.php'
83
+ lng_fallback: null, // lng code used in labels when current lng is not found (e.g. "en")
83
84
  expiration: 7, // in days
84
85
  cookie_prefix: 'cc_', // switch cookie prefix (e.g. for different pages on the same top level domain)
85
86
  exclude_ua_regex: /(Speed Insights|Chrome-Lighthouse|PSTS[\d\.]+)/,
package/_build/script.js CHANGED
@@ -123,7 +123,9 @@ var chefcookie = /*#__PURE__*/function () {
123
123
  defaultHtmlScrollBehavior = window.getComputedStyle(document.documentElement).scrollBehavior;
124
124
  document.documentElement.style.scrollBehavior = 'auto';
125
125
  }
126
- document.body.style.top = 'auto';
126
+ document.body.style.top = '';
127
+ document.body.style.left = '';
128
+ document.body.style.right = '';
127
129
  window.scrollTo(0, this.scrollPosition);
128
130
  if (defaultBodyScrollBehavior !== null) {
129
131
  document.body.style.scrollBehavior = defaultBodyScrollBehavior;
@@ -349,6 +351,8 @@ var chefcookie = /*#__PURE__*/function () {
349
351
  if (this.config.style.layout !== 'topbar') {
350
352
  this.scrollPosition = window.pageYOffset;
351
353
  document.body.style.top = -this.scrollPosition + 'px';
354
+ document.body.style.left = '0px';
355
+ document.body.style.right = '0px';
352
356
  }
353
357
  document.documentElement.classList.add('chefcookie--noscroll');
354
358
  }
@@ -1257,6 +1261,9 @@ var chefcookie = /*#__PURE__*/function () {
1257
1261
  }
1258
1262
  var lng = this.lng();
1259
1263
  if (!(lng in obj)) {
1264
+ if ('lng_fallback' in this.config && this.config.lng_fallback !== false && this.config.lng_fallback !== undefined && this.config.lng_fallback !== null && this.config.lng_fallback !== '' && this.config.lng_fallback in obj) {
1265
+ return obj[this.config.lng_fallback];
1266
+ }
1260
1267
  return Object.values(obj)[0];
1261
1268
  }
1262
1269
  return obj[lng];