Filtre active

  • Mărime: 39
  • Mărime: 45
  • Mărime: 37
  • Mărime: M
Product added to compare.
// or with inline code inside the tag. It is only activated once that category is granted - never before. function activateGatedScripts(consent) { var tags = document.querySelectorAll('script[type="text/plain"][data-consent-category]'); for (var i = 0; i < tags.length; i++) { var tag = tags[i]; var category = tag.getAttribute('data-consent-category'); if (category === 'necessary' || consent[category]) { var s = document.createElement('script'); if (tag.getAttribute('data-src')) { s.src = tag.getAttribute('data-src'); } else { s.text = tag.text; } tag.parentNode.replaceChild(s, tag); } } } function show() { document.getElementById('lex-consent-banner').classList.remove('lex-consent-hidden'); } function hide() { document.getElementById('lex-consent-banner').classList.add('lex-consent-hidden'); } document.addEventListener('DOMContentLoaded', function () { var existing = getConsent(); if (existing && existing.v === POLICY_VERSION) { activateGatedScripts(existing); } else { show(); } document.querySelectorAll('#lex-consent-banner [data-lex-action]').forEach(function (btn) { btn.addEventListener('click', function () { var action = btn.getAttribute('data-lex-action'); if (action === 'settings') { document.querySelector('#lex-consent-banner .lex-consent-main').hidden = true; document.querySelector('#lex-consent-banner .lex-consent-settings').hidden = false; return; } if (action === 'back') { document.querySelector('#lex-consent-banner .lex-consent-settings').hidden = true; document.querySelector('#lex-consent-banner .lex-consent-main').hidden = false; return; } if (action === 'accept_all') { setConsent({ analytics: true, marketing: true, functional: true }, 'accept_all'); hide(); return; } if (action === 'reject_all') { setConsent({ analytics: false, marketing: false, functional: false }, 'reject_all'); hide(); return; } if (action === 'save') { var picked = {}; document.querySelectorAll('#lex-consent-banner [data-lex-category]').forEach(function (cb) { picked[cb.getAttribute('data-lex-category')] = cb.checked; }); setConsent(picked, 'save'); hide(); } }); }); }); window.lexConsent = { get: getConsent, has: function (category) { var c = getConsent(); return !!(c && c.v === POLICY_VERSION && c[category]); }, reopen: show, }; })();