Do not activate service after navigation if the service was not on the last page
Example: Only "Service A" was on the home page -> the user navigate to a second page Service A is automatically allowed but not Service B (the banner is displayed again)
This commit is contained in:
parent
1b6de2c3e4
commit
35c91d54c2
|
|
@ -64,6 +64,7 @@ var tarteaucitron = {
|
||||||
hostRef = document.referrer.split('/')[2],
|
hostRef = document.referrer.split('/')[2],
|
||||||
isNavigating = (hostRef === hostname) ? true : false,
|
isNavigating = (hostRef === hostname) ? true : false,
|
||||||
isAutostart,
|
isAutostart,
|
||||||
|
isWaiting,
|
||||||
isDenied,
|
isDenied,
|
||||||
isAllowed,
|
isAllowed,
|
||||||
isResponded,
|
isResponded,
|
||||||
|
|
@ -230,9 +231,10 @@ var tarteaucitron = {
|
||||||
for (index = 0; index < tarteaucitron.job.length; index += 1) {
|
for (index = 0; index < tarteaucitron.job.length; index += 1) {
|
||||||
service = s[tarteaucitron.job[index]];
|
service = s[tarteaucitron.job[index]];
|
||||||
isAutostart = (!service.needConsent) ? true : false;
|
isAutostart = (!service.needConsent) ? true : false;
|
||||||
|
isWaiting = (cookie.indexOf(service.key + '=wait') >= 0) ? true : false;
|
||||||
isDenied = (cookie.indexOf(service.key + '=false') >= 0) ? true : false;
|
isDenied = (cookie.indexOf(service.key + '=false') >= 0) ? true : false;
|
||||||
isAllowed = (cookie.indexOf(service.key + '=true') >= 0) ? true : false;
|
isAllowed = (cookie.indexOf(service.key + '=true') >= 0) ? true : false;
|
||||||
isResponded = (cookie.indexOf(service.key) >= 0) ? true : false;
|
isResponded = (cookie.indexOf(service.key + '=false') >= 0 || cookie.indexOf(service.key + '=true') >= 0) ? true : false;
|
||||||
|
|
||||||
// allow by default for non EU
|
// allow by default for non EU
|
||||||
if (isResponded === false && tarteaucitron.user.bypass === true) {
|
if (isResponded === false && tarteaucitron.user.bypass === true) {
|
||||||
|
|
@ -240,7 +242,7 @@ var tarteaucitron = {
|
||||||
tarteaucitron.cookie.create(service.key, true);
|
tarteaucitron.cookie.create(service.key, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!isResponded && (isAutostart || isNavigating) && !defaults.highPrivacy) || isAllowed) {
|
if ((!isResponded && (isAutostart || (isNavigating && isWaiting)) && !defaults.highPrivacy) || isAllowed) {
|
||||||
if (!isAllowed) {
|
if (!isAllowed) {
|
||||||
tarteaucitron.cookie.create(service.key, true);
|
tarteaucitron.cookie.create(service.key, true);
|
||||||
}
|
}
|
||||||
|
|
@ -257,6 +259,7 @@ var tarteaucitron = {
|
||||||
tarteaucitron.state[service.key] = false;
|
tarteaucitron.state[service.key] = false;
|
||||||
tarteaucitron.userInterface.color(service.key, false);
|
tarteaucitron.userInterface.color(service.key, false);
|
||||||
} else if (!isResponded) {
|
} else if (!isResponded) {
|
||||||
|
tarteaucitron.cookie.create(service.key, 'wait');
|
||||||
if (typeof service.fallback === 'function') {
|
if (typeof service.fallback === 'function') {
|
||||||
service.fallback();
|
service.fallback();
|
||||||
}
|
}
|
||||||
|
|
@ -432,7 +435,7 @@ var tarteaucitron = {
|
||||||
var d = new Date(),
|
var d = new Date(),
|
||||||
time = d.getTime(),
|
time = d.getTime(),
|
||||||
expireTime = time + 31536000000, // 365 days
|
expireTime = time + 31536000000, // 365 days
|
||||||
regex = new RegExp("!" + key + "=(true|false)", "g"),
|
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
||||||
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
||||||
value = 'tarteaucitron=' + cookie + '!' + key + '=' + status;
|
value = 'tarteaucitron=' + cookie + '!' + key + '=' + status;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue