Merge pull request #199 from lchandelier/master

Accessibility fixes
This commit is contained in:
Amauri CHAMPEAUX 2018-08-28 09:34:34 +02:00 committed by GitHub
commit fe6c80da5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 300 additions and 78 deletions

View File

@ -1,3 +1,12 @@
.modal-open{
overflow: hidden;
height: 100%;
}
a:focus, button:focus {
outline: 2px solid #cb3333;
}
/***
* Responsive layout for the control panel
*/
@ -37,6 +46,18 @@
#tarteaucitron #tarteaucitronServices .tarteaucitronTitle {
text-align: left !important;
}
.tarteaucitronName h2 {
max-width: 80%;
}
#tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronAsk {
text-align: center !important;
}
#tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronAsk button {
margin-bottom: 5px;
}
}
@media screen and (min-width:768px) and (max-width:991px) {
@ -67,15 +88,30 @@
text-decoration: none;
}
#tarteaucitronRoot button {
background: transparent;
border: 0;
}
#tarteaucitronAlertBig strong, #tarteaucitronAlertSmall strong,
#tarteaucitronAlertBig a, #tarteaucitronAlertSmall a {
color: #fff;
}
#tarteaucitron b {
#tarteaucitron strong {
font-size: 22px;
font-weight: 500;
}
#tarteaucitron ul {
padding: 0;
}
.cookie-list {
list-style: none;
padding: 0;
margin: 0;
}
/***
* Root div added just before </body>
*/
@ -96,6 +132,18 @@
vertical-align: initial;
}
#tarteaucitronRoot h1 {
font-size: 1.5em;
text-align: center;
color: #fff;
}
#tarteaucitronRoot h2 {
display: inline-block;
margin-left: 5px;
color: #fff;
}
/***
* Control panel
*/
@ -163,8 +211,8 @@
position: relative;
}
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle,
#tarteaucitron #tarteaucitronServices .tarteaucitronTitle,
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle button,
#tarteaucitron #tarteaucitronServices .tarteaucitronTitle button,
#tarteaucitron #tarteaucitronInfo,
#tarteaucitron #tarteaucitronServices .tarteaucitronDetails {
background: #333;
@ -199,6 +247,7 @@
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle {
padding: 5px 10px;
margin: 0;
}
#tarteaucitron #tarteaucitronInfo,
@ -250,7 +299,7 @@
margin-top: 2px;
}
#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName b {
#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName button {
color: #fff;
}
@ -289,6 +338,7 @@
text-align: center;
text-decoration: none;
width: auto;
border: 0;
}
#tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies {
@ -322,12 +372,12 @@
}
#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert,
#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert b {
#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert strong {
font: 15px verdana;
color: #fff;
}
#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert b {
#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert strong {
font-weight: 700;
}
@ -461,7 +511,7 @@
text-align: left;
}
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList b {
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList strong {
color: #333;
}
@ -472,7 +522,7 @@
text-align: left;
}
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle b {
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle strong {
color: #fff;
font-size: 16px;
}
@ -497,7 +547,7 @@
width: 50%;
}
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain .tarteaucitronCookiesListLeft a b {
#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain .tarteaucitronCookiesListLeft a strong {
color: darkred;
}
@ -531,7 +581,7 @@
vertical-align: middle;
}
.tac_activate .tac_float b {
.tac_activate .tac_float strong {
color: #fff;
}

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Dozvědět se více",
"source": "Zobrazit oficiální stránku",
"credit": "Správce cookies od tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "je vypnutý.",

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Weiter lesen",
"source": "Zur offiziellen Webseite",
"credit": "Cookies manager von tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "ist deaktiviert.",

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Read more",
"source": "View the official website",
"credit": "Cookies manager by tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "is disabled.",

View File

@ -1,12 +1,12 @@
/*global tarteaucitron */
tarteaucitron.lang = {
"adblock": "Hola! Este sitio web es transparente y le da la opción de activar los servicios de terceros.",
"adblock_call": "Por favor deshabilite su AdBlocker para personalizar los servicios.",
"adblock_call": "Por favor deshabilite su AdBlocker para empezar a personalizar los servicios.",
"reload": "Actualizar esta página",
"alertBigScroll": "Al continuar para desplazarse,",
"alertBigClick": "Si continuas navegando por este sitio web,",
"alertBig": "estas permitiendo servicios de terceros",
"alertBig": "estar permitiendo servicios terceros",
"alertBigPrivacy": "Este sitio web usa cookies y te permite controlar lo que deseas activar",
"alertSmall": "Gestionar servicios",
@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Leer más",
"source": "Ver sitio web oficial",
"credit": "Gestor de cookies realizada por tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "está deshabilitado.",
@ -35,12 +43,12 @@ tarteaucitron.lang = {
"details": "Las redes publicitarias pueden generar ingresos mediante la venta de espacios publicitarios en el sitio."
},
"analytic": {
"title": "Medición de audiencia",
"title": "Mediciión de audiencia",
"details": "Los servicios de medición de audiencia se usan para generar asistencia estadísticas útiles para mejorar el sitio."
},
"social": {
"title": "Redes sociales",
"details": "Las redes sociales pueden aumentar la usabilidad del sitio web y ayudar a promoverlo cuando se comparte."
"details": "Las redes sociales pueden aumentar la usabilidad del sitio web y ayudar a promoverlo a través de la contribución."
},
"video": {
"title": "Videos",
@ -56,7 +64,7 @@ tarteaucitron.lang = {
},
"api": {
"title": "APIs",
"details": "Los APIs se utilizan para cargar scripts: geolocalización, motor de búsqueda, traducciones, ..."
"details": "APIs se utilizan para cargar scripts: geolocalización, motor de búsqueda, traducciones, ..."
},
"other": {
"title": "Otro",

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "En savoir plus",
"source": "Voir le site officiel",
"credit": "Gestion des cookies par tarteaucitron.js",
"toggleInfoBox": "Afficher/masquer les informations sur le stockage des cookies",
"title": "Panneau de gestion des cookies",
"cookieDetail": "Détail des cookies",
"ourSite": "sur notre site",
"newWindow": "(nouvelle fenêtre)",
"allowAll": "Autoriser tous les cookies",
"denyAll": "Interdire tous les cookies",
"fallback": "est désactivé.",

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Saperne di più",
"source": "Vai al sito ufficiale",
"credit": "Gestione dei cookies da tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "è disattivato",

View File

@ -30,6 +30,14 @@ tarteaucitron.lang = {
"fallback": "is uitgeschakeld.",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"ads": {
"title": "Advertentienetwerk",
"details": "Advertentienetwerken kunnen inkomsten genereren door advertentieruimte op de site te verkopen."

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Więcej informacji",
"source": "Zobacz oficjalną stronę internetowa",
"credit": "Cookies menadżer z tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "jest nieaktywna.",

View File

@ -25,6 +25,15 @@ tarteaucitron.lang = {
"more": "Ler mais",
"source": "Ver o site oficial",
"credit": "Gerenciador de cookies por tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "está desativado.",
"ads": {
"title": "Rede de anúncios",

View File

@ -27,6 +27,14 @@ tarteaucitron.lang = {
"more": "Подробнее",
"source": "Посетите официальный сайт",
"credit": "Кукис манаджер tarteaucitron.js",
"toggleInfoBox": "Show/hide informations about cookie storage",
"title": "Cookies management panel",
"cookieDetail": "Cookie detail for",
"ourSite": "on our site",
"newWindow": "(new window)",
"allowAll": "Allow all cookies",
"denyAll": "Deny all cookies",
"fallback": "Деактивирован.",

View File

@ -55,7 +55,7 @@ var tarteaucitron = {
if (scrollPos > (screen.height * 2)) {
tarteaucitron.userInterface.respondAll(true);
} else if (scrollPos > (screen.height / 2)) {
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<b>' + tarteaucitron.lang.alertBigScroll + '</b> ' + tarteaucitron.lang.alertBig;
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
}
if (tarteaucitron.orientation === 'top') {
@ -67,6 +67,7 @@ var tarteaucitron = {
}
}
}, false);
window.addEventListener("keydown", function (evt) {
if (evt.keyCode === 27) {
tarteaucitron.userInterface.closePanel();
@ -110,7 +111,7 @@ var tarteaucitron = {
if (scrollPos > (screen.height * 2)) {
tarteaucitron.userInterface.respondAll(true);
} else if (scrollPos > (screen.height / 2)) {
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<b>' + tarteaucitron.lang.alertBigScroll + '</b> ' + tarteaucitron.lang.alertBig;
document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '<strong>' + tarteaucitron.lang.alertBigScroll + '</strong> ' + tarteaucitron.lang.alertBig;
}
if (tarteaucitron.orientation === 'top') {
document.getElementById('tarteaucitronPercentage').style.top = heightPosition;
@ -125,6 +126,21 @@ var tarteaucitron = {
if (evt.keyCode === 27) {
tarteaucitron.userInterface.closePanel();
}
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();
}
}
}
});
window.attachEvent("onhashchange", function () {
if (document.location.hash === tarteaucitron.hashtag && tarteaucitron.hashtag !== '') {
@ -236,46 +252,45 @@ var tarteaucitron = {
// Step 3: prepare the html
html += '<div id="tarteaucitronPremium"></div>';
html += '<div id="tarteaucitronBack" onclick="tarteaucitron.userInterface.closePanel();"></div>';
html += '<div id="tarteaucitron">';
html += ' <div id="tarteaucitronClosePanel" onclick="tarteaucitron.userInterface.closePanel();">';
html += '<button id="tarteaucitronBack" onclick="tarteaucitron.userInterface.closePanel();" aria-label="' + tarteaucitron.lang.close + '"></button>';
html += '<div id="tarteaucitron" role="dialog" aria-labelledby="dialogTitle">';
html += ' <button id="tarteaucitronClosePanel" onclick="tarteaucitron.userInterface.closePanel();">';
html += ' ' + tarteaucitron.lang.close;
html += ' </div>';
html += ' </button>';
html += ' <div id="tarteaucitronServices">';
html += ' <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset">';
html += ' <div class="tarteaucitronLine tarteaucitronMainLine" id="tarteaucitronMainLineOffset"><h1 id="dialogTitle">'+ tarteaucitron.lang.title + '</h1>';
html += ' <div class="tarteaucitronName">';
html += ' <b><a href="#" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronInfo\', \'tarteaucitronInfoBox\');return false">&#10011;</a> ' + tarteaucitron.lang.all + '</b>';
html += ' <button onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronInfo\', \'tarteaucitronInfoBox\');return false" aria-label="' + tarteaucitron.lang.toggleInfoBox + '">&#10011;</button> <h2>' + tarteaucitron.lang.all + '</h2>';
html += ' </div>';
html += ' <div class="tarteaucitronAsk" id="tarteaucitronScrollbarAdjust">';
html += ' <div id="tarteaucitronAllAllowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respondAll(true);">';
html += ' &#10003; ' + tarteaucitron.lang.allow;
html += ' </div> ';
html += ' <div id="tarteaucitronAllDenied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
html += ' &#10007; ' + tarteaucitron.lang.deny;
html += ' </div>';
html += ' <button id="tarteaucitronAllAllowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respondAll(true);">';
html += ' &#10003; ' + tarteaucitron.lang.allowAll;
html += ' </button> ';
html += ' <button id="tarteaucitronAllDenied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respondAll(false);">';
html += ' &#10007; ' + tarteaucitron.lang.denyAll;
html += ' </button>';
html += ' </div>';
html += ' </div>';
html += ' <div id="tarteaucitronInfo" class="tarteaucitronInfoBox">';
html += ' ' + tarteaucitron.lang.disclaimer;
if (defaults.removeCredit === false) {
html += ' <br/><br/>';
html += ' <a href="https://opt-out.ferank.eu/" rel="nofollow" target="_blank" rel="noopener">' + tarteaucitron.lang.credit + '</a>';
html += ' <a href="https://opt-out.ferank.eu/" rel="nofollow" target="_blank" rel="noopener" title="tarteaucitron ' + tarteaucitron.lang.newWindow + '">' + tarteaucitron.lang.credit + '</a>';
}
html += ' </div>';
html += ' <div class="tarteaucitronBorder" id="tarteaucitronScrollbarParent">';
html += ' <div class="clear"></div>';
html += ' <div class="clear"></div><ul>';
for (i = 0; i < cat.length; i += 1) {
html += ' <div id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
html += ' <li id="tarteaucitronServicesTitle_' + cat[i] + '" class="tarteaucitronHidden">';
html += ' <div class="tarteaucitronTitle">';
html += ' <a href="#" onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronDetails' + cat[i] + '\', \'tarteaucitronInfoBox\');return false">&#10011;</a> ' + tarteaucitron.lang[cat[i]].title;
html += ' <button onclick="tarteaucitron.userInterface.toggle(\'tarteaucitronDetails' + cat[i] + '\', \'tarteaucitronInfoBox\');return false">&#10011; ' + tarteaucitron.lang[cat[i]].title + '</button>';
html += ' </div>';
html += ' <div id="tarteaucitronDetails' + cat[i] + '" class="tarteaucitronDetails tarteaucitronInfoBox">';
html += ' ' + tarteaucitron.lang[cat[i]].details;
html += ' </div>';
html += ' </div>';
html += ' <div id="tarteaucitronServices_' + cat[i] + '"></div>';
html += ' <ul id="tarteaucitronServices_' + cat[i] + '"></ul></li>';
}
html += ' <div class="tarteaucitronHidden" id="tarteaucitronScrollbarChild" style="height:20px;display:block"></div>';
html += ' </ul><div class="tarteaucitronHidden" id="tarteaucitronScrollbarChild" style="height:20px;display:block"></div>';
html += ' </div>';
html += ' </div>';
html += '</div>';
@ -289,43 +304,43 @@ var tarteaucitron = {
html += ' <span id="tarteaucitronDisclaimerAlert">';
html += ' ' + tarteaucitron.lang.alertBigPrivacy;
html += ' </span>';
html += ' <span id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' <button id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' ' + tarteaucitron.lang.personalize;
html += ' </span>';
html += ' </button>';
html += '</div>';
} else {
html += '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '">';
html += ' <span id="tarteaucitronDisclaimerAlert">';
html += ' ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig;
html += ' </span>';
html += ' <span id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
html += ' <button id="tarteaucitronPersonalize" onclick="tarteaucitron.userInterface.respondAll(true);">';
html += ' &#10003; ' + tarteaucitron.lang.acceptAll;
html += ' </span>';
html += ' <span id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' </button>';
html += ' <button id="tarteaucitronCloseAlert" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' ' + tarteaucitron.lang.personalize;
html += ' </span>';
html += ' </button>';
html += '</div>';
html += '<div id="tarteaucitronPercentage"></div>';
}
if (defaults.showAlertSmall === true) {
html += '<div id="tarteaucitronAlertSmall" class="tarteaucitronAlertSmall' + orientation + '">';
html += ' <div id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' <button id="tarteaucitronManager" onclick="tarteaucitron.userInterface.openPanel();">';
html += ' ' + tarteaucitron.lang.alertSmall;
html += ' <div id="tarteaucitronDot">';
html += ' <span id="tarteaucitronDot">';
html += ' <span id="tarteaucitronDotGreen"></span>';
html += ' <span id="tarteaucitronDotYellow"></span>';
html += ' <span id="tarteaucitronDotRed"></span>';
html += ' </div>';
html += ' </span>';
if (defaults.cookieslist === true) {
html += ' </div><!-- @whitespace';
html += ' --><div id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</div>';
html += ' </button><!-- @whitespace';
html += ' --><button id="tarteaucitronCookiesNumber" onclick="tarteaucitron.userInterface.toggleCookiesList();">0</button>';
html += ' <div id="tarteaucitronCookiesListContainer">';
html += ' <div id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
html += ' <button id="tarteaucitronClosePanelCookie" onclick="tarteaucitron.userInterface.closePanel();">';
html += ' ' + tarteaucitron.lang.close;
html += ' </div>';
html += ' </button>';
html += ' <div class="tarteaucitronCookiesListMain" id="tarteaucitronCookiesTitle">';
html += ' <b id="tarteaucitronCookiesNumberBis">0 cookie</b>';
html += ' <h2 id="tarteaucitronCookiesNumberBis">0 cookie</h2>';
html += ' </div>';
html += ' <div id="tarteaucitronCookiesList"></div>';
html += ' </div>';
@ -337,6 +352,19 @@ var tarteaucitron = {
tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
if (tarteaucitronNoAdBlocker === true || defaults.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 = "contentWrapper";
while (document.body.firstChild)
{
wrapper.appendChild(document.body.firstChild);
}
// Append the wrapper to the body
document.body.appendChild(wrapper);
div.id = 'tarteaucitronRoot';
body.appendChild(div, body);
div.innerHTML = html;
@ -385,16 +413,28 @@ var tarteaucitron = {
if (defaults.adblocker === true) {
setTimeout(function () {
if (tarteaucitronNoAdBlocker === false) {
html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block">';
html += ' <span id="tarteaucitronDisclaimerAlert">';
html = '<div id="tarteaucitronAlertBig" class="tarteaucitronAlertBig' + orientation + '" style="display:block" role="alert" aria-live="polite">';
html += ' <p id="tarteaucitronDisclaimerAlert">';
html += ' ' + tarteaucitron.lang.adblock + '<br/>';
html += ' <b>' + tarteaucitron.lang.adblock_call + '</b>';
html += ' </span>';
html += ' <span id="tarteaucitronPersonalize" onclick="location.reload();">';
html += ' <strong>' + tarteaucitron.lang.adblock_call + '</strong>';
html += ' </p>';
html += ' <button id="tarteaucitronPersonalize" onclick="location.reload();">';
html += ' ' + tarteaucitron.lang.reload;
html += ' </span>';
html += ' </button>';
html += '</div>';
html += '<div id="tarteaucitronPremium"></div>';
// create wrapper container
var wrapper = document.createElement('div');
wrapper.id = "contentWrapper";
while (document.body.firstChild)
{
wrapper.appendChild(document.body.firstChild);
}
// Append the wrapper to the body
document.body.appendChild(wrapper);
div.id = 'tarteaucitronRoot';
body.appendChild(div, body);
div.innerHTML = html;
@ -426,27 +466,27 @@ var tarteaucitron = {
if (tarteaucitron.added[service.key] !== true) {
tarteaucitron.added[service.key] = true;
html += '<div id="' + service.key + 'Line" class="tarteaucitronLine">';
html += '<li id="' + service.key + 'Line" class="tarteaucitronLine">';
html += ' <div class="tarteaucitronName">';
html += ' <b>' + service.name + '</b><br/>';
html += ' <h3>' + service.name + '</h3><br/>';
html += ' <span id="tacCL' + service.key + '" class="tarteaucitronListCookies"></span><br/>';
html += ' <a href="https://opt-out.ferank.eu/service/' + service.key + '/" target="_blank" rel="noopener">';
html += ' <a href="https://opt-out.ferank.eu/service/' + service.key + '/" target="_blank" rel="noopener" title="'+ tarteaucitron.lang.cookieDetail + ' ' + service.name + ' ' + tarteaucitron.lang.ourSite + ' ' + tarteaucitron.lang.newWindow +'">';
html += ' ' + tarteaucitron.lang.more;
html += ' </a>';
html += ' - ';
html += ' <a href="' + service.uri + '" target="_blank" rel="noopener">';
html += ' <a href="' + service.uri + '" target="_blank" rel="noopener" title="' + service.name + ' ' + tarteaucitron.lang.newWindow + '">';
html += ' ' + tarteaucitron.lang.source;
html += ' </a>';
html += ' </div>';
html += ' <div class="tarteaucitronAsk">';
html += ' <div id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
html += ' <button id="' + service.key + 'Allowed" class="tarteaucitronAllow" onclick="tarteaucitron.userInterface.respond(this, true);">';
html += ' &#10003; ' + tarteaucitron.lang.allow;
html += ' </div> ';
html += ' <div id="' + service.key + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
html += ' </button> ';
html += ' <button id="' + service.key + 'Denied" class="tarteaucitronDeny" onclick="tarteaucitron.userInterface.respond(this, false);">';
html += ' &#10007; ' + tarteaucitron.lang.deny;
html += ' </div>';
html += ' </button>';
html += ' </div>';
html += '</div>';
html += '</li>';
tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block');
@ -650,9 +690,15 @@ var tarteaucitron = {
},
"openPanel": function () {
"use strict";
tarteaucitron.userInterface.css('tarteaucitron', 'display', 'block');
tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'block');
tarteaucitron.userInterface.css('tarteaucitronCookiesListContainer', 'display', 'none');
document.getElementById('tarteaucitronClosePanel').focus();
document.getElementById('contentWrapper').setAttribute("aria-hidden", "true");
document.getElementsByTagName('body')[0].classList.add('modal-open');
tarteaucitron.userInterface.focusTrap();
tarteaucitron.userInterface.jsSizing('main');
},
"closePanel": function () {
@ -673,6 +719,50 @@ var tarteaucitron = {
} else {
tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none');
}
document.getElementById('tarteaucitronCloseAlert').focus();
document.getElementById('contentWrapper').setAttribute("aria-hidden", "false");
document.getElementsByTagName('body')[0].classList.remove('modal-open');
},
"focusTrap": function() {
"use strict";
var focusableEls,
firstFocusableEl,
lastFocusableEl,
filtered;
focusableEls = document.getElementById('tarteaucitron').querySelectorAll('a[href], button');
filtered = [];
// get only visible items
for (var i = 0, max = focusableEls.length; i < max; i++) {
if (focusableEls[i].offsetHeight > 0) {
filtered.push(focusableEls[i]);
}
}
firstFocusableEl = filtered[0];
lastFocusableEl = filtered[filtered.length - 1];
//loop focus inside tarteaucitron
document.getElementById('tarteaucitron').addEventListener("keydown", function (evt) {
if ( evt.key === 'Tab' || evt.keyCode === 9 ) {
if ( evt.shiftKey ) /* shift + tab */ {
if (document.activeElement === firstFocusableEl) {
lastFocusableEl.focus();
evt.preventDefault();
}
} else /* tab */ {
if (document.activeElement === lastFocusableEl) {
firstFocusableEl.focus();
evt.preventDefault();
}
}
}
})
},
"openAlert": function () {
"use strict";
@ -1023,27 +1113,28 @@ var tarteaucitron = {
if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) {
savedname = tarteaucitron.cookie.owner[name].join(' // ');
html += '<div class="tarteaucitronHidden">';
html += ' <div class="tarteaucitronTitle">';
html += ' <h3 class="tarteaucitronTitle">';
html += ' ' + tarteaucitron.cookie.owner[name].join(' // ');
html += ' </div>';
html += '</div>';
html += ' </h3>';
html += '</div><ul class="cookie-list">';
} else if (tarteaucitron.cookie.owner[name] === undefined && host !== savedname) {
savedname = host;
html += '<div class="tarteaucitronHidden">';
html += ' <div class="tarteaucitronTitle">';
html += ' <h3 class="tarteaucitronTitle">';
html += ' ' + host;
html += ' </div>';
html += '</div>';
html += ' </h3>';
html += '</div><ul class="cookie-list">';
}
html += '<div class="tarteaucitronCookiesListMain">';
html += ' <div class="tarteaucitronCookiesListLeft"><a href="#" onclick="tarteaucitron.cookie.purge([\'' + cookies[i].split('=', 1) + '\']);tarteaucitron.cookie.number();tarteaucitron.userInterface.jsSizing(\'cookie\');return false"><b>&times;</b></a> <b>' + name + '</b>';
html += '<li class="tarteaucitronCookiesListMain">';
html += ' <div class="tarteaucitronCookiesListLeft"><button onclick="tarteaucitron.cookie.purge([\'' + cookies[i].split('=', 1) + '\']);tarteaucitron.cookie.number();tarteaucitron.userInterface.jsSizing(\'cookie\');return false"><strong>&times;</strong></button> <strong>' + name + '</strong>';
html += ' </div>';
html += ' <div class="tarteaucitronCookiesListRight">' + cookies[i].split('=').slice(1).join('=') + '</div>';
html += '</div>';
html += '</li>';
}
html += '</ul>';
} else {
html += '<div class="tarteaucitronCookiesListMain">';
html += ' <div class="tarteaucitronCookiesListLeft"><b>-</b></div>';
html += ' <div class="tarteaucitronCookiesListLeft"><strong>-</strong></div>';
html += ' <div class="tarteaucitronCookiesListRight"></div>';
html += '</div>';
}
@ -1243,10 +1334,10 @@ var tarteaucitron = {
html += '<div class="tac_activate">';
html += ' <div class="tac_float">';
html += ' <b>' + tarteaucitron.services[id].name + '</b> ' + tarteaucitron.lang.fallback;
html += ' <div class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
html += ' <strong>' + tarteaucitron.services[id].name + '</strong> ' + tarteaucitron.lang.fallback;
html += ' <button class="tarteaucitronAllow" id="Eng' + r + 'ed' + id + '" onclick="tarteaucitron.userInterface.respond(this, true);">';
html += ' &#10003; ' + tarteaucitron.lang.allow;
html += ' </div>';
html += ' </button>';
html += ' </div>';
html += '</div>';