tarteaucitronjs
Version:
tarteaucitron.io - Get a compliant and accessible cookie banner
865 lines (774 loc) • 138 kB
JavaScript
/*jslint browser: true, evil: true */
/* min ready */
var tarteaucitronScriptsDiscover = document.getElementsByTagName('script'),
tarteaucitronCurrentScript = document.currentScript instanceof HTMLScriptElement
? document.currentScript
: tarteaucitronScriptsDiscover[tarteaucitronScriptsDiscover.length - 1],
tarteaucitronPath = tarteaucitronCurrentScript.src.split('?')[0],
tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
tarteaucitronUseMin = (tarteaucitronUseMin === undefined) ? '' : tarteaucitronUseMin,
cdn = (tarteaucitronForceCDN === '') ? tarteaucitronPath.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,
tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage,
tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire,
tarteaucitronCustomText = (tarteaucitronCustomText === undefined) ? '' : tarteaucitronCustomText,
// tarteaucitronExpireInDay: true for day(s) value - false for hour(s) value
tarteaucitronExpireInDay = (tarteaucitronExpireInDay === undefined || typeof tarteaucitronExpireInDay !== "boolean") ? true : tarteaucitronExpireInDay,
timeExpire = 31536000000,
tarteaucitronProLoadServices,
tarteaucitronNoAdBlocker = false,
tarteaucitronIsLoaded = false;
var tarteaucitron = {
"version": "1.33.0",
"cdn": cdn,
"user": {},
"lang": {},
"services": {},
"added": [],
"idprocessed": [],
"state": {},
"launch": [],
"parameters": {},
"isAjax": false,
"reloadThePage": false,
"events": {
"init": function () {},
"load": function () {},
},
"init": function (params) {
"use strict";
var origOpen;
tarteaucitron.parameters = params;
if (alreadyLaunch === 0) {
alreadyLaunch = 1;
if (window.addEventListener) {
if( document.readyState === "complete" ) {
tarteaucitron.initEvents.loadEvent(false);
} else {
window.addEventListener("load", function () {
tarteaucitron.initEvents.loadEvent(false);
}, false);
}
window.addEventListener("scroll", function () {
tarteaucitron.initEvents.scrollEvent();
}, false);
window.addEventListener("keydown", function (evt) {
tarteaucitron.initEvents.keydownEvent(false, evt);
}, false);
window.addEventListener("hashchange", function () {
tarteaucitron.initEvents.hashchangeEvent();
}, false);
window.addEventListener("resize", function () {
tarteaucitron.initEvents.resizeEvent();
}, false);
} else {
if( document.readyState === "complete" ) {
tarteaucitron.initEvents.loadEvent(true);
} else {
window.attachEvent("onload", function () {
tarteaucitron.initEvents.loadEvent(true);
});
}
window.attachEvent("onscroll", function () {
tarteaucitron.initEvents.scrollEvent();
});
window.attachEvent("onkeydown", function (evt) {
tarteaucitron.initEvents.keydownEvent(true, evt);
});
window.attachEvent("onhashchange", function () {
tarteaucitron.initEvents.hashchangeEvent();
});
window.attachEvent("onresize", function () {
tarteaucitron.initEvents.resizeEvent();
});
}
if (typeof XMLHttpRequest !== 'undefined') {
origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function () {
if (window.addEventListener) {
this.addEventListener("load", function () {
if (typeof tarteaucitronProLoadServices === 'function') {
tarteaucitronProLoadServices();
}
}, false);
} else if (typeof this.attachEvent !== 'undefined') {
this.attachEvent("onload", function () {
if (typeof tarteaucitronProLoadServices === 'function') {
tarteaucitronProLoadServices();
}
});
} else {
if (typeof tarteaucitronProLoadServices === 'function') {
setTimeout(tarteaucitronProLoadServices, 1000);
}
}
try {
origOpen.apply(this, arguments);
} catch (err) {}
};
}
}
if(tarteaucitron.events.init) {
tarteaucitron.events.init();
}
},
"initEvents": {
"loadEvent": function (isOldBrowser) {
tarteaucitron.load();
tarteaucitron.fallback(['tarteaucitronOpenPanel'], function (elem) {
if (isOldBrowser) {
elem.attachEvent("onclick", function (event) {
tarteaucitron.userInterface.openPanel();
event.preventDefault();
});
} else {
elem.addEventListener("click", function (event) {
tarteaucitron.userInterface.openPanel();
event.preventDefault();
}, false);
}
}, true);
},
"keydownEvent": function (isOldBrowser, evt) {
if (evt.keyCode === 27) {
tarteaucitron.userInterface.closePanel();
}
if (isOldBrowser) {
if ( evt.keyCode === 9 && focusableEls.indexOf(evt.target) >= 0) {
if ( evt.shiftKey ) /* shift + tab */ {
if (document.activeElement === firstFocusableEl) {
lastFocusableEl.focus();
evt.preventDefault();
}
} else /* tab */ {
if (document.activeElement === lastFocusableEl) {
firstFocusableEl.focus();
evt.preventDefault();
}
}
}
}
},
"hashchangeEvent": function () {
if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
tarteaucitron.userInterface.openPanel();
}
},
"resizeEvent": function () {
var tacElem = document.getElementById('tarteaucitron');
var tacCookieContainer = document.getElementById('tarteaucitronCookiesListContainer');
if (tacElem && tacElem.style.display === 'block') {
tarteaucitron.userInterface.jsSizing('main');
}
if (tacCookieContainer && tacCookieContainer.style.display === 'block') {
tarteaucitron.userInterface.jsSizing('cookie');
}
},
"scrollEvent": function () {
var scrollPos = window.pageYOffset || document.documentElement.scrollTop;
var heightPosition;
var tacPercentage = document.getElementById('tarteaucitronPercentage');
var tacAlertBig = document.getElementById('tarteaucitronAlertBig');
if (tacAlertBig && !tarteaucitron.highPrivacy) {
if (tacAlertBig.style.display === 'block') {
heightPosition = tacAlertBig.offsetHeight + 'px';
if (scrollPos > (screen.height * 2)) {
tarteaucitron.userInterface.respondAll(true);
} else if (scrollPos > (screen.height / 2)) {
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
}
if (tacPercentage) {
if (tarteaucitron.orientation === 'top') {
tacPercentage.style.top = heightPosition;
} else {
tacPercentage.style.bottom = heightPosition;
}
tacPercentage.style.width = ((100 / (screen.height * 2)) * scrollPos) + '%';
}
}
}
},
},
"load": function () {
"use strict";
if (tarteaucitronIsLoaded === true) {
return;
}
var cdn = tarteaucitron.cdn,
language = tarteaucitron.getLanguage(),
useMinifiedJS = ((new URL(cdn,tarteaucitronPath).host == 'cdn.jsdelivr.net') || (tarteaucitronPath.indexOf('.min.') >= 0) || (tarteaucitronUseMin !== '')),
pathToLang = cdn + 'lang/tarteaucitron.' + language + (useMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
pathToServices = cdn + 'tarteaucitron.services' + (useMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
linkElement = document.createElement('link'),
defaults = {
"adblocker": false,
"hashtag": '#tarteaucitron',
"cookieName": 'tarteaucitron',
"highPrivacy": true,
"orientation": "middle",
"bodyPosition": "bottom",
"removeCredit": false,
"showAlertSmall": false,
"showDetailsOnClick": true,
"showIcon": true,
"iconPosition": "BottomRight",
"cookieslist": false,
"cookieslistEmbed": false,
"handleBrowserDNTRequest": false,
"DenyAllCta": true,
"AcceptAllCta" : true,
"moreInfoLink": true,
"privacyUrl": "",
"useExternalCss": false,
"useExternalJs": false,
"mandatory": true,
"mandatoryCta": true,
"closePopup": false,
"groupServices": false,
"serviceDefaultState": 'wait',
"googleConsentMode": true,
"pianoConsentMode": true,
"pianoConsentModeEssential": false,
"bingConsentMode": true,
"softConsentMode": false,
"dataLayer": false,
"serverSide": false,
"partnersList": false,
"alwaysNeedConsent": false
},
params = tarteaucitron.parameters;
// flag the tac load
tarteaucitronIsLoaded = true;
// Don't show the middle bar if we are on the privacy policy or more page
if (((tarteaucitron.parameters.readmoreLink !== undefined && window.location.href == tarteaucitron.parameters.readmoreLink) || window.location.href == tarteaucitron.parameters.privacyUrl) && tarteaucitron.parameters.orientation == "middle") {
tarteaucitron.parameters.orientation = "bottom";
}
// Step -1
if (typeof tarteaucitronCustomPremium !== 'undefined') {
tarteaucitronCustomPremium();
}
// Step 0: get params
if (params !== undefined) {
for (var k in defaults) {
if(!tarteaucitron.parameters.hasOwnProperty(k)) {
tarteaucitron.parameters[k] = defaults[k];
}
}
}
// global
tarteaucitron.orientation = tarteaucitron.parameters.orientation;
tarteaucitron.hashtag = tarteaucitron.parameters.hashtag;
tarteaucitron.highPrivacy = tarteaucitron.parameters.highPrivacy;
tarteaucitron.handleBrowserDNTRequest = tarteaucitron.parameters.handleBrowserDNTRequest;
tarteaucitron.customCloserId = tarteaucitron.parameters.customCloserId;
// update dataLayer when consent is updated
if (tarteaucitron.parameters.dataLayer === true) {
window.addEventListener('tac.root_available', function() {
setTimeout(function() {
window.dataLayer = window.dataLayer || [];
tarteaucitron.job.filter(job => tarteaucitron.state[job] === true).length > 0 &&
window.dataLayer.push({
event: 'tac_consent_update',
tacAuthorizedVendors: tarteaucitron.job.filter(job => tarteaucitron.state[job] === true)
});
}, 200);
});
document.addEventListener('tac.consent_updated', function () {
window.dataLayer = window.dataLayer || [];
tarteaucitron.job.filter(job => tarteaucitron.state[job] === true).length > 0 &&
window.dataLayer.push({
event: 'tac_consent_update',
tacAuthorizedVendors: tarteaucitron.job.filter(job => tarteaucitron.state[job] === true)
});
});
}
// piano consent mode
if (tarteaucitron.parameters.pianoConsentMode === true) {
window.pdl = window.pdl || {};
window.pdl.requireConsent = "v2";
if(tarteaucitron.parameters.pianoConsentModeEssential === true) {
window.pdl.consent = {
products: ["PA"],
defaultPreset: {
PA: "essential",
},
};
} else {
window.pdl.consent = {
products: ["PA"],
defaultPreset: {
PA: "opt-out",
},
};
}
document.addEventListener("pianoanalytics_consentModeOk",function () {
window.pdl.consent = {
products: ["PA"],
defaultPreset: {
PA: "opt-in",
},
};
if (window.pa && window.pa.consent && typeof window.pa.consent.setMode === "function") {
window.pa.consent.setMode("opt-in");
}
}, { once: true });
document.addEventListener("pianoanalytics_consentModeKo",function () {
window.pdl.consent = {
products: ["PA"],
defaultPreset: {
PA: "opt-out",
},
};
if (window.pa && window.pa.consent && typeof window.pa.consent.setMode === "function") {
window.pa.consent.setMode("opt-out");
}
}, { once: true });
if (tarteaucitron.parameters.softConsentMode === false) {
window.addEventListener('tac.root_available', function () {
if (typeof tarteaucitron_block !== 'undefined') {
tarteaucitron_block.unblock(/piano-analytics\.js/);
}
});
}
}
// bing consent mode
if (tarteaucitron.parameters.bingConsentMode === true) {
window.uetq = window.uetq || [];
window.uetq.push('consent', 'default', {'ad_storage': 'denied'});
window.clarity = window.clarity || function () {
(window.clarity.q = window.clarity.q || []).push(arguments);
};
document.addEventListener('clarity_consentModeOk', function () {
window.clarity('consentv2', {
ad_Storage: "granted",
analytics_Storage: "granted"
});
}, { once: true });
document.addEventListener('clarity_consentModeKo', function () {
window.clarity('consent', false);
}, { once: true });
document.addEventListener('bingads_consentModeOk', function () {
window.uetq.push('consent', 'update', {'ad_storage': 'granted'});
}, { once: true });
document.addEventListener('bingads_consentModeKo', function () {
window.uetq.push('consent', 'update', {'ad_storage': 'denied'});
}, { once: true });
if (tarteaucitron.parameters.softConsentMode === false) {
window.addEventListener('tac.root_available', function () {
if (typeof tarteaucitron_block !== 'undefined') {
tarteaucitron_block.unblock(/clarity\.ms/);
tarteaucitron_block.unblock(/bat\.bing\.com/);
}
});
}
}
// google consent mode
if (tarteaucitron.parameters.googleConsentMode === true) {
// set the dataLayer and a function to update
window.dataLayer = window.dataLayer || [];
window.tac_gtag = function tac_gtag() {
dataLayer.push(arguments);
};
// default consent to denied
window.tac_gtag('consent', 'default', {
ad_storage: 'denied',
analytics_storage: 'denied',
ad_user_data: 'denied',
ad_personalization: 'denied',
wait_for_update: 800
});
// if google ads, add a service for personalized ads
document.addEventListener('googleads_added', function() {
// skip if already added
if (tarteaucitron.added["gcmads"] === true) {
return;
}
// simple service to control gcm with event
tarteaucitron.services.gcmads = {
"key": "gcmads",
"type": "ads",
"name": "Google Ads (personalized ads)",
"uri": "https://support.google.com/analytics/answer/9976101",
"needConsent": true,
"cookies": [],
"js": function() {},
"fallback": function() {}
};
tarteaucitron.job.push('gcmads');
// fix the event handler on the buttons
var i,
allowBtns = document.getElementsByClassName("tarteaucitronAllow"),
denyBtns = document.getElementsByClassName("tarteaucitronDeny");
for (i = 0; i < allowBtns.length; i++) {
tarteaucitron.addClickEventToElement(allowBtns[i], function() {
tarteaucitron.userInterface.respond(this, true);
});
}
for (i = 0; i < denyBtns.length; i++) {
tarteaucitron.addClickEventToElement(denyBtns[i], function() {
tarteaucitron.userInterface.respond(this, false);
});
}
});
// when personalized ads are accepted, accept googleads
document.addEventListener('gcmads_allowed', function() {
tarteaucitron.setConsent('googleads', true);
});
// personalized ads loaded/allowed, set gcm to granted
document.addEventListener('gcmads_consentModeOk', function() {
window.tac_gtag('consent', 'update', {
ad_user_data: 'granted',
ad_personalization: 'granted'
});
}, { once: true });
// personalized ads disallowed, set gcm to denied
document.addEventListener('gcmads_consentModeKo', function() {
window.tac_gtag('consent', 'update', {
ad_user_data: 'denied',
ad_personalization: 'denied'
});
}, { once: true });
// google ads loaded/allowed, set gcm to granted
document.addEventListener('googleads_consentModeOk', function() {
window.tac_gtag('consent', 'update', {
ad_storage: 'granted'
});
}, { once: true });
// google ads disallowed, disable personalized ads and update gcm
document.addEventListener('googleads_consentModeKo', function() {
tarteaucitron.setConsent('gcmads', false);
window.tac_gtag('consent', 'update', {
ad_storage: 'denied'
});
}, { once: true });
// ga4 loaded/allowed, set gcm to granted
document.addEventListener('gtag_consentModeOk', function() {
window.tac_gtag('consent', 'update', {
analytics_storage: 'granted'
});
}, { once: true });
// ga4 disallowed, update gcm
document.addEventListener('gtag_consentModeKo', function() {
window.tac_gtag('consent', 'update', {
analytics_storage: 'denied'
});
}, { once: true });
// multiple ga4 loaded/allowed, set gcm to granted
document.addEventListener('multiplegtag_consentModeOk', function() {
window.tac_gtag('consent', 'update', {
analytics_storage: 'granted'
});
}, { once: true });
// multiple ga4 disallowed, update gcm
document.addEventListener('multiplegtag_consentModeKo', function() {
window.tac_gtag('consent', 'update', {
analytics_storage: 'denied'
});
}, { once: true });
// allow gtag/googleads by default if consent mode is on
if (tarteaucitron.parameters.softConsentMode === false) {
window.addEventListener('tac.root_available', function () {
if (typeof tarteaucitron_block !== 'undefined') {
tarteaucitron_block.unblock(/www\.googletagmanager\.com\/gtag\/js/);
tarteaucitron_block.unblock(/www\.googleadservices\.com\/pagead\/conversion/);
tarteaucitron_block.unblock(/AW-/);
tarteaucitron_block.unblock(/google-analytics\.com\/analytics\.js/);
tarteaucitron_block.unblock(/google-analytics\.com\/ga\.js/);
}
});
}
}
// Step 1: load css
if ( !tarteaucitron.parameters.useExternalCss ) {
linkElement.rel = 'stylesheet';
linkElement.type = 'text/css';
linkElement.href = cdn + 'css/tarteaucitron' + (useMinifiedJS ? '.min' : '') + '.css?v=' + tarteaucitron.version;
document.getElementsByTagName('head')[0].appendChild(linkElement);
}
// Step 2: load language and services
tarteaucitron.addInternalScript(pathToLang, '', function () {
if(tarteaucitronCustomText !== ''){
tarteaucitron.lang = tarteaucitron.AddOrUpdate(tarteaucitron.lang, tarteaucitronCustomText);
}
document.documentElement.style.setProperty(
"--tacTitleBanner",
JSON.stringify(tarteaucitron.lang.middleBarHead)
);
tarteaucitron.addInternalScript(pathToServices, '', function () {
// disable the expand option if services grouped by category
if (tarteaucitron.parameters.groupServices == true) {
tarteaucitron.parameters.showDetailsOnClick = true;
}
var body = document.body,
div = document.createElement('div'),
html = '',
index,
orientation = 'Top',
modalAttrs = '',
cat = ['ads', 'analytic', 'api', 'comment', 'social', 'support', 'video', 'other', 'google'],
i;
cat = cat.sort(function (a, b) {
if (tarteaucitron.lang[a].title > tarteaucitron.lang[b].title) { return 1; }
if (tarteaucitron.lang[a].title < tarteaucitron.lang[b].title) { return -1; }
return 0;
});
if(!/^<\s*(p|ul)(\s|>)/i.test(tarteaucitron.lang.disclaimer)) {
tarteaucitron.lang.disclaimer = '<p>'+tarteaucitron.lang.disclaimer+'</p>'
}
// Step 3: prepare the html
html += '<div role="heading" aria-level="2" id="tac_title" class="tac_visually-hidden">' + tarteaucitron.lang.title + '</div>';
html += '<div id="tarteaucitronPremium"></div>';
if (tarteaucitron.reloadThePage) {
html += '<button type="button" id="tarteaucitronBack" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')"></button>';
} else {
html += '<button type="button" id="tarteaucitronBack" aria-label="' + tarteaucitron.lang.close + '" title="' + tarteaucitron.lang.close + '"></button>';
}
html += '<div id="tarteaucitron" role="dialog" aria-modal="true" aria-labelledby="dialogTitle" tabindex="-1">';
if (tarteaucitron.reloadThePage) {
html += ' <button type="button" id="tarteaucitronClosePanel" aria-describedby="dialogTitle" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')">';
} else {
html += ' <button type="button" id="tarteaucitronClosePanel" aria-describedby="dialogTitle" >';
}
html += ' ' + tarteaucitron.lang.close;
html += ' </button>';
html += ' <div id="tarteaucitronServices">';
html += ' <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
html += ' <span class="tarteaucitronH1" role="heading" aria-level="2" id="dialogTitle">'+ tarteaucitron.lang.title + '</span>';
html += ' <div id="tarteaucitronInfo">';
html += ' ' + tarteaucitron.lang.disclaimer;
if (tarteaucitron.parameters.privacyUrl !== "") {
html += ' <br aria-hidden="true" /><br aria-hidden="true" />';
html += ' <button type="button" id="tarteaucitronPrivacyUrlDialog" role="link">';
html += ' ' + tarteaucitron.lang.privacyUrl;
html += ' </button>';
}
html += ' </div>';
html += ' <div class="tarteaucitronName">';
html += ' <span class="tarteaucitronH2" role="heading" aria-level="3">' + tarteaucitron.lang.all + '</span>';
html += ' </div>';
html += ' <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
html += ' <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.allowAll + '" type="button" id="tarteaucitronAllAllowed" class="tarteaucitronAllow">';
html += ' <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allowAll;
html += ' </button> ';
html += ' <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + '" type="button" id="tarteaucitronAllDenied" class="tarteaucitronDeny">';
html += ' <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.denyAll;
html += ' </button>';
html += ' </div>';
html += ' </div>';
html += ' <div class="tarteaucitronBorder">';
html += ' <div class="clear"></div><ul>';
if (tarteaucitron.parameters.mandatory == true) {
html += '<li id="tarteaucitronServicesTitle_mandatory">';
html += '<div class="tarteaucitronTitle">';
if(tarteaucitron.parameters.showDetailsOnClick){
html += ' <button type="button" tabindex="-1"><span class="tarteaucitronPlus" aria-hidden="true"></span> ' + tarteaucitron.lang.mandatoryTitle + '</button>';
}else{
html += ' <span class="asCatToggleBtn">' + tarteaucitron.lang.mandatoryTitle + '</span>';
}
html += '</div>';
html += '<ul id="tarteaucitronServices_mandatory">';
html += '<li class="tarteaucitronLine">';
html += ' <div class="tarteaucitronName">';
html += ' <span class="tarteaucitronH3" role="heading" aria-level="4">' + tarteaucitron.lang.mandatoryText + '</span>';
html += ' <span class="tarteaucitronListCookies" aria-hidden="true"></span><br/>';
html += ' </div>';
if (tarteaucitron.parameters.mandatoryCta == true) {
html += ' <div class="tarteaucitronAsk">';
html += ' <button type="button" class="tarteaucitronAllow" tabindex="-1" disabled>';
html += ' <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.allow;
html += ' </button> ';
html += ' <button type="button" class="tarteaucitronDeny" tabindex="-1">';
html += ' <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.deny;
html += ' </button> ';
html += ' </div>';
}
html += '</li>';
html += '</ul></li>';
}
if (tarteaucitron.parameters.cookieslist === false && tarteaucitron.parameters.cookieslistEmbed === true) {
setTimeout(function() {
tarteaucitron.addClickEventToId("tarteaucitron-toggle-group-cookies", function () {
tarteaucitron.userInterface.toggle('tarteaucitronServices_cookies');
if (document.getElementById('tarteaucitronServices_cookies').style.display == 'block') {
tarteaucitron.userInterface.addClass('tarteaucitronServicesTitle_cookies', 'tarteaucitronIsExpanded');
document.getElementById('tarteaucitron-toggle-group-cookies').setAttribute('aria-expanded', 'true');
} else {
tarteaucitron.userInterface.removeClass('tarteaucitronServicesTitle_cookies', 'tarteaucitronIsExpanded');
document.getElementById('tarteaucitron-toggle-group-cookies').setAttribute('aria-expanded', 'false');
}
});
}, 800);
html += ' <li id="tarteaucitronServicesnoTitle_cookies" class="tarteaucitronHidden" style="display:block">';
html += ' <ul>' +
'<li class="tarteaucitronLine" style="background:transparent">' +
' <div class="tarteaucitronName">' +
' <span class="tarteaucitronH3" role="heading" aria-level="3" id="tarteaucitronCookiesNumberBis">0 cookie</span>' +
' <button type="button" aria-expanded="false" class="tarteaucitron-toggle-group" id="tarteaucitron-toggle-group-cookies">' + tarteaucitron.lang.cookieDetail + '</button>' +
' </div>' +
'</li>' +
'</ul>';
html += ' <ul id="tarteaucitronServices_cookies" style="display:none"><div id="tarteaucitronCookiesList"></div></ul></li>';
}
for (i = 0; i < cat.length; i += 1) {
html += ' <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
html += ' <div class="tarteaucitronTitle" role="heading" aria-level="3">';
if(tarteaucitron.parameters.showDetailsOnClick)
{
html += ' <button type="button" class="catToggleBtn" aria-expanded="false" data-cat="tarteaucitronDetails' + cat[i] + '"><span class="tarteaucitronPlus" aria-hidden="true"></span> ' + tarteaucitron.lang[cat[i]].title + '</button>';
}else{
html += ' <span class="asCatToggleBtn" data-cat="tarteaucitronInlineDetails' + cat[i] + '">' + tarteaucitron.lang[cat[i]].title + '</span>';
}
html += ' </div>';
html += ' <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails '+ (tarteaucitron.parameters.showDetailsOnClick ? 'tarteaucitronInfoBox' : 'tarteaucitronDetailsInline')+'" role="paragraph">';
html += ' ' + tarteaucitron.lang[cat[i]].details;
html += ' </div>';
html += ' <ul id="tarteaucitronServices_' + cat[i] + '"></ul></li>';
}
html += ' <li id="tarteaucitronNoServicesTitle" class="tarteaucitronLine">' + tarteaucitron.lang.noServices + '</li>';
html += ' </ul>';
html += ' <div class="tarteaucitronHidden tarteaucitron-spacer-20" id="tarteaucitronScrollbarChild"></div>';
if (tarteaucitron.parameters.removeCredit === false) {
html += ' <a class="tarteaucitronSelfLink" href="https://tarteaucitron.io/" rel="nofollow noreferrer noopener" target="_blank" title="tarteaucitron ' + tarteaucitron.lang.newWindow + '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHcAAAAeCAYAAAAWwoEYAAADl0lEQVRoge1Y0W3bQAx9CjKARlC+9GVUmqDJBHEmiDyB6wkcTxBngtgTxJ0gzgQW4C/9aYOmE6g4lTQo+k6y3Rb94QOERNQd+cjj8XiGwWAwGAwGg8FgMBgMBoPB8F8RNRXe+whEKe7c36ZCAeCRxC9Rig2PUd8kPgAsoxSfQ3YAzAA8D/HwYYCb05kBKKO0teFkmbC1jlKsAnq/Abjn+QBqAIsoRS30ttwG/HNz1wH/XIxWTicLdvtW7xTAGEAMtP685CNsBTe2d/BLydfXAG57SEnMAST0zgYZSUCPk02bCvkJduIzuJzDLfPolbY+tLKmar+/8+IRePy4qdpE03qHuH8fipFb4N2+XdA3AJ/0vaQxt7s9FvkIS2XvtqnwM0rxpOQfbnE5G2LhTCmUO2fHIngOmcv+KG3HafDchB6ntwjYqenR2PqC7sOZ3E7FXHB0vqxoFyUyLh7OEH7LOGouvhhN3eIBeKXv0n5MsufdHqXcwYR5U2EbpV35lSspVPJmQj4TcgRK7jTg5IzmPUhhwM5a2WHUFCx+NgiDucmgh7idikLovHFlL0pxQ9xzX+IIP9Y6FrJsqhjlQpZRAkFVDCjZfcCHt6bqJDmuh5ylCWx0RVnk3oumaknqTH5sqrY0fBWyULaHUIgAgxb46MxV3DbieAhxOxUxjSuljig9lMQ/Bcfoi9BTEv9aLORSndVxYOH525sUDC6u2gWxcNzBNRxPanyh3ktKinOgy3WoxPbtUM0t6RkbQnzBnFPgi9GCOEubY9UffIryz9iKRe8s/FUfEWosJJGxagp85bpUO3VywQ46lOtAWfNxKwa4JXQ+628+bpxYGXXMzp5rXH401VEyXwIdowXFaKWSMFHvMTVmGnc+P3oXV2QOiBCfgex8QtcQCbcQE/H+eoHzrkFo1KM7zVO4jVVj5s6lRiWF7zyXyfRMc97J3tzj87mYqZ7E2YjzUct9GUi4tjHLR8dVkBLjQcuHFleWvQfRNEhFR7uX7pkctOwvZXsft7sAtyldEUIN2UTeLxnEfxKYswzdi88BdbZ8hifUoSMftQvP+muRwN6+Q3DeqqRExP9QmTtcheiHh0Ot1x2i2km1bP9pbufw5zZdyWsOrh7vQae5OZWbsMv30pi7cd/CKj3coPEVaCP4Zhx4eQWhOZ1Y9MTXGyP8/iGjEyfa1T4fO/4Lea9vBoPBYDAYDAaDwWAwGAwGwz8GgF8siXCCbrSRhgAAAABJRU5ErkJggg==" alt="tarteaucitron.io" /></a>';
}
html += ' </div>';
html += ' </div>';
html += '</div>';
if (tarteaucitron.parameters.orientation === 'bottom') {
orientation = 'Bottom';
}
if (tarteaucitron.parameters.orientation === 'middle' || tarteaucitron.parameters.orientation === 'popup') {
modalAttrs = ' role="dialog" aria-modal="true" aria-labelledby="tac_title"';
}
if (tarteaucitron.parameters.highPrivacy && !tarteaucitron.parameters.AcceptAllCta) {
html += '<div tabindex="-1" id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '"' + modalAttrs + '>';
//html += '<div class="tarteaucitronAlertBigWrapper">';
html += ' <span id="tarteaucitronDisclaimerAlert" role="paragraph">';
html += ' ' + tarteaucitron.lang.alertBigPrivacy;
html += ' </span>';
//html += ' <span class="tarteaucitronAlertBigBtnWrapper">';
html += ' <button type="button" id="tarteaucitronPersonalize" aria-label="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '">';
html += ' ' + tarteaucitron.lang.personalize;
html += ' </button>';
if (tarteaucitron.parameters.privacyUrl !== "") {
html += ' <button role="link" type="button" id="tarteaucitronPrivacyUrl">';
html += ' ' + tarteaucitron.lang.privacyUrl;
html += ' </button>';
}
//html += ' </span>';
//html += '</div>';
html += '</div>';
} else {
html += '<div tabindex="-1" id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '"' + modalAttrs + '>';
//html += '<div class="tarteaucitronAlertBigWrapper">';
html += ' <span id="tarteaucitronDisclaimerAlert" role="paragraph">';
if (tarteaucitron.parameters.highPrivacy) {
html += ' ' + tarteaucitron.lang.alertBigPrivacy;
} else {
html += ' ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
}
html += ' </span>';
//html += ' <span class="tarteaucitronAlertBigBtnWrapper">';
html += ' <button aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.acceptAll + '" type="button" class="tarteaucitronCTAButton tarteaucitronAllow" id="tarteaucitronPersonalize2" aria-describedby="tarteaucitronDisclaimerAlert" >';
html += ' <span class="tarteaucitronCheck" aria-hidden="true"></span> ' + tarteaucitron.lang.acceptAll;
html += ' </button>';
if (tarteaucitron.parameters.DenyAllCta) {
if (tarteaucitron.reloadThePage) {
html += ' <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" id="tarteaucitronAllDenied2" aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.denyAll + ' (' + tarteaucitron.lang.reload + ')">';
} else {
html += ' <button type="button" class="tarteaucitronCTAButton tarteaucitronDeny" id="tarteaucitronAllDenied2" aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.icon + ' : ' + tarteaucitron.lang.denyAll + '">';
}
html += ' <span class="tarteaucitronCross" aria-hidden="true"></span> ' + tarteaucitron.lang.denyAll;
html += ' </button>';
//html += ' <br/><br/>';
}
html += ' <button type="button" id="tarteaucitronCloseAlert" aria-describedby="tarteaucitronDisclaimerAlert" aria-label="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.personalize + ' ' + tarteaucitron.lang.modalWindow + '">';
html += ' ' + tarteaucitron.lang.personalize;
html += ' </button>';
if (tarteaucitron.parameters.privacyUrl !== "") {
html += ' <button type="button" id="tarteaucitronPrivacyUrl" role="link">';
html += ' ' + tarteaucitron.lang.privacyUrl;
html += ' </button>';
}
//html += ' </span>';
//html += '</div>';
html += '</div>';
html += '<div id="tarteaucitronPercentage"></div>';
}
if (tarteaucitron.parameters.showIcon === true) {
html += '<div id="tarteaucitronIcon" class="tarteaucitronIcon' + tarteaucitron.parameters.iconPosition + '">';
html += ' <button type="button" id="tarteaucitronManager" aria-label="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '">';
html += ' <img src="' + (tarteaucitron.parameters.iconSrc ? tarteaucitron.parameters.iconSrc : 'data:image/png;base64,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') + '" alt="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.icon + ' ' + tarteaucitron.lang.modalWindow + '">';
html += ' </button>';
html += '</div>';
}
if (tarteaucitron.parameters.showAlertSmall === true) {
html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
html += ' <button type="button" id="tarteaucitronManager" aria-label="' + tarteaucitron.lang.alertSmall + ' ' + tarteaucitron.lang.modalWindow + '" title="' + tarteaucitron.lang.alertSmall + ' ' + tarteaucitron.lang.modalWindow + '">';
html += ' ' + tarteaucitron.lang.alertSmall;
html += ' <span id="tarteaucitronDot">';
html += ' <span id="tarteaucitronDotGreen"></span>';
html += ' <span id="tarteaucitronDotYellow"></span>';
html += ' <span id="tarteaucitronDotRed"></span>';
html += ' </span>';
if (tarteaucitron.parameters.cookieslist === true) {
html += ' </button><!-- @whitespace';
html += ' --><button type="button" id="tarteaucitronCookiesNumber" aria-expanded="false" aria-controls="tarteaucitronCookiesListContainer">0</button>';
html += ' <div id="tarteaucitronCookiesListContainer">';
if (tarteaucitron.reloadThePage) {
html += ' <button type="button" id="tarteaucitronClosePanelCookie" aria-label="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')" title="' + tarteaucitron.lang.close + ' (' + tarteaucitron.lang.reload + ')">';
} else {
html += ' <button type="button" id="tarteaucitronClosePanelCookie">';
}
html += ' ' + tarteaucitron.lang.close;
html += ' </button>';
html += ' <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
html += ' <span class="tarteaucitronH2" role="heading" aria-level="3" id="tarteaucitronCookiesNumberBis">0 cookie</span>';
html += ' </div>';
html += ' <div id="tarteaucitronCookiesList"></div>';
html += ' </div>';
} else {
html += ' </div>';
}
html += '</div>';
}
tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising' + (useMinifiedJS ? '.min' : '') + '.js', '', function () {
if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
// create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
/*var wrapper = document.createElement('div');
wrapper.id = "tarteaucitronContentWrapper";
while (document.body.firstChild)
{
wrapper.appendChild(document.body.firstChild);
}
// Append the wrapper to the body
document.body.appendChild(wrapper);*/
div.id = 'tarteaucitronRoot';
if (tarteaucitron.parameters.bodyPosition === 'top') {
// Prepend tarteaucitron: #tarteaucitronRoot first-child of the body for better accessibility
var bodyFirstChild = body.firstChild;
body.insertBefore(div, bodyFirstChild);
}
else {
// Append tarteaucitron: #tarteaucitronRoot last-child of the body
body.appendChild(div, body);
}
tarteaucitron.userInterface.addClass("tarteaucitronRoot", "tarteaucitronSize-" + tarteaucitron.parameters.orientation);
div.setAttribute('data-nosnippet', 'true');
div.setAttribute('lang', language);
div.setAttribute('role', 'region');
div.setAttribute('aria-labelledby', 'tac_title');
div.innerHTML = html;
//ie compatibility
var tacRootAvailableEvent;
if(typeof(Event) === 'function') {
tacRootAvailableEvent = new Event("tac.root_available");
}else if (typeof(document.createEvent) === 'function'){
tacRootAvailableEvent = document.createEvent('Event');
tacRootAvailableEvent.initEvent("tac.root_available", true, true);
}
//end ie compatibility
if (typeof(window.dispatchEvent) === 'function') {window.dispatchEvent(tacRootAvailableEvent);}
if (tarteaucitron.job !== undefined) {
tarteaucitron.job = tarteaucitron.cleanArray(tarteaucitron.job);
for (index = 0; index < tarteaucitron.job.length; index += 1) {
tarteaucitron.addService(tarteaucitron.jo