chefcookie 2.9.0 → 2.9.4

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/_build/script.js CHANGED
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
8
  require("mdn-polyfills/Object.entries");
10
9
  require("mdn-polyfills/Object.values");
11
10
  require("mdn-polyfills/Number.isInteger");
@@ -15,8 +14,8 @@ require("@babel/polyfill/noConflict");
15
14
  var _helper = _interopRequireDefault(require("./_helper"));
16
15
  var cookie = _interopRequireWildcard(require("cookie"));
17
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
18
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
19
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // ie11 support
17
+ // ie11 support
18
+
20
19
  class chefcookie {
21
20
  constructor() {
22
21
  let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -24,7 +23,10 @@ class chefcookie {
24
23
  exclude_ua_regex: /(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/,
25
24
  domain: _helper.default.urlHostTopLevel()
26
25
  };
27
- this.config = _objectSpread(_objectSpread({}, defaults), config);
26
+ this.config = {
27
+ ...defaults,
28
+ ...config
29
+ };
28
30
  // add dummy entries for empty groups
29
31
  this.config.settings.forEach((group, i) => {
30
32
  if (!('scripts' in group) || Object.keys(group.scripts).length === 0) {
@@ -58,6 +60,9 @@ class chefcookie {
58
60
  if (this.config.exclude_ua_regex !== undefined && navigator.userAgent.match(this.config.exclude_ua_regex)) {
59
61
  return;
60
62
  }
63
+ if (this.isPageSpeed()) {
64
+ return;
65
+ }
61
66
  if (document.head === null || typeof document.head.insertAdjacentHTML === 'undefined') {
62
67
  return;
63
68
  }
@@ -319,8 +324,663 @@ class chefcookie {
319
324
  return excluded;
320
325
  }
321
326
  addStyle() {
322
- var _this$config$style$co, _this$config$style$co2, _ref, _this$config$style$co3, _this$config$style$co4, _this$config$style$co5, _this$config$style$co6, _this$config$style$co7, _this$config$style$co8, _this$config$style$co9, _this$config$style$co0, _this$config$style$co1, _this$config$style$co10, _this$config$style$co11, _this$config$style$co12, _this$config$style$co13, _this$config$style$co14, _this$config$style$co15, _this$config$style$co16, _this$config$style$co17;
323
- let css = "\n .chefcookie, .chefcookie *\n {\n box-sizing: border-box;\n margin:0;\n padding:0;\n }\n /* try to reset styles */\n .chefcookie h2,\n .chefcookie a:link,\n .chefcookie a:hover,\n .chefcookie a:visited\n {\n color:inherit;\n }\n .chefcookie\n {\n position: fixed;\n z-index: 2147483647;\n left: 0;\n right: 0;\n bottom: 0;\n transform: translateZ(0);\n }\n .chefcookie--hidden\n {\n opacity: 0;\n pointer-events:none;\n }\n .chefcookie__inner\n {\n width:100%;\n height:100%;\n text-align: center;\n white-space: nowrap;\n font-size: 0;\n overflow-y:auto;\n overflow-x:hidden;\n max-height:100vh;\n }\n .chefcookie__box\n {\n font-size: ".concat(15 + (this.config.style.size - 3), "px;\n line-height:1.6;\n color:").concat((_this$config$style$co = this.config.style.color_text) !== null && _this$config$style$co !== void 0 ? _this$config$style$co : '#595f60', ";\n width: 100%;\n margin: 0 auto;\n display: inline-block;\n vertical-align: middle;\n white-space: normal;\n border-radius: 0;\n padding-top: 2em;\n padding-bottom: 2em;\n padding-left: 3em;\n padding-right: 3em;\n text-align: left;\n }\n .chefcookie__message\n {\n margin-bottom:1.5em;\n text-align:justify;\n }\n .chefcookie__message h2\n {\n margin-bottom:0.5em;\n font-size:2em;\n line-height:1.4;\n text-transform:uppercase;\n font-weight:700;\n text-align:left;\n }\n .chefcookie__message p {\n font-size: 1em;\n line-height:1.6;\n }\n .chefcookie__message a,\n .chefcookie__message a:focus\n {\n color:inherit;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-decoration:underline;\n font-size: 1em;\n line-height:1.6;\n }\n .chefcookie__message a:focus\n {\n outline:none;\n }\n @media (hover: hover) {\n .chefcookie__message a:hover\n {\n opacity: 0.5;\n color: inherit;\n }\n }\n .chefcookie__message a:active\n {\n opacity: 0.1;\n color: inherit;\n }\n .chefcookie__buttons\n {\n margin-top:0.5em;\n }\n .chefcookie__button,\n .chefcookie__button:focus\n {\n padding: 1em 0.5em;\n border: 2px solid ").concat((_this$config$style$co2 = this.config.style.color_text) !== null && _this$config$style$co2 !== void 0 ? _this$config$style$co2 : '#595f60', ";\n font-weight: bold;\n display: block;\n color: inherit;\n text-decoration: none;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-transform: uppercase;\n float: left;\n text-align: center;\n min-width: 21em;\n margin-right:3em;\n }\n .chefcookie__buttons--count-3 .chefcookie__button,\n .chefcookie__buttons--count-3 .chefcookie__button:focus {\n min-width:15em;\n margin-right:1em;\n }\n .chefcookie__button:last-child\n {\n margin-right:0;\n }\n .chefcookie__button:focus\n {\n outline:none;\n }\n @media (hover: hover) {\n .chefcookie__button:hover\n {\n opacity: 0.5;\n text-decoration:none;\n color: inherit;\n }\n }\n .chefcookie__button:active\n {\n opacity: 0.1;\n color: inherit;\n }\n .chefcookie__buttons:after\n {\n clear:both;\n display:table;\n content:\"\";\n }\n ").concat(this.config.style.highlight_accept === undefined || this.config.style.highlight_accept === true ? "\n .chefcookie__button--accept\n {\n background-color:".concat((_ref = (_this$config$style$co3 = this.config.style.color_highlight) !== null && _this$config$style$co3 !== void 0 ? _this$config$style$co3 : this.config.style.color) !== null && _ref !== void 0 ? _ref : '#ff0000', ";\n border-color:transparent;\n }\n .chefcookie__button--accept.chefcookie__button--accept,\n .chefcookie__button--accept.chefcookie__button--accept:hover,\n .chefcookie__button--accept.chefcookie__button--accept:focus,\n .chefcookie__button--accept.chefcookie__button--accept:link,\n .chefcookie__button--accept.chefcookie__button--accept:visited\n {\n color:").concat((_this$config$style$co4 = this.config.style.color_background) !== null && _this$config$style$co4 !== void 0 ? _this$config$style$co4 : '#eeeeee', ";\n }\n ") : "", "\n .chefcookie__settings-container\n {\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__groups\n {\n list-style-type:none;\n }\n .chefcookie__groups:after\n {\n clear:both;\n display:table;\n content:\"\";\n }\n .chefcookie__group\n {\n float: left;\n }\n .chefcookie__group:before\n {\n display:none;\n }\n .chefcookie__group-title\n {\n float:left;\n width:70%;\n min-height: 1.66em;\n line-height: 1.66;\n display: block;\n font-weight:bold;\n font-size:1.2em;\n line-height:1.7;\n text-transform:uppercase;\n }\n .chefcookie__group-label\n {\n cursor: pointer;\n display:block;\n width:100%;\n height:100%;\n font-size:1em;\n line-height:1.6;\n }\n .chefcookie__group-label:after\n {\n clear:both;\n display:table;\n content:\"\"\n }\n .chefcookie__group--disabled .chefcookie__group-label\n {\n cursor:default;\n }\n .chefcookie__group-checkbox\n {\n opacity: 0;\n position:absolute;\n display: block;\n pointer-events:none;\n }\n .chefcookie__group--disabled .chefcookie__group-checkbox-icon\n {\n ").concat(this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? "display:none;" : "opacity: 0.75 !important;", "\n }\n .chefcookie__group-checkbox-icon\n {\n line-height:2;\n display: block;\n width: 4em;\n height: 2em;\n background-color: ").concat((_this$config$style$co5 = this.config.style.color_background) !== null && _this$config$style$co5 !== void 0 ? _this$config$style$co5 : '#eeeeee', ";\n border: 2px solid ").concat((_this$config$style$co6 = this.config.style.color_text) !== null && _this$config$style$co6 !== void 0 ? _this$config$style$co6 : '#595f60', ";\n margin: 0;\n padding: 0;\n position: relative;\n border-radius: 2em;\n float: right;\n }\n .chefcookie__group-checkbox-icon:before\n {\n content: \"0\";\n position: absolute;\n top: 0;\n left: 45%;\n width: 50%;\n bottom: 0;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-align: center;\n font-weight: bold;\n font-size: 1em;\n line-height: 2;\n opacity: 0.25;\n color: ").concat((_this$config$style$co7 = this.config.style.color_text) !== null && _this$config$style$co7 !== void 0 ? _this$config$style$co7 : '#595f60', ";\n }\n .chefcookie__group-checkbox-icon:after\n {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n bottom: 0;\n box-shadow: 0 0 0px 1px ").concat((_this$config$style$co8 = this.config.style.color_text) !== null && _this$config$style$co8 !== void 0 ? _this$config$style$co8 : '#595f60', ";\n background-color: ").concat((_this$config$style$co9 = this.config.style.color_text) !== null && _this$config$style$co9 !== void 0 ? _this$config$style$co9 : '#595f60', ";\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n border-radius: 50%;\n }\n .chefcookie__group-checkbox ~ *\n {\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n }\n .chefcookie__group-checkbox[data-status=\"0\"] ~ *\n {\n opacity: 0.75;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon\n {\n opacity: 0.85;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon:after\n {\n left:25%;\n }\n .chefcookie__group-checkbox[data-status=\"2\"] ~ .chefcookie__group-checkbox-icon:after\n {\n left:50%;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon:before,\n .chefcookie__group-checkbox[data-status=\"2\"] ~ .chefcookie__group-checkbox-icon:before\n {\n content: \"\";\n background-color: ").concat((_this$config$style$co0 = this.config.style.color_text) !== null && _this$config$style$co0 !== void 0 ? _this$config$style$co0 : '#595f60', ";\n top: 30%;\n bottom: 30%;\n left: 27%;\n width: 3px;\n }\n .chefcookie__group-description\n {\n width:100%;\n clear:both;\n padding-top:1em;\n display: block;\n font-size:0.9em;\n line-height:1.5;\n text-align:justify;\n font-weight: normal;\n }\n .chefcookie__group-collapse,\n .chefcookie__group-collapse:focus {\n color:inherit;\n text-decoration:underline;\n padding-top: 0.5em;\n display: block;\n }\n @media (hover: hover) {\n .chefcookie__group-collapse:hover\n {\n opacity: 0.9;\n color: inherit;\n text-decoration:underline;\n }\n }\n .chefcookie__scripts\n {\n list-style-type:none;\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__scripts--visible {\n height:auto;\n }\n .chefcookie__script {\n margin-bottom:0.5em;\n }\n .chefcookie__script:before\n {\n display:none;\n }\n .chefcookie__script:first-child {\n margin-top:1em;\n }\n .chefcookie__script:last-child {\n margin-bottom:0;\n }\n .chefcookie__script-title\n {\n float:left;\n width:70%;\n min-height: 1.66em;\n line-height: 1.66;\n display: block;\n }\n .chefcookie__script-label\n {\n cursor: pointer;\n display:block;\n width:100%;\n height:100%;\n }\n .chefcookie__script-label:after\n {\n clear:both;\n display:table;\n content:\"\"\n }\n .chefcookie__script--disabled .chefcookie__script-label\n {\n cursor:default;\n }\n .chefcookie__script-checkbox\n {\n opacity: 0;\n position:absolute;\n display: block;\n pointer-events:none;\n }\n .chefcookie__script--disabled .chefcookie__script-checkbox-icon\n {\n ").concat(this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? "display:none;" : "opacity: 0.75 !important;", "\n }\n .chefcookie__script-checkbox-icon\n {\n line-height:1.5;\n display: block;\n width: 3em;\n height: 1.5em;\n background-color: ").concat((_this$config$style$co1 = this.config.style.color_background) !== null && _this$config$style$co1 !== void 0 ? _this$config$style$co1 : '#eeeeee', ";\n border: 1px solid ").concat((_this$config$style$co10 = this.config.style.color_text) !== null && _this$config$style$co10 !== void 0 ? _this$config$style$co10 : '#595f60', ";\n margin: 0;\n padding: 0;\n position: relative;\n border-radius: 2em;\n float: right;\n }\n .chefcookie__script-checkbox-icon:before\n {\n content: \"0\";\n position: absolute;\n top: 0;\n left: 45%;\n width: 50%;\n bottom: 0;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-align: center;\n font-size: 0.7em;\n line-height: 2;\n opacity: 0.25;\n color: ").concat((_this$config$style$co11 = this.config.style.color_text) !== null && _this$config$style$co11 !== void 0 ? _this$config$style$co11 : '#595f60', ";\n }\n .chefcookie__script-checkbox-icon:after\n {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n bottom: 0;\n box-shadow: 0 0 0px 1px ").concat((_this$config$style$co12 = this.config.style.color_text) !== null && _this$config$style$co12 !== void 0 ? _this$config$style$co12 : '#595f60', ";\n background-color: ").concat((_this$config$style$co13 = this.config.style.color_text) !== null && _this$config$style$co13 !== void 0 ? _this$config$style$co13 : '#595f60', ";\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n border-radius: 50%;\n }\n .chefcookie__script-checkbox ~ *\n {\n opacity: 0.75;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n }\n .chefcookie__script-checkbox:checked ~ *\n {\n opacity:1;\n }\n .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:after\n {\n left:50%;\n }\n .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:before\n {\n content: \"\";\n background-color: ").concat((_this$config$style$co14 = this.config.style.color_text) !== null && _this$config$style$co14 !== void 0 ? _this$config$style$co14 : '#595f60', ";\n top: 30%;\n bottom: 30%;\n left: 27%;\n width: 2px;\n }\n\n .chefcookie__script-description\n {\n width: 100%;\n clear: both;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n display: block;\n font-size: 0.8em;\n line-height:1.4;\n text-align: justify;\n }\n .chefcookie__script-description-collapse,\n .chefcookie__script-description-collapse:focus {\n color:inherit;\n text-decoration:underline;\n padding-top: 0.25em;\n padding-bottom: 0.5em;\n display: block;\n }\n @media (hover: hover) {\n .chefcookie__script-description-collapse:hover\n {\n opacity: 0.9;\n color: inherit;\n text-decoration:underline;\n }\n }\n .chefcookie__script-description-content {\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__script-description-content > *:not(:last-child) {\n margin-bottom:0.5em;\n }\n .chefcookie__script-description-content table {\n width:100%;\n border-collapse: collapse;\n table-layout: fixed;\n }\n .chefcookie__script-description-content table td {\n border:1px solid ").concat(this.hexToRgbaStr((_this$config$style$co15 = this.config.style.color_text) !== null && _this$config$style$co15 !== void 0 ? _this$config$style$co15 : '#595f60', 0.1), ";\n padding: 0.3em 0.5em;\n vertical-align:top;\n }\n\n .chefcookie--noscroll body\n {\n position:fixed;\n width: 100%;\n overflow:hidden;\n }\n .chefcookie--fade body:after,\n .chefcookie--blur body:after\n {\n content:\"\";\n position:fixed;\n z-index: 2147483644;\n top:0;\n left:0;\n width:100%;\n height:100%;\n }\n .chefcookie--fade body:after\n {\n background-color: rgba(0, 0, 0, 0.65);\n }\n .chefcookie--blur body:after\n {\n backdrop-filter: grayscale(50%) blur(5px);\n }\n .chefcookie--overlay\n {\n top: 0;\n }\n .chefcookie--overlay .chefcookie__inner:before\n {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n }\n .chefcookie--overlay .chefcookie__box\n {\n width: 95%;\n max-width: 60em;\n box-shadow: 0 1em 5em -0.5em #000;\n background-color: ").concat((_this$config$style$co16 = this.config.style.color_background) !== null && _this$config$style$co16 !== void 0 ? _this$config$style$co16 : '#eeeeee', ";\n }\n .chefcookie--overlay .chefcookie__group\n {\n height: 13em;\n margin-bottom: 4%;\n background-color: rgba(").concat(this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0', ", 0.05);\n border: 1px solid rgba(").concat(this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0', ", 0.01);\n width: 48%;\n margin-right: 4%;\n }\n .chefcookie--overlay .chefcookie__group:nth-child(2n)\n {\n margin-right:0;\n }\n .chefcookie--overlay.chefcookie--has-scripts .chefcookie__group\n {\n height:auto;\n width: 100%;\n margin-right: 0;\n margin-bottom: 1em;\n }\n .chefcookie--overlay .chefcookie__group\n {\n padding: 1em 1.25em;\n }\n .chefcookie--bottombar,\n .chefcookie--topbar\n {\n background-color:").concat((_this$config$style$co17 = this.config.style.color_background) !== null && _this$config$style$co17 !== void 0 ? _this$config$style$co17 : '#eeeeee', ";\n box-shadow: 0 1em 5em -0.5em #000;\n }\n .chefcookie--bottombar\n {\n bottom:0;\n top:auto;\n }\n .chefcookie--topbar\n {\n bottom:auto;\n top:0;\n position:relative;\n }\n .chefcookie--bottombar .chefcookie__box,\n .chefcookie--topbar .chefcookie__box\n {\n max-width: 1280px;\n }\n .chefcookie--bottombar .chefcookie__group,\n .chefcookie--topbar .chefcookie__group\n {\n margin-top: 0px;\n margin-bottom: 1.5em;\n width: 22%;\n margin-right: 4%;\n }\n .chefcookie--bottombar .chefcookie__group:last-child,\n .chefcookie--topbar .chefcookie__group:last-child\n {\n margin-right:0;\n }\n .chefcookie--bottombar .chefcookie__groups--count-9 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-9 .chefcookie__group { width: 7.55%; }\n .chefcookie--bottombar .chefcookie__groups--count-8 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-8 .chefcookie__group { width: 9.00%; }\n .chefcookie--bottombar .chefcookie__groups--count-7 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-7 .chefcookie__group { width: 10.85%; }\n .chefcookie--bottombar .chefcookie__groups--count-6 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-6 .chefcookie__group { width: 13.33%; }\n .chefcookie--bottombar .chefcookie__groups--count-5 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-5 .chefcookie__group { width: 16.80%; }\n .chefcookie--bottombar .chefcookie__groups--count-4 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-4 .chefcookie__group { width: 22.00%; }\n .chefcookie--bottombar .chefcookie__groups--count-3 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-3 .chefcookie__group { width: 30.66%; }\n .chefcookie--bottombar .chefcookie__groups--count-2 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-2 .chefcookie__group { width: 48%; }\n .chefcookie--bottombar .chefcookie__groups--count-1 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-1 .chefcookie__group { width: 100%; }\n @media screen and (max-width: 940px)\n {\n .chefcookie__button,\n .chefcookie__button:focus\n {\n float: none;\n margin: 0 0 1em;\n text-align: center;\n width: 100%;\n min-width:0;\n }\n }\n @media screen and (max-width: 840px)\n {\n .chefcookie__box\n {\n padding:1em;\n }\n .chefcookie__message h2\n {\n font-size:1.5em;\n line-height:1.4;\n }\n .chefcookie .chefcookie__group,\n .chefcookie--overlay .chefcookie__group,\n .chefcookie--bottombar .chefcookie__group,\n .chefcookie--topbar .chefcookie__group\n {\n float:none;\n margin-right:0;\n width:100% !important;\n height:auto;\n }\n }\n ");
327
+ let css = `
328
+ .chefcookie, .chefcookie *
329
+ {
330
+ box-sizing: border-box;
331
+ margin:0;
332
+ padding:0;
333
+ }
334
+ /* try to reset styles */
335
+ .chefcookie h2,
336
+ .chefcookie a:link,
337
+ .chefcookie a:hover,
338
+ .chefcookie a:visited
339
+ {
340
+ color:inherit;
341
+ }
342
+ .chefcookie
343
+ {
344
+ position: fixed;
345
+ z-index: 2147483647;
346
+ left: 0;
347
+ right: 0;
348
+ bottom: 0;
349
+ transform: translateZ(0);
350
+ }
351
+ .chefcookie--hidden
352
+ {
353
+ opacity: 0;
354
+ pointer-events:none;
355
+ }
356
+ .chefcookie__inner
357
+ {
358
+ width:100%;
359
+ height:100%;
360
+ text-align: center;
361
+ white-space: nowrap;
362
+ font-size: 0;
363
+ overflow-y:auto;
364
+ overflow-x:hidden;
365
+ max-height:100vh;
366
+ }
367
+ .chefcookie__box
368
+ {
369
+ font-size: ${15 + (this.config.style.size - 3)}px;
370
+ line-height:1.6;
371
+ color:${this.config.style.color_text ?? '#595f60'};
372
+ width: 100%;
373
+ margin: 0 auto;
374
+ display: inline-block;
375
+ vertical-align: middle;
376
+ white-space: normal;
377
+ border-radius: 0;
378
+ padding-top: 2em;
379
+ padding-bottom: 2em;
380
+ padding-left: 3em;
381
+ padding-right: 3em;
382
+ text-align: left;
383
+ }
384
+ .chefcookie__message
385
+ {
386
+ margin-bottom:1.5em;
387
+ text-align:justify;
388
+ }
389
+ .chefcookie__message h2
390
+ {
391
+ margin-bottom:0.5em;
392
+ font-size:2em;
393
+ line-height:1.4;
394
+ text-transform:uppercase;
395
+ font-weight:700;
396
+ text-align:left;
397
+ }
398
+ .chefcookie__message p {
399
+ font-size: 1em;
400
+ line-height:1.6;
401
+ }
402
+ .chefcookie__message a,
403
+ .chefcookie__message a:focus
404
+ {
405
+ color:inherit;
406
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
407
+ text-decoration:underline;
408
+ font-size: 1em;
409
+ line-height:1.6;
410
+ }
411
+ .chefcookie__message a:focus
412
+ {
413
+ outline:none;
414
+ }
415
+ @media (hover: hover) {
416
+ .chefcookie__message a:hover
417
+ {
418
+ opacity: 0.5;
419
+ color: inherit;
420
+ }
421
+ }
422
+ .chefcookie__message a:active
423
+ {
424
+ opacity: 0.1;
425
+ color: inherit;
426
+ }
427
+ .chefcookie__buttons
428
+ {
429
+ margin-top:0.5em;
430
+ }
431
+ .chefcookie__button,
432
+ .chefcookie__button:focus
433
+ {
434
+ padding: 1em 0.5em;
435
+ border: 2px solid ${this.config.style.color_text ?? '#595f60'};
436
+ font-weight: bold;
437
+ display: block;
438
+ color: inherit;
439
+ text-decoration: none;
440
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
441
+ text-transform: uppercase;
442
+ float: left;
443
+ text-align: center;
444
+ min-width: 21em;
445
+ margin-right:3em;
446
+ }
447
+ .chefcookie__buttons--count-3 .chefcookie__button,
448
+ .chefcookie__buttons--count-3 .chefcookie__button:focus {
449
+ min-width:15em;
450
+ margin-right:1em;
451
+ }
452
+ .chefcookie__button:last-child
453
+ {
454
+ margin-right:0;
455
+ }
456
+ .chefcookie__button:focus
457
+ {
458
+ outline:none;
459
+ }
460
+ @media (hover: hover) {
461
+ .chefcookie__button:hover
462
+ {
463
+ opacity: 0.5;
464
+ text-decoration:none;
465
+ color: inherit;
466
+ }
467
+ }
468
+ .chefcookie__button:active
469
+ {
470
+ opacity: 0.1;
471
+ color: inherit;
472
+ }
473
+ .chefcookie__buttons:after
474
+ {
475
+ clear:both;
476
+ display:table;
477
+ content:"";
478
+ }
479
+ ${this.config.style.highlight_accept === undefined || this.config.style.highlight_accept === true ? `
480
+ .chefcookie__button--accept
481
+ {
482
+ background-color:${this.config.style.color_highlight ?? this.config.style.color ?? '#ff0000'};
483
+ border-color:transparent;
484
+ }
485
+ .chefcookie__button--accept.chefcookie__button--accept,
486
+ .chefcookie__button--accept.chefcookie__button--accept:hover,
487
+ .chefcookie__button--accept.chefcookie__button--accept:focus,
488
+ .chefcookie__button--accept.chefcookie__button--accept:link,
489
+ .chefcookie__button--accept.chefcookie__button--accept:visited
490
+ {
491
+ color:${this.config.style.color_background ?? '#eeeeee'};
492
+ }
493
+ ` : ``}
494
+ .chefcookie__settings-container
495
+ {
496
+ height:0;
497
+ overflow:hidden;
498
+ transition: height ${this.animationSpeed / 1000}s ease-out;
499
+ }
500
+ .chefcookie__groups
501
+ {
502
+ list-style-type:none;
503
+ }
504
+ .chefcookie__groups:after
505
+ {
506
+ clear:both;
507
+ display:table;
508
+ content:"";
509
+ }
510
+ .chefcookie__group
511
+ {
512
+ float: left;
513
+ }
514
+ .chefcookie__group:before
515
+ {
516
+ display:none;
517
+ }
518
+ .chefcookie__group-title
519
+ {
520
+ float:left;
521
+ width:70%;
522
+ min-height: 1.66em;
523
+ line-height: 1.66;
524
+ display: block;
525
+ font-weight:bold;
526
+ font-size:1.2em;
527
+ line-height:1.7;
528
+ text-transform:uppercase;
529
+ }
530
+ .chefcookie__group-label
531
+ {
532
+ cursor: pointer;
533
+ display:block;
534
+ width:100%;
535
+ height:100%;
536
+ font-size:1em;
537
+ line-height:1.6;
538
+ }
539
+ .chefcookie__group-label:after
540
+ {
541
+ clear:both;
542
+ display:table;
543
+ content:""
544
+ }
545
+ .chefcookie__group--disabled .chefcookie__group-label
546
+ {
547
+ cursor:default;
548
+ }
549
+ .chefcookie__group-checkbox
550
+ {
551
+ opacity: 0;
552
+ position:absolute;
553
+ display: block;
554
+ pointer-events:none;
555
+ }
556
+ .chefcookie__group--disabled .chefcookie__group-checkbox-icon
557
+ {
558
+ ${this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? `display:none;` : `opacity: 0.75 !important;`}
559
+ }
560
+ .chefcookie__group-checkbox-icon
561
+ {
562
+ line-height:2;
563
+ display: block;
564
+ width: 4em;
565
+ height: 2em;
566
+ background-color: ${this.config.style.color_background ?? '#eeeeee'};
567
+ border: 2px solid ${this.config.style.color_text ?? '#595f60'};
568
+ margin: 0;
569
+ padding: 0;
570
+ position: relative;
571
+ border-radius: 2em;
572
+ float: right;
573
+ }
574
+ .chefcookie__group-checkbox-icon:before
575
+ {
576
+ content: "0";
577
+ position: absolute;
578
+ top: 0;
579
+ left: 45%;
580
+ width: 50%;
581
+ bottom: 0;
582
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
583
+ text-align: center;
584
+ font-weight: bold;
585
+ font-size: 1em;
586
+ line-height: 2;
587
+ opacity: 0.25;
588
+ color: ${this.config.style.color_text ?? '#595f60'};
589
+ }
590
+ .chefcookie__group-checkbox-icon:after
591
+ {
592
+ content: "";
593
+ position: absolute;
594
+ top: 0;
595
+ left: 0;
596
+ width: 50%;
597
+ bottom: 0;
598
+ box-shadow: 0 0 0px 1px ${this.config.style.color_text ?? '#595f60'};
599
+ background-color: ${this.config.style.color_text ?? '#595f60'};
600
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
601
+ border-radius: 50%;
602
+ }
603
+ .chefcookie__group-checkbox ~ *
604
+ {
605
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
606
+ }
607
+ .chefcookie__group-checkbox[data-status="0"] ~ *
608
+ {
609
+ opacity: 0.75;
610
+ }
611
+ .chefcookie__group-checkbox[data-status="1"] ~ .chefcookie__group-checkbox-icon
612
+ {
613
+ opacity: 0.85;
614
+ }
615
+ .chefcookie__group-checkbox[data-status="1"] ~ .chefcookie__group-checkbox-icon:after
616
+ {
617
+ left:25%;
618
+ }
619
+ .chefcookie__group-checkbox[data-status="2"] ~ .chefcookie__group-checkbox-icon:after
620
+ {
621
+ left:50%;
622
+ }
623
+ .chefcookie__group-checkbox[data-status="1"] ~ .chefcookie__group-checkbox-icon:before,
624
+ .chefcookie__group-checkbox[data-status="2"] ~ .chefcookie__group-checkbox-icon:before
625
+ {
626
+ content: "";
627
+ background-color: ${this.config.style.color_text ?? '#595f60'};
628
+ top: 30%;
629
+ bottom: 30%;
630
+ left: 27%;
631
+ width: 3px;
632
+ }
633
+ .chefcookie__group-description
634
+ {
635
+ width:100%;
636
+ clear:both;
637
+ padding-top:1em;
638
+ display: block;
639
+ font-size:0.9em;
640
+ line-height:1.5;
641
+ text-align:justify;
642
+ font-weight: normal;
643
+ }
644
+ .chefcookie__group-collapse,
645
+ .chefcookie__group-collapse:focus {
646
+ color:inherit;
647
+ text-decoration:underline;
648
+ padding-top: 0.5em;
649
+ display: block;
650
+ }
651
+ @media (hover: hover) {
652
+ .chefcookie__group-collapse:hover
653
+ {
654
+ opacity: 0.9;
655
+ color: inherit;
656
+ text-decoration:underline;
657
+ }
658
+ }
659
+ .chefcookie__scripts
660
+ {
661
+ list-style-type:none;
662
+ height:0;
663
+ overflow:hidden;
664
+ transition: height ${this.animationSpeed / 1000}s ease-out;
665
+ }
666
+ .chefcookie__scripts--visible {
667
+ height:auto;
668
+ }
669
+ .chefcookie__script {
670
+ margin-bottom:0.5em;
671
+ }
672
+ .chefcookie__script:before
673
+ {
674
+ display:none;
675
+ }
676
+ .chefcookie__script:first-child {
677
+ margin-top:1em;
678
+ }
679
+ .chefcookie__script:last-child {
680
+ margin-bottom:0;
681
+ }
682
+ .chefcookie__script-title
683
+ {
684
+ float:left;
685
+ width:70%;
686
+ min-height: 1.66em;
687
+ line-height: 1.66;
688
+ display: block;
689
+ }
690
+ .chefcookie__script-label
691
+ {
692
+ cursor: pointer;
693
+ display:block;
694
+ width:100%;
695
+ height:100%;
696
+ }
697
+ .chefcookie__script-label:after
698
+ {
699
+ clear:both;
700
+ display:table;
701
+ content:""
702
+ }
703
+ .chefcookie__script--disabled .chefcookie__script-label
704
+ {
705
+ cursor:default;
706
+ }
707
+ .chefcookie__script-checkbox
708
+ {
709
+ opacity: 0;
710
+ position:absolute;
711
+ display: block;
712
+ pointer-events:none;
713
+ }
714
+ .chefcookie__script--disabled .chefcookie__script-checkbox-icon
715
+ {
716
+ ${this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? `display:none;` : `opacity: 0.75 !important;`}
717
+ }
718
+ .chefcookie__script-checkbox-icon
719
+ {
720
+ line-height:1.5;
721
+ display: block;
722
+ width: 3em;
723
+ height: 1.5em;
724
+ background-color: ${this.config.style.color_background ?? '#eeeeee'};
725
+ border: 1px solid ${this.config.style.color_text ?? '#595f60'};
726
+ margin: 0;
727
+ padding: 0;
728
+ position: relative;
729
+ border-radius: 2em;
730
+ float: right;
731
+ }
732
+ .chefcookie__script-checkbox-icon:before
733
+ {
734
+ content: "0";
735
+ position: absolute;
736
+ top: 0;
737
+ left: 45%;
738
+ width: 50%;
739
+ bottom: 0;
740
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
741
+ text-align: center;
742
+ font-size: 0.7em;
743
+ line-height: 2;
744
+ opacity: 0.25;
745
+ color: ${this.config.style.color_text ?? '#595f60'};
746
+ }
747
+ .chefcookie__script-checkbox-icon:after
748
+ {
749
+ content: "";
750
+ position: absolute;
751
+ top: 0;
752
+ left: 0;
753
+ width: 50%;
754
+ bottom: 0;
755
+ box-shadow: 0 0 0px 1px ${this.config.style.color_text ?? '#595f60'};
756
+ background-color: ${this.config.style.color_text ?? '#595f60'};
757
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
758
+ border-radius: 50%;
759
+ }
760
+ .chefcookie__script-checkbox ~ *
761
+ {
762
+ opacity: 0.75;
763
+ transition: all ${this.animationSpeed / 1000}s ease-in-out;
764
+ }
765
+ .chefcookie__script-checkbox:checked ~ *
766
+ {
767
+ opacity:1;
768
+ }
769
+ .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:after
770
+ {
771
+ left:50%;
772
+ }
773
+ .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:before
774
+ {
775
+ content: "";
776
+ background-color: ${this.config.style.color_text ?? '#595f60'};
777
+ top: 30%;
778
+ bottom: 30%;
779
+ left: 27%;
780
+ width: 2px;
781
+ }
782
+
783
+ .chefcookie__script-description
784
+ {
785
+ width: 100%;
786
+ clear: both;
787
+ padding-top: 0.5em;
788
+ padding-bottom: 0.5em;
789
+ display: block;
790
+ font-size: 0.8em;
791
+ line-height:1.4;
792
+ text-align: justify;
793
+ }
794
+ .chefcookie__script-description-collapse,
795
+ .chefcookie__script-description-collapse:focus {
796
+ color:inherit;
797
+ text-decoration:underline;
798
+ padding-top: 0.25em;
799
+ padding-bottom: 0.5em;
800
+ display: block;
801
+ }
802
+ @media (hover: hover) {
803
+ .chefcookie__script-description-collapse:hover
804
+ {
805
+ opacity: 0.9;
806
+ color: inherit;
807
+ text-decoration:underline;
808
+ }
809
+ }
810
+ .chefcookie__script-description-content {
811
+ height:0;
812
+ overflow:hidden;
813
+ transition: height ${this.animationSpeed / 1000}s ease-out;
814
+ }
815
+ .chefcookie__script-description-content > *:not(:last-child) {
816
+ margin-bottom:0.5em;
817
+ }
818
+ .chefcookie__script-description-content table {
819
+ width:100%;
820
+ border-collapse: collapse;
821
+ table-layout: fixed;
822
+ }
823
+ .chefcookie__script-description-content table td {
824
+ border:1px solid ${this.hexToRgbaStr(this.config.style.color_text ?? '#595f60', 0.1)};
825
+ padding: 0.3em 0.5em;
826
+ vertical-align:top;
827
+ }
828
+
829
+ .chefcookie--noscroll body
830
+ {
831
+ position:fixed;
832
+ width: 100%;
833
+ overflow:hidden;
834
+ }
835
+ .chefcookie--fade body:after,
836
+ .chefcookie--blur body:after
837
+ {
838
+ content:"";
839
+ position:fixed;
840
+ z-index: 2147483644;
841
+ top:0;
842
+ left:0;
843
+ width:100%;
844
+ height:100%;
845
+ }
846
+ .chefcookie--fade body:after
847
+ {
848
+ background-color: rgba(0, 0, 0, 0.65);
849
+ }
850
+ .chefcookie--blur body:after
851
+ {
852
+ backdrop-filter: grayscale(50%) blur(5px);
853
+ }
854
+ .chefcookie--overlay
855
+ {
856
+ top: 0;
857
+ }
858
+ .chefcookie--overlay .chefcookie__inner:before
859
+ {
860
+ content: '';
861
+ display: inline-block;
862
+ height: 100%;
863
+ vertical-align: middle;
864
+ }
865
+ .chefcookie--overlay .chefcookie__box
866
+ {
867
+ width: 95%;
868
+ max-width: 60em;
869
+ box-shadow: 0 1em 5em -0.5em #000;
870
+ background-color: ${this.config.style.color_background ?? '#eeeeee'};
871
+ }
872
+ .chefcookie--overlay .chefcookie__group
873
+ {
874
+ height: 13em;
875
+ margin-bottom: 4%;
876
+ background-color: rgba(${this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0'}, 0.05);
877
+ border: 1px solid rgba(${this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0'}, 0.01);
878
+ width: 48%;
879
+ margin-right: 4%;
880
+ }
881
+ .chefcookie--overlay .chefcookie__group:nth-child(2n)
882
+ {
883
+ margin-right:0;
884
+ }
885
+ .chefcookie--overlay.chefcookie--has-scripts .chefcookie__group
886
+ {
887
+ height:auto;
888
+ width: 100%;
889
+ margin-right: 0;
890
+ margin-bottom: 1em;
891
+ }
892
+ .chefcookie--overlay .chefcookie__group
893
+ {
894
+ padding: 1em 1.25em;
895
+ }
896
+ .chefcookie--bottombar,
897
+ .chefcookie--topbar
898
+ {
899
+ background-color:${this.config.style.color_background ?? '#eeeeee'};
900
+ box-shadow: 0 1em 5em -0.5em #000;
901
+ }
902
+ .chefcookie--bottombar
903
+ {
904
+ bottom:0;
905
+ top:auto;
906
+ }
907
+ .chefcookie--topbar
908
+ {
909
+ bottom:auto;
910
+ top:0;
911
+ position:relative;
912
+ }
913
+ .chefcookie--bottombar .chefcookie__box,
914
+ .chefcookie--topbar .chefcookie__box
915
+ {
916
+ max-width: 1280px;
917
+ }
918
+ .chefcookie--bottombar .chefcookie__group,
919
+ .chefcookie--topbar .chefcookie__group
920
+ {
921
+ margin-top: 0px;
922
+ margin-bottom: 1.5em;
923
+ width: 22%;
924
+ margin-right: 4%;
925
+ }
926
+ .chefcookie--bottombar .chefcookie__group:last-child,
927
+ .chefcookie--topbar .chefcookie__group:last-child
928
+ {
929
+ margin-right:0;
930
+ }
931
+ .chefcookie--bottombar .chefcookie__groups--count-9 .chefcookie__group,
932
+ .chefcookie--topbar .chefcookie__groups--count-9 .chefcookie__group { width: 7.55%; }
933
+ .chefcookie--bottombar .chefcookie__groups--count-8 .chefcookie__group,
934
+ .chefcookie--topbar .chefcookie__groups--count-8 .chefcookie__group { width: 9.00%; }
935
+ .chefcookie--bottombar .chefcookie__groups--count-7 .chefcookie__group,
936
+ .chefcookie--topbar .chefcookie__groups--count-7 .chefcookie__group { width: 10.85%; }
937
+ .chefcookie--bottombar .chefcookie__groups--count-6 .chefcookie__group,
938
+ .chefcookie--topbar .chefcookie__groups--count-6 .chefcookie__group { width: 13.33%; }
939
+ .chefcookie--bottombar .chefcookie__groups--count-5 .chefcookie__group,
940
+ .chefcookie--topbar .chefcookie__groups--count-5 .chefcookie__group { width: 16.80%; }
941
+ .chefcookie--bottombar .chefcookie__groups--count-4 .chefcookie__group,
942
+ .chefcookie--topbar .chefcookie__groups--count-4 .chefcookie__group { width: 22.00%; }
943
+ .chefcookie--bottombar .chefcookie__groups--count-3 .chefcookie__group,
944
+ .chefcookie--topbar .chefcookie__groups--count-3 .chefcookie__group { width: 30.66%; }
945
+ .chefcookie--bottombar .chefcookie__groups--count-2 .chefcookie__group,
946
+ .chefcookie--topbar .chefcookie__groups--count-2 .chefcookie__group { width: 48%; }
947
+ .chefcookie--bottombar .chefcookie__groups--count-1 .chefcookie__group,
948
+ .chefcookie--topbar .chefcookie__groups--count-1 .chefcookie__group { width: 100%; }
949
+ @media screen and (max-width: 940px)
950
+ {
951
+ .chefcookie__button,
952
+ .chefcookie__button:focus
953
+ {
954
+ float: none;
955
+ margin: 0 0 1em;
956
+ text-align: center;
957
+ width: 100%;
958
+ min-width:0;
959
+ }
960
+ }
961
+ @media screen and (max-width: 840px)
962
+ {
963
+ .chefcookie__box
964
+ {
965
+ padding:1em;
966
+ }
967
+ .chefcookie__message h2
968
+ {
969
+ font-size:1.5em;
970
+ line-height:1.4;
971
+ }
972
+ .chefcookie .chefcookie__group,
973
+ .chefcookie--overlay .chefcookie__group,
974
+ .chefcookie--bottombar .chefcookie__group,
975
+ .chefcookie--topbar .chefcookie__group
976
+ {
977
+ float:none;
978
+ margin-right:0;
979
+ width:100% !important;
980
+ height:auto;
981
+ }
982
+ }
983
+ `;
324
984
  if ('css_replace' in this.config.style && this.config.style.css_replace !== undefined && this.config.style.css_replace !== null && this.config.style.css_replace !== '') {
325
985
  css = this.config.style.css_replace;
326
986
  }
@@ -349,7 +1009,55 @@ class chefcookie {
349
1009
  }
350
1010
  }
351
1011
  buildDom() {
352
- document.body.insertAdjacentHTML('afterbegin', "\n <div class=\"chefcookie chefcookie--".concat(this.config.style.layout, " chefcookie--columns-").concat('columns' in this.config.style ? this.config.style.columns : 'auto').concat('scripts_selection' in this.config && this.config.scripts_selection !== false ? " chefcookie--has-scripts" : "", " chefcookie--hidden\">\n <div class=\"chefcookie__inner\">\n <div class=\"chefcookie__box\">\n <div class=\"chefcookie__message\">").concat(this.translate(this.config.message), "</div>\n <div class=\"chefcookie__settings-container\">\n <ul class=\"chefcookie__groups chefcookie__groups--count-").concat(this.config.settings.length, "\">\n ").concat(this.config.settings.map((group, i) => "\n <li class=\"chefcookie__group".concat(group.cannot_be_modified ? " chefcookie__group--disabled" : "", "\">\n <label class=\"chefcookie__group-label\" for=\"chefcookie_group_").concat(i, "\">\n <input").concat(group.cannot_be_modified ? " disabled=\"disabled\"" : "", " class=\"chefcookie__group-checkbox\" data-status=\"").concat(this.isCheckboxActiveForGroup(i), "\" id=\"chefcookie_group_").concat(i, "\" type=\"checkbox\" name=\"chefcookie_group[]\" value=\"").concat(i, "\"").concat(this.isCheckboxActiveForGroup(i) === 2 ? " checked=\"checked\"" : "", " />\n <span class=\"chefcookie__group-title\">").concat(this.translate(group.title), "</span>\n <span class=\"chefcookie__group-checkbox-icon\"></span>\n ").concat('description' in group && group.description != '' ? "\n <span class=\"chefcookie__group-description\">".concat(this.translate(group.description), "</span>\n ") : "", "\n ").concat('scripts_selection' in this.config && this.config.scripts_selection === 'collapse' && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? "\n <a href=\"#\" class=\"chefcookie__group-collapse\">".concat(this.getLabel('group_open') != '' ? this.getLabel('group_open') : this.getLabel('settings_open'), "</a>\n ") : "", "\n </label>\n ").concat('scripts_selection' in this.config && this.config.scripts_selection !== false && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? "\n <ul class=\"chefcookie__scripts chefcookie__scripts--count-".concat(Object.keys(group.scripts).length).concat(this.config.scripts_selection !== 'collapse' ? " chefcookie__scripts--visible" : "", "\">\n ").concat(Object.keys(group.scripts).map(j => "\n <li class=\"chefcookie__script".concat(group.cannot_be_modified ? " chefcookie__script--disabled" : "", "\">\n <label class=\"chefcookie__script-label\" for=\"chefcookie_script_").concat(i, "_").concat(j, "\">\n <input").concat(group.cannot_be_modified ? " disabled=\"disabled\"" : "", " class=\"chefcookie__script-checkbox\" id=\"chefcookie_script_").concat(i, "_").concat(j, "\" type=\"checkbox\" name=\"chefcookie_script[]\" value=\"").concat(i, "|").concat(j, "\"").concat(this.isCheckboxActiveForProvider(i, j) ? " checked=\"checked\"" : "", " />\n <span class=\"chefcookie__script-title\">").concat(typeof group.scripts[j] === 'object' && group.scripts[j] !== null && 'title' in group.scripts[j] && group.scripts[j].title != '' ? this.translate(group.scripts[j].title) : j, "</span>\n <span class=\"chefcookie__script-checkbox-icon\"></span>\n </label>\n ").concat(typeof group.scripts[j] === 'object' && group.scripts[j] !== null && 'description' in group.scripts[j] && group.scripts[j].description != '' ? '<div class="chefcookie__script-description">' + '<a href="#" class="chefcookie__script-description-collapse">' + this.getLabel('details_open') + '</a>' + '<div class="chefcookie__script-description-content">' + this.translate(group.scripts[j].description) + '</div>' + '</div>' : '', "\n </li>\n ")).join(''), "\n </ul>\n ") : "", "\n </li>\n ")).join(''), "\n </ul>\n </div>\n <div class=\"chefcookie__buttons chefcookie__buttons--count-").concat('show_decline_button' in this.config && this.config.show_decline_button === true ? '3' : '2', "\">\n <a href=\"#chefcookie__settings\" class=\"chefcookie__button chefcookie__button--settings\">").concat(this.getLabel('settings_open'), "</a>\n <a href=\"#chefcookie__accept\" class=\"chefcookie__button chefcookie__button--accept cookie-compliance-ok-btn\">").concat(this.getLabel(this.config.accept_all_if_settings_closed === undefined || this.config.accept_all_if_settings_closed === false ? 'accept' : 'accept_all'), "</a>\n ").concat('show_decline_button' in this.config && this.config.show_decline_button === true ? "\n <a href=\"#chefcookie__decline\" class=\"chefcookie__button chefcookie__button--decline\">".concat(this.getLabel('decline'), "</a>\n ") : '', "\n </div>\n </div>\n </div>\n </div>\n "));
1012
+ document.body.insertAdjacentHTML('afterbegin', `
1013
+ <div class="chefcookie chefcookie--${this.config.style.layout} chefcookie--columns-${'columns' in this.config.style ? this.config.style.columns : 'auto'}${'scripts_selection' in this.config && this.config.scripts_selection !== false ? ` chefcookie--has-scripts` : ``} chefcookie--hidden">
1014
+ <div class="chefcookie__inner">
1015
+ <div class="chefcookie__box">
1016
+ <div class="chefcookie__message">${this.translate(this.config.message)}</div>
1017
+ <div class="chefcookie__settings-container">
1018
+ <ul class="chefcookie__groups chefcookie__groups--count-${this.config.settings.length}">
1019
+ ${this.config.settings.map((group, i) => `
1020
+ <li class="chefcookie__group${group.cannot_be_modified ? ` chefcookie__group--disabled` : ``}">
1021
+ <label class="chefcookie__group-label" for="chefcookie_group_${i}">
1022
+ <input${group.cannot_be_modified ? ` disabled="disabled"` : ``} class="chefcookie__group-checkbox" data-status="${this.isCheckboxActiveForGroup(i)}" id="chefcookie_group_${i}" type="checkbox" name="chefcookie_group[]" value="${i}"${this.isCheckboxActiveForGroup(i) === 2 ? ` checked="checked"` : ``} />
1023
+ <span class="chefcookie__group-title">${this.translate(group.title)}</span>
1024
+ <span class="chefcookie__group-checkbox-icon"></span>
1025
+ ${'description' in group && group.description != '' ? `
1026
+ <span class="chefcookie__group-description">${this.translate(group.description)}</span>
1027
+ ` : ``}
1028
+ ${'scripts_selection' in this.config && this.config.scripts_selection === 'collapse' && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? `
1029
+ <a href="#" class="chefcookie__group-collapse">${this.getLabel('group_open') != '' ? this.getLabel('group_open') : this.getLabel('settings_open')}</a>
1030
+ ` : ``}
1031
+ </label>
1032
+ ${'scripts_selection' in this.config && this.config.scripts_selection !== false && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? `
1033
+ <ul class="chefcookie__scripts chefcookie__scripts--count-${Object.keys(group.scripts).length}${this.config.scripts_selection !== 'collapse' ? ` chefcookie__scripts--visible` : ``}">
1034
+ ${Object.keys(group.scripts).map(j => `
1035
+ <li class="chefcookie__script${group.cannot_be_modified ? ` chefcookie__script--disabled` : ``}">
1036
+ <label class="chefcookie__script-label" for="chefcookie_script_${i}_${j}">
1037
+ <input${group.cannot_be_modified ? ` disabled="disabled"` : ``} class="chefcookie__script-checkbox" id="chefcookie_script_${i}_${j}" type="checkbox" name="chefcookie_script[]" value="${i}|${j}"${this.isCheckboxActiveForProvider(i, j) ? ` checked="checked"` : ``} />
1038
+ <span class="chefcookie__script-title">${typeof group.scripts[j] === 'object' && group.scripts[j] !== null && 'title' in group.scripts[j] && group.scripts[j].title != '' ? this.translate(group.scripts[j].title) : j}</span>
1039
+ <span class="chefcookie__script-checkbox-icon"></span>
1040
+ </label>
1041
+ ${typeof group.scripts[j] === 'object' && group.scripts[j] !== null && 'description' in group.scripts[j] && group.scripts[j].description != '' ? '<div class="chefcookie__script-description">' + '<a href="#" class="chefcookie__script-description-collapse">' + this.getLabel('details_open') + '</a>' + '<div class="chefcookie__script-description-content">' + this.translate(group.scripts[j].description) + '</div>' + '</div>' : ''}
1042
+ </li>
1043
+ `).join('')}
1044
+ </ul>
1045
+ ` : ``}
1046
+ </li>
1047
+ `).join('')}
1048
+ </ul>
1049
+ </div>
1050
+ <div class="chefcookie__buttons chefcookie__buttons--count-${'show_decline_button' in this.config && this.config.show_decline_button === true ? '3' : '2'}">
1051
+ <a href="#chefcookie__settings" class="chefcookie__button chefcookie__button--settings">${this.getLabel('settings_open')}</a>
1052
+ <a href="#chefcookie__accept" class="chefcookie__button chefcookie__button--accept cookie-compliance-ok-btn">${this.getLabel(this.config.accept_all_if_settings_closed === undefined || this.config.accept_all_if_settings_closed === false ? 'accept' : 'accept_all')}</a>
1053
+ ${'show_decline_button' in this.config && this.config.show_decline_button === true ? `
1054
+ <a href="#chefcookie__decline" class="chefcookie__button chefcookie__button--decline">${this.getLabel('decline')}</a>
1055
+ ` : ''}
1056
+ </div>
1057
+ </div>
1058
+ </div>
1059
+ </div>
1060
+ `);
353
1061
  }
354
1062
  getLabel(label) {
355
1063
  if (this.config.labels[label] === undefined) {
@@ -518,12 +1226,13 @@ class chefcookie {
518
1226
  secure: true,
519
1227
  samesite: 'None'
520
1228
  } : {};
521
- document.cookie = cookie.stringifySetCookie(cookie_name, value, _objectSpread({
1229
+ document.cookie = cookie.stringifySetCookie(cookie_name, value, {
522
1230
  httpOnly: false,
523
1231
  maxAge: 60 * 60 * 24 * days,
524
1232
  path: '/',
525
- domain: cookie_domain && window.location.hostname.endsWith(cookie_domain) ? cookie_domain : undefined
526
- }, options));
1233
+ domain: cookie_domain && window.location.hostname.endsWith(cookie_domain) ? cookie_domain : undefined,
1234
+ ...options
1235
+ });
527
1236
  }
528
1237
  getCookie(name) {
529
1238
  const cookie_name = this.getCookieName(name);
@@ -585,8 +1294,8 @@ class chefcookie {
585
1294
  if (el.closest('.chefcookie__group').querySelector('.chefcookie__script-checkbox') === null) {
586
1295
  if (el.checked === true) {
587
1296
  if (this.config.settings[el.value].scripts !== undefined) {
588
- Object.entries(this.config.settings[el.value].scripts).forEach(_ref2 => {
589
- let [scripts__key, scripts__value] = _ref2;
1297
+ Object.entries(this.config.settings[el.value].scripts).forEach(_ref => {
1298
+ let [scripts__key, scripts__value] = _ref;
590
1299
  providers.push(scripts__key);
591
1300
  });
592
1301
  }
@@ -645,8 +1354,8 @@ class chefcookie {
645
1354
  let accept_all = true;
646
1355
  this.config.settings.forEach(settings__value => {
647
1356
  if (settings__value.scripts !== undefined) {
648
- Object.entries(settings__value.scripts).forEach(_ref3 => {
649
- let [scripts__key, scripts__value] = _ref3;
1357
+ Object.entries(settings__value.scripts).forEach(_ref2 => {
1358
+ let [scripts__key, scripts__value] = _ref2;
650
1359
  if (settings.split(',').indexOf(scripts__key) === -1) {
651
1360
  accept_all = false;
652
1361
  return;
@@ -670,8 +1379,8 @@ class chefcookie {
670
1379
  }
671
1380
  this.config.settings.forEach(settings__value => {
672
1381
  if (settings__value.scripts !== undefined) {
673
- Object.entries(settings__value.scripts).forEach(_ref4 => {
674
- let [scripts__key, scripts__value] = _ref4;
1382
+ Object.entries(settings__value.scripts).forEach(_ref3 => {
1383
+ let [scripts__key, scripts__value] = _ref3;
675
1384
  if (scripts__key !== provider) {
676
1385
  return;
677
1386
  }
@@ -686,8 +1395,8 @@ class chefcookie {
686
1395
  autoAcceptBasicScripts() {
687
1396
  this.config.settings.forEach(settings__value => {
688
1397
  if (settings__value.scripts !== undefined && settings__value.initial_tracking === true) {
689
- Object.entries(settings__value.scripts).forEach(_ref5 => {
690
- let [scripts__key, scripts__value] = _ref5;
1398
+ Object.entries(settings__value.scripts).forEach(_ref4 => {
1399
+ let [scripts__key, scripts__value] = _ref4;
691
1400
  this.accept(scripts__key, false);
692
1401
  });
693
1402
  }
@@ -697,8 +1406,8 @@ class chefcookie {
697
1406
  let providers = [];
698
1407
  this.config.settings.forEach(settings__value => {
699
1408
  if (settings__value.scripts !== undefined) {
700
- Object.entries(settings__value.scripts).forEach(_ref6 => {
701
- let [scripts__key, scripts__value] = _ref6;
1409
+ Object.entries(settings__value.scripts).forEach(_ref5 => {
1410
+ let [scripts__key, scripts__value] = _ref5;
702
1411
  this.accept(scripts__key, false);
703
1412
  });
704
1413
  }
@@ -787,19 +1496,50 @@ class chefcookie {
787
1496
  }
788
1497
  if (provider === 'microsoft') {
789
1498
  let script = document.createElement('script');
790
- script.innerHTML = "\n (function(w,d,t,r,u)\n {\n var f,n,i;\n w[u]=w[u]||[],f=function()\n {\n var o={ti:\"".concat(id, "\", enableAutoSpaTracking: true};\n o.q=w[u],w[u]=new UET(o),w[u].push(\"pageLoad\")\n },\n n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function()\n {\n var s=this.readyState;\n s&&s!==\"loaded\"&&s!==\"complete\"||(f(),n.onload=n.onreadystatechange=null)\n },\n i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)\n })\n (window,document,\"script\",\"//bat.bing.com/bat.js\",\"uetq\");\n ");
1499
+ script.innerHTML = `
1500
+ (function(w,d,t,r,u)
1501
+ {
1502
+ var f,n,i;
1503
+ w[u]=w[u]||[],f=function()
1504
+ {
1505
+ var o={ti:"${id}", enableAutoSpaTracking: true};
1506
+ o.q=w[u],w[u]=new UET(o),w[u].push("pageLoad")
1507
+ },
1508
+ n=d.createElement(t),n.src=r,n.async=1,n.onload=n.onreadystatechange=function()
1509
+ {
1510
+ var s=this.readyState;
1511
+ s&&s!=="loaded"&&s!=="complete"||(f(),n.onload=n.onreadystatechange=null)
1512
+ },
1513
+ i=d.getElementsByTagName(t)[0],i.parentNode.insertBefore(n,i)
1514
+ })
1515
+ (window,document,"script","//bat.bing.com/bat.js","uetq");
1516
+ `;
791
1517
  document.head.appendChild(script);
792
1518
  this.setLoaded(provider);
793
1519
  }
794
1520
  if (provider === 'linkedin') {
795
1521
  let script = document.createElement('script');
796
- script.innerHTML = "\n _linkedin_partner_id = \"".concat(id, "\";\n window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];\n window._linkedin_data_partner_ids.push(_linkedin_partner_id);\n ");
1522
+ script.innerHTML = `
1523
+ _linkedin_partner_id = "${id}";
1524
+ window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
1525
+ window._linkedin_data_partner_ids.push(_linkedin_partner_id);
1526
+ `;
797
1527
  document.body.appendChild(script);
798
1528
  script = document.createElement('script');
799
- script.innerHTML = "\n (function(l) {if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])};\n window.lintrk.q=[]}\n var s = document.getElementsByTagName(\"script\")[0];\n var b = document.createElement(\"script\");\n b.type = \"text/javascript\";b.async = true;\n b.src = \"https://snap.licdn.com/li.lms-analytics/insight.min.js\";\n s.parentNode.insertBefore(b, s);})(window.lintrk);\n ";
1529
+ script.innerHTML = `
1530
+ (function(l) {if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])};
1531
+ window.lintrk.q=[]}
1532
+ var s = document.getElementsByTagName("script")[0];
1533
+ var b = document.createElement("script");
1534
+ b.type = "text/javascript";b.async = true;
1535
+ b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
1536
+ s.parentNode.insertBefore(b, s);})(window.lintrk);
1537
+ `;
800
1538
  document.body.appendChild(script);
801
1539
  script = document.createElement('noscript');
802
- script.innerHTML = "\n <img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=".concat(id, "&fmt=gif\" />\n ");
1540
+ script.innerHTML = `
1541
+ <img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=${id}&fmt=gif" />
1542
+ `;
803
1543
  document.body.appendChild(script);
804
1544
  this.setLoaded(provider);
805
1545
  }
@@ -830,7 +1570,7 @@ class chefcookie {
830
1570
  if (provider === 'etracker') {
831
1571
  let script;
832
1572
  script = document.createElement('script');
833
- script.innerHTML = "if(window._etr === undefined) { window._etr = {eoBlocked:true}; }";
1573
+ script.innerHTML = `if(window._etr === undefined) { window._etr = {eoBlocked:true}; }`;
834
1574
  document.head.appendChild(script);
835
1575
  script = document.createElement('script');
836
1576
  script.onload = () => {
@@ -847,7 +1587,19 @@ class chefcookie {
847
1587
  }
848
1588
  if (provider === 'matomo') {
849
1589
  let script = document.createElement('script');
850
- script.innerHTML = "\n var _paq = window._paq = window._paq || [];\n /* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (function() {\n var u=\"//".concat(id.split('#')[0], "/\";\n _paq.push(['setTrackerUrl', u+'matomo.php']);\n _paq.push(['setSiteId', '").concat(id.split('#')[1], "']);\n var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\n g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);\n })();\n ");
1590
+ script.innerHTML = `
1591
+ var _paq = window._paq = window._paq || [];
1592
+ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
1593
+ _paq.push(['trackPageView']);
1594
+ _paq.push(['enableLinkTracking']);
1595
+ (function() {
1596
+ var u="//${id.split('#')[0]}/";
1597
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
1598
+ _paq.push(['setSiteId', '${id.split('#')[1]}']);
1599
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
1600
+ g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
1601
+ })();
1602
+ `;
851
1603
  document.head.appendChild(script);
852
1604
  this.setLoaded(provider);
853
1605
  }
@@ -1230,6 +1982,24 @@ class chefcookie {
1230
1982
  }
1231
1983
  return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + opacity + ')';
1232
1984
  }
1985
+ isPageSpeed() {
1986
+ if (navigator.userAgent.match(/(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/)) {
1987
+ return true;
1988
+ }
1989
+ if (/HeadlessChromium|Lighthouse|PTST/.test(navigator.userAgent)) {
1990
+ return true;
1991
+ }
1992
+ if (navigator.webdriver) {
1993
+ return true;
1994
+ }
1995
+ if (navigator.plugins.length === 0) {
1996
+ return true;
1997
+ }
1998
+ if (!navigator.languages || navigator.languages.length === 0) {
1999
+ return true;
2000
+ }
2001
+ return false;
2002
+ }
1233
2003
  }
1234
2004
  exports.default = chefcookie;
1235
2005
  window.chefcookie = chefcookie;