Skip to content

Commit

Permalink
fix(#831): checkboxes display when user accept or deny cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
MewenLeHo committed Oct 18, 2021
1 parent 2d38909 commit 0735920
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions site/assets/js/tac.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,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(
Expand All @@ -59,22 +59,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;
Expand Down

0 comments on commit 0735920

Please sign in to comment.