From 845f0b7682c575f4f0aa651dc70d866309dcb1a7 Mon Sep 17 00:00:00 2001 From: LE HO Mewen Date: Mon, 18 Oct 2021 14:58:23 +0200 Subject: [PATCH 1/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 51 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index 119e147e04..b6ad63e9a3 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -44,13 +44,50 @@ }) }, { once: true }) - document.addEventListener('googletagmanager_added', function () { - var ask = document.querySelector('#googletagmanagerLine .tarteaucitronAsk') - var choiceEvent = 'tarteaucitron.userInterface.respond(document.getElementById(\'googletagmanagerAllowed\'),document.getElementById(\'googletagmanagerAllowed\').checked);' - var toggle = document.createRange().createContextualFragment('
') - ask.innerHTML = '' - ask.append(toggle) - }, { once: true }) + document.addEventListener( + "googletagmanager_added", + function () { + var ask = document.querySelector( + "#googletagmanagerLine .tarteaucitronAsk" + ); + var choiceEvent = + "tarteaucitron.userInterface.respond(document.getElementById('googletagmanagerAllowed'),document.getElementById('googletagmanagerAllowed').checked);"; + var toggle = document + .createRange() + .createContextualFragment( + '
' + ); + ask.innerHTML = ""; + ask.append(toggle); + + let allowConsentButton = document.querySelector(".tarteaucitronAllow"); + let denyConsentButton = document.querySelector(".tarteaucitronDeny"); + let checkboxes = document.querySelectorAll(".form-check-input"); + + [allowConsentButton].forEach((button) => { + button.addEventListener("click", () => { + for (let i = 0; i < checkboxes.length; i++) { + if (!checkboxes.checked) { + checkboxes[i].checked = true; + } + } + }); + }); + + [denyConsentButton].forEach((button) => { + button.addEventListener("click", () => { + for (let i = 0; i < checkboxes.length; i++) { + if (checkboxes.checked !== true) { + checkboxes[i].checked = false; + } + } + }); + }); + }, + { once: true } + ); })() if (typeof tarteaucitron !== 'undefined') { From 710fa6d2c8e138aa88a24acf2d003eb6b0f5ba80 Mon Sep 17 00:00:00 2001 From: LE HO Mewen Date: Mon, 18 Oct 2021 15:16:25 +0200 Subject: [PATCH 2/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index b6ad63e9a3..cdf68718f2 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -62,13 +62,13 @@ ask.innerHTML = ""; ask.append(toggle); - let allowConsentButton = document.querySelector(".tarteaucitronAllow"); - let denyConsentButton = document.querySelector(".tarteaucitronDeny"); - let checkboxes = document.querySelectorAll(".form-check-input"); + var allowConsentButton = document.querySelector(".tarteaucitronAllow"); + var denyConsentButton = document.querySelector(".tarteaucitronDeny"); + var checkboxes = document.querySelectorAll(".form-check-input"); [allowConsentButton].forEach((button) => { button.addEventListener("click", () => { - for (let i = 0; i < checkboxes.length; i++) { + for (var i = 0; i < checkboxes.length; i++) { if (!checkboxes.checked) { checkboxes[i].checked = true; } @@ -78,7 +78,7 @@ [denyConsentButton].forEach((button) => { button.addEventListener("click", () => { - for (let i = 0; i < checkboxes.length; i++) { + for (var i = 0; i < checkboxes.length; i++) { if (checkboxes.checked !== true) { checkboxes[i].checked = false; } From 100cb572690a7aaee8f72a7a351284f23a23148d Mon Sep 17 00:00:00 2001 From: MewenLeHo Date: Mon, 18 Oct 2021 15:59:53 +0200 Subject: [PATCH 3/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index cdf68718f2..cd67dc2542 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -66,8 +66,8 @@ var denyConsentButton = document.querySelector(".tarteaucitronDeny"); var checkboxes = document.querySelectorAll(".form-check-input"); - [allowConsentButton].forEach((button) => { - button.addEventListener("click", () => { + [allowConsentButton].forEach(function (button) { + button.addEventListener("click", function () { for (var i = 0; i < checkboxes.length; i++) { if (!checkboxes.checked) { checkboxes[i].checked = true; @@ -76,8 +76,8 @@ }); }); - [denyConsentButton].forEach((button) => { - button.addEventListener("click", () => { + [denyConsentButton].forEach(function (button) { + button.addEventListener("click", function () { for (var i = 0; i < checkboxes.length; i++) { if (checkboxes.checked !== true) { checkboxes[i].checked = false; From e3abb633858025d3435dbc74441c01f13464252e Mon Sep 17 00:00:00 2001 From: MewenLeHo Date: Mon, 18 Oct 2021 16:07:36 +0200 Subject: [PATCH 4/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index cd67dc2542..0b55eed6f4 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -48,10 +48,10 @@ "googletagmanager_added", function () { var ask = document.querySelector( - "#googletagmanagerLine .tarteaucitronAsk" + '#googletagmanagerLine .tarteaucitronAsk' ); var choiceEvent = - "tarteaucitron.userInterface.respond(document.getElementById('googletagmanagerAllowed'),document.getElementById('googletagmanagerAllowed').checked);"; + 'tarteaucitron.userInterface.respond(document.getElementById("googletagmanagerAllowed"),document.getElementById("googletagmanagerAllowed").checked);'; var toggle = document .createRange() .createContextualFragment( @@ -62,22 +62,22 @@ ask.innerHTML = ""; ask.append(toggle); - var allowConsentButton = document.querySelector(".tarteaucitronAllow"); - var denyConsentButton = document.querySelector(".tarteaucitronDeny"); - var checkboxes = document.querySelectorAll(".form-check-input"); + var allowConsentButton = document.querySelector('.tarteaucitronAllow') + var denyConsentButton = document.querySelector('.tarteaucitronDeny') + var checkboxes = document.querySelectorAll('.form-check-input') [allowConsentButton].forEach(function (button) { - button.addEventListener("click", function () { + button.addEventListener('click', function () { for (var i = 0; i < checkboxes.length; i++) { if (!checkboxes.checked) { checkboxes[i].checked = true; } } - }); + }) }); [denyConsentButton].forEach(function (button) { - button.addEventListener("click", function () { + button.addEventListener('click', function () { for (var i = 0; i < checkboxes.length; i++) { if (checkboxes.checked !== true) { checkboxes[i].checked = false; From ed344f5e1b9a1a169420bc3391c18ef469eb6c16 Mon Sep 17 00:00:00 2001 From: MewenLeHo Date: Mon, 18 Oct 2021 17:02:36 +0200 Subject: [PATCH 5/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 47 +++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index 0b55eed6f4..bd9677b59c 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -45,49 +45,44 @@ }, { once: true }) document.addEventListener( - "googletagmanager_added", + 'googletagmanager_added', function () { var ask = document.querySelector( '#googletagmanagerLine .tarteaucitronAsk' - ); + ) var choiceEvent = - 'tarteaucitron.userInterface.respond(document.getElementById("googletagmanagerAllowed"),document.getElementById("googletagmanagerAllowed").checked);'; + 'tarteaucitron.userInterface.respond(document.getElementById("googletagmanagerAllowed"),document.getElementById("googletagmanagerAllowed").checked);' var toggle = document .createRange() .createContextualFragment( '
' - ); - ask.innerHTML = ""; - ask.append(toggle); + ) + ask.innerHTML = '' + ask.append(toggle) - var allowConsentButton = document.querySelector('.tarteaucitronAllow') - var denyConsentButton = document.querySelector('.tarteaucitronDeny') + var allowConsentButton = document.querySelector('#tarteaucitronAllAllowed') + var denyConsentButton = document.querySelector('#tarteaucitronAllDenied') var checkboxes = document.querySelectorAll('.form-check-input') - [allowConsentButton].forEach(function (button) { - button.addEventListener('click', function () { - for (var i = 0; i < checkboxes.length; i++) { - if (!checkboxes.checked) { - checkboxes[i].checked = true; - } + allowConsentButton.addEventListener('click', function () { + for (var i = 0; i < checkboxes.length; i++) { + if (!checkboxes.checked) { + checkboxes[i].checked = true } - }) - }); - - [denyConsentButton].forEach(function (button) { - button.addEventListener('click', function () { - for (var i = 0; i < checkboxes.length; i++) { - if (checkboxes.checked !== true) { - checkboxes[i].checked = false; - } + } + }) + denyConsentButton.addEventListener('click', function () { + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes.checked !== true) { + checkboxes[i].checked = false } - }); - }); + } + }) }, { once: true } - ); + ) })() if (typeof tarteaucitron !== 'undefined') { From 6879ddf37d9e2b656a412c48ef3f2b260c35d197 Mon Sep 17 00:00:00 2001 From: MewenLeHo Date: Wed, 20 Oct 2021 14:43:14 +0200 Subject: [PATCH 6/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 50 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index bd9677b59c..1f24970019 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -38,30 +38,11 @@ alert.querySelector('.tarteaucitronDeny').innerHTML = tarteaucitron.lang.denyAll }, { once: true }) - window.addEventListener('tac.open_panel', function () { - document.querySelectorAll('#tarteaucitronServices_api button').forEach(function (button) { - button.classList.add('btn', 'btn-sm', 'ms-2') - }) - }, { once: true }) - - document.addEventListener( - 'googletagmanager_added', + window.addEventListener('tac.open_panel', function () { - var ask = document.querySelector( - '#googletagmanagerLine .tarteaucitronAsk' - ) - var choiceEvent = - 'tarteaucitron.userInterface.respond(document.getElementById("googletagmanagerAllowed"),document.getElementById("googletagmanagerAllowed").checked);' - var toggle = document - .createRange() - .createContextualFragment( - '
' - ) - ask.innerHTML = '' - ask.append(toggle) - + document.querySelectorAll('#tarteaucitronServices_api button').forEach(function (button) { + button.classList.add('btn', 'btn-sm', 'ms-2') + }) var allowConsentButton = document.querySelector('#tarteaucitronAllAllowed') var denyConsentButton = document.querySelector('#tarteaucitronAllDenied') var checkboxes = document.querySelectorAll('.form-check-input') @@ -83,6 +64,29 @@ }, { once: true } ) + + document.addEventListener( + 'googletagmanager_added', + function () { + var ask = document.querySelector( + '#googletagmanagerLine .tarteaucitronAsk' + ) + var choiceEvent = + 'tarteaucitron.userInterface.respond(document.getElementById(\'googletagmanagerAllowed\'),document.getElementById(\'googletagmanagerAllowed\').checked);' + var toggle = document + .createRange() + .createContextualFragment( + '
' + ) + ask.innerHTML = '' + ask.append(toggle) + }, + { once: true } + ) })() if (typeof tarteaucitron !== 'undefined') { From 0fcad81385676a95edcf2cde532320cbcd857c8c Mon Sep 17 00:00:00 2001 From: MewenLeHo Date: Wed, 20 Oct 2021 14:57:50 +0200 Subject: [PATCH 7/7] fix(#831): checkboxes display when user accept or deny cookies --- site/assets/js/tac.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/assets/js/tac.js b/site/assets/js/tac.js index 1f24970019..3a84a41f90 100644 --- a/site/assets/js/tac.js +++ b/site/assets/js/tac.js @@ -79,7 +79,7 @@ '
' ) ask.innerHTML = ''