diff --git a/lib/eval-snippets.ts b/lib/eval-snippets.ts index bb4c47c9..54c62694 100644 --- a/lib/eval-snippets.ts +++ b/lib/eval-snippets.ts @@ -71,6 +71,7 @@ export const snippets = { EVAL_SIRDATA_0: () => document.cookie.includes('euconsent-v2'), EVAL_SNIGEL_0: () => !!document.cookie.match('snconsent'), EVAL_STEAMPOWERED_0: () => JSON.parse(decodeURIComponent(document.cookie.split(';').find(s => s.trim().startsWith('cookieSettings')).split('=')[1])).preference_state === 2, + EVAL_TAKEALOT_0: () => document.body.classList.remove('freeze') || (document.body.style = '') || true, EVAL_TARTEAUCITRON_0: () => tarteaucitron.userInterface.respondAll(false) || true, EVAL_TARTEAUCITRON_1: () => tarteaucitron.userInterface.respondAll(true) || true, EVAL_TARTEAUCITRON_2: () => document.cookie.match(/tarteaucitron=[^;]*/)[0].includes('false'), diff --git a/rules/autoconsent/takealot-com.json b/rules/autoconsent/takealot-com.json index 0fec827c..68dcbb55 100644 --- a/rules/autoconsent/takealot-com.json +++ b/rules/autoconsent/takealot-com.json @@ -1,13 +1,18 @@ { "name": "takealot.com", "cosmetic": true, - "prehideSelectors": ["div[class^=\"cookies-banner-module_cookie-banner_\"]"], + "prehideSelectors": ["div[class^=\"cookies-banner-module_\"]"], "detectCmp": [{ "exists": "div[class^=\"cookies-banner-module_cookie-banner_\"]" }], "detectPopup": [{ "exists": "div[class^=\"cookies-banner-module_cookie-banner_\"]" }], "optIn": [ { "click": "button[class*=\"cookies-banner-module_dismiss-button_\"]" } ], "optOut": [ - { "hide": ["div[class^=\"cookies-banner-module_cookie-banner_\"]"] } + { "hide": ["div[class^=\"cookies-banner-module_\"]"] }, + { + "if": { "exists": "div[class^=\"cookies-banner-module_small-cookie-banner_\"]" }, + "then": [{ "eval": "EVAL_TAKEALOT_0"}], + "else": [] + } ] } \ No newline at end of file diff --git a/tests/takealot-com.spec.ts b/tests/takealot-com.spec.ts index b040bd6c..ab45315b 100644 --- a/tests/takealot-com.spec.ts +++ b/tests/takealot-com.spec.ts @@ -2,4 +2,12 @@ import generateCMPTests from "../playwright/runner"; generateCMPTests('takealot.com', [ 'https://www.takealot.com/', -], {}); +], { + mobile: false, +}); + +generateCMPTests('takealot.com', [ + 'https://www.takealot.com/', +], { + mobile: true, +});