Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions jquery.ihavecookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@
}
});
}, settings.delay);

var body = $('body');
// When accept button is clicked drop cookie
$('body').on('click','#gdpr-cookie-accept', function(){
body.on('click','#gdpr-cookie-accept', function(){
// Set cookie
dropCookie(true, settings.expires);

Expand All @@ -116,7 +116,7 @@
});

// Toggle advanced cookie options
$('body').on('click', '#gdpr-cookie-advanced', function(){
body.on('click', '#gdpr-cookie-advanced', function(){
// Uncheck all checkboxes except for the disabled 'necessary'
// one and set 'data-auto' to OFF for all. The user can now
// select the cookies they want to accept.
Expand Down Expand Up @@ -155,10 +155,7 @@
if (control === false) {
return false;
}
if (preferences === false || preferences.indexOf(cookieTypeValue) === -1) {
return false;
}
return true;
return !(preferences === false || preferences.indexOf(cookieTypeValue) === -1);
};

/*
Expand Down