Verified Commit 20017871 authored by Laurent Heirendt's avatar Laurent Heirendt
Browse files

change retrieval of cookie loop

parent 4beb1da7
......@@ -91,19 +91,17 @@ $( document ).ready(function() {
jQuery('.lap-cookies-accept, .lap-cookies-refuse').addClass('disabled');
}
} else {
// get the indicator cookie
var lapCookieAgree = '';
var name = 'lap_cookie_agree=';
var ca = decodeURIComponent(document.cookie).split('; ');
for(var k = 0; k <ca.length; k++) {
var c = ca[k];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
lapCookieAgree = c.substring(name.length, c.length);
}
}
console.log(lapCookieAgree);
var cookieArray = decodeURIComponent(document.cookie).split('; ');
cookieArray.forEach(cookie => {
if (cookie.indexOf(name) == 0) {
lapCookieAgree = cookie.substring(name.length, cookie.length);
}
});
// logic
if (lapCookieAgree == '0') {
/* visitor refused cookies => remove Matomo trace if present */
jQuery('.lap-cookies-refuse').addClass('disabled');
......
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