Verified Commit 173a2da7 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

generalizations

parent a5e812da
......@@ -9,12 +9,12 @@
<div class="banner-checkboxes">
<label class="input-toggle">
<input id="checkbox-1" type="checkbox" checked disabled>
<input type="checkbox" checked disabled>
<span></span>
</label>
<span class="checkbox-label">Necessary</span>
<label class="input-toggle analytics">
<input id="checkbox-2" type="checkbox">
<input id="checkbox-1" type="checkbox">
<span></span>
</label>
<span class="checkbox-label">Analytics</span>
......
......@@ -119,20 +119,7 @@ function accept() {
$('.lap-cookies-accept').addClass('selected');
$('.lap-cookies-refuse').removeClass('selected');
var boxID = 2;
$('input#checkbox-' + boxID)[0].checked = true;
}
/*
* toggleBox: refuse/accept based on checkbox with boxID
*/
function toggleBox(boxID) {
if ($('input#checkbox-' + boxID)[0].checked === true) {
refuse(false);
} else {
accept();
}
hideBanner();
$("input[id^=check]").not(this).prop('checked', true);
}
/*
......@@ -155,8 +142,19 @@ function refuse(doNotTrack) {
$('.lap-cookies-refuse').addClass('selected');
$('.lap-cookies-accept').removeClass('selected');
var boxID = 2;
$('input#checkbox-' + boxID)[0].checked = false;
$("input[id^=check]").not(this).prop('checked', false);
}
/*
* toggleBox: refuse/accept based on checkbox with boxID
*/
function toggleBox(boxID) {
if ($('input#checkbox-' + boxID)[0].checked === true) {
refuse(false);
} else {
accept();
}
hideBanner();
}
/*
......@@ -179,7 +177,7 @@ $(document).ready(function() {
$('.analytics').click(function(e) {
e.preventDefault(true);
toggleBox(2);
toggleBox(1); // this ID matches with the checkbox-1 input
});
// detect if the visitor is a bot or not
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment