diff --git a/README.md b/README.md index ad87f15..a369845 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,8 @@ tarteaucitron.init({ "cookieslist": true, /* Afficher la liste des cookies installés ? */ "removeCredit": false, /* supprimer le lien vers la source ? */ "handleBrowserDNTRequest": false, /* Répondre au DoNotTrack du navigateur ?*/ - "cookieDomain": ".my-multisite-domaine.fr" /* Nom de domaine sur lequel sera posé le cookie - pour les multisites / sous-domaines - Facultatif */ + "moreInfoLink": true, + //"cookieDomain": ".my-multisite-domaine.fr" /* Nom de domaine sur lequel sera posé le cookie - pour les multisites / sous-domaines - Facultatif */ }); ``` diff --git a/css/tarteaucitron.css b/css/tarteaucitron.css index 3b0951d..be1fa19 100644 --- a/css/tarteaucitron.css +++ b/css/tarteaucitron.css @@ -1,3 +1,45 @@ +.modal-open{ + overflow: hidden; + height: 100%; +} + +/*** +* Reset CSS +*/ +#tarteaucitronRoot div, #tarteaucitronRoot span, #tarteaucitronRoot applet, #tarteaucitronRoot object, #tarteaucitronRoot iframe, #tarteaucitronRoot h1, #tarteaucitronRoot h2, #tarteaucitronRoot h3, #tarteaucitronRoot h4, #tarteaucitronRoot h5, #tarteaucitronRoot h6, #tarteaucitronRoot p, #tarteaucitronRoot blockquote, #tarteaucitronRoot pre, #tarteaucitronRoot a, #tarteaucitronRoot abbr, #tarteaucitronRoot acronym, #tarteaucitronRoot address, #tarteaucitronRoot big, #tarteaucitronRoot cite, #tarteaucitronRoot code, #tarteaucitronRoot del, #tarteaucitronRoot dfn, #tarteaucitronRoot em, #tarteaucitronRoot img, #tarteaucitronRoot ins, #tarteaucitronRoot kbd, #tarteaucitronRoot q, #tarteaucitronRoot s, #tarteaucitronRoot samp, #tarteaucitronRoot small, #tarteaucitronRoot strike, #tarteaucitronRoot strong, #tarteaucitronRoot sub, #tarteaucitronRoot sup, #tarteaucitronRoot tt, #tarteaucitronRoot var, #tarteaucitronRoot b, #tarteaucitronRoot u, #tarteaucitronRoot i, #tarteaucitronRoot center, #tarteaucitronRoot dl, #tarteaucitronRoot dt, #tarteaucitronRoot dd, #tarteaucitronRoot ol, #tarteaucitronRoot ul, #tarteaucitronRoot li, #tarteaucitronRoot fieldset, #tarteaucitronRoot form, #tarteaucitronRoot label, #tarteaucitronRoot legend, #tarteaucitronRoot table, #tarteaucitronRoot caption, #tarteaucitronRoot tbody, #tarteaucitronRoot tfoot, #tarteaucitronRoot thead, #tarteaucitronRoot tr, #tarteaucitronRoot th, #tarteaucitronRoot td,article, #tarteaucitronRoot aside, #tarteaucitronRoot canvas, #tarteaucitronRoot details, #tarteaucitronRoot embed, #tarteaucitronRoot figure, #tarteaucitronRoot figcaption, #tarteaucitronRoot footer, #tarteaucitronRoot header, #tarteaucitronRoot hgroup, #tarteaucitronRoot menu, #tarteaucitronRoot nav, #tarteaucitronRoot output, #tarteaucitronRoot ruby, #tarteaucitronRoot section, #tarteaucitronRoot summary, #tarteaucitronRoot time, #tarteaucitronRoot mark, #tarteaucitronRoot audio, #tarteaucitronRoot video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; + background: initial; + text-align: initial; + text-shadow: initial; +} +/* HTML5 display-role reset for older browsers */ +#tarteaucitronRoot article, #tarteaucitronRoot aside, #tarteaucitronRoot details, #tarteaucitronRoot figcaption, #tarteaucitronRoot figure, #tarteaucitronRoot footer, #tarteaucitronRoot header, #tarteaucitronRoot hgroup, #tarteaucitronRoot menu, #tarteaucitronRoot nav, #tarteaucitronRoot section { + display: block; +} +#tarteaucitronRoot ol, #tarteaucitronRoot ul { + list-style: none; +} +#tarteaucitronRoot blockquote, #tarteaucitronRoot q { + quotes: none; +} +#tarteaucitronRoot blockquote:before, #tarteaucitronRoot blockquote:after, #tarteaucitronRoot q:before, #tarteaucitronRoot q:after { + content: ''; + content: none; +} +#tarteaucitronRoot table { + border-collapse: collapse; + border-spacing: 0; +} + +#tarteaucitronRoot a:focus, #tarteaucitronRoot button:focus { + /*outline: 2px solid #cb3333;*/ +} + /*** * Responsive layout for the control panel */ @@ -37,6 +79,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) { @@ -56,6 +110,16 @@ zoom: 1; } +#tarteaucitronRoot div#tarteaucitron { + left: 0; + right: 0; + margin: auto; +} + +#tarteaucitronRoot button#tarteaucitronBack { + background: #eee; +} + #tarteaucitron .clear { clear: both; } @@ -67,15 +131,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 */ @@ -96,6 +175,23 @@ vertical-align: initial; } +#tarteaucitronRoot h1 { + font-size: 1.5em; + text-align: center; + color: #fff; + margin: 15px 0 28px; +} + +#tarteaucitronRoot h2 { + display: inline-block; + margin-left: 5px; + color: #fff; +} + +h2#tarteaucitronCookiesNumberBis { + margin-left: 0; +} + /*** * Control panel */ @@ -163,8 +259,13 @@ position: relative; } -#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle, -#tarteaucitron #tarteaucitronServices .tarteaucitronTitle, +#tarteaucitronCookiesList h3.tarteaucitronTitle { + width: 100%; + box-sizing: border-box; +} + +#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle button, +#tarteaucitron #tarteaucitronServices .tarteaucitronTitle button, #tarteaucitron #tarteaucitronInfo, #tarteaucitron #tarteaucitronServices .tarteaucitronDetails { background: #333; @@ -199,6 +300,7 @@ #tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronTitle { padding: 5px 10px; + margin: 0; } #tarteaucitron #tarteaucitronInfo, @@ -250,7 +352,7 @@ margin-top: 2px; } -#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName b { +#tarteaucitron #tarteaucitronServices .tarteaucitronMainLine .tarteaucitronName button { color: #fff; } @@ -289,6 +391,7 @@ text-align: center; text-decoration: none; width: auto; + border: 0; } #tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies { @@ -296,6 +399,16 @@ font-size: 12px; } +#tarteaucitron h3 { + font-size: 18px; +} + +#tarteaucitron #tarteaucitronMainLineOffset .tarteaucitronName { + width: auto!important; + margin-left: 0!important; + font-size: 14px; +} + /*** * Big alert */ @@ -307,7 +420,7 @@ bottom: 0; } -#tarteaucitronAlertBig { +#tarteaucitronRoot #tarteaucitronAlertBig { background: #333; color: #fff; display: none; @@ -316,18 +429,21 @@ padding: 5px 5%; position: fixed; text-align: center; - width: 90%; box-sizing: content-box; z-index: 2147483645; + text-align: center; + padding: 10px; + margin: auto; + width: 100%; } #tarteaucitronAlertBig #tarteaucitronDisclaimerAlert, -#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert b { +#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert strong { font: 15px verdana; color: #fff; } -#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert b { +#tarteaucitronAlertBig #tarteaucitronDisclaimerAlert strong { font-weight: 700; } @@ -461,7 +577,7 @@ text-align: left; } -#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList b { +#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList strong { color: #333; } @@ -472,7 +588,7 @@ text-align: left; } -#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle b { +#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesTitle strong { color: #fff; font-size: 16px; } @@ -497,7 +613,7 @@ width: 50%; } -#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain .tarteaucitronCookiesListLeft a b { +#tarteaucitronAlertSmall #tarteaucitronCookiesListContainer #tarteaucitronCookiesList .tarteaucitronCookiesListMain .tarteaucitronCookiesListLeft a strong { color: darkred; } @@ -531,7 +647,7 @@ vertical-align: middle; } -.tac_activate .tac_float b { +.tac_activate .tac_float strong { color: #fff; } diff --git a/lang/tarteaucitron.cs.js b/lang/tarteaucitron.cs.js index 057d71f..915d950 100644 --- a/lang/tarteaucitron.cs.js +++ b/lang/tarteaucitron.cs.js @@ -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ý.", diff --git a/lang/tarteaucitron.de.js b/lang/tarteaucitron.de.js index 23cdc5f..939149d 100644 --- a/lang/tarteaucitron.de.js +++ b/lang/tarteaucitron.de.js @@ -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.", diff --git a/lang/tarteaucitron.en.js b/lang/tarteaucitron.en.js index 90c8ebb..8441457 100644 --- a/lang/tarteaucitron.en.js +++ b/lang/tarteaucitron.en.js @@ -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.", diff --git a/lang/tarteaucitron.es.js b/lang/tarteaucitron.es.js index 512d805..986ef67 100644 --- a/lang/tarteaucitron.es.js +++ b/lang/tarteaucitron.es.js @@ -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.", diff --git a/lang/tarteaucitron.fr.js b/lang/tarteaucitron.fr.js index 6512403..09fd7e1 100644 --- a/lang/tarteaucitron.fr.js +++ b/lang/tarteaucitron.fr.js @@ -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é.", diff --git a/lang/tarteaucitron.it.js b/lang/tarteaucitron.it.js index 8b2faf1..89f8393 100644 --- a/lang/tarteaucitron.it.js +++ b/lang/tarteaucitron.it.js @@ -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", diff --git a/lang/tarteaucitron.nl.js b/lang/tarteaucitron.nl.js index dda9e78..2b7a1a5 100644 --- a/lang/tarteaucitron.nl.js +++ b/lang/tarteaucitron.nl.js @@ -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." diff --git a/lang/tarteaucitron.pl.js b/lang/tarteaucitron.pl.js index 6fe5b8e..fdbcc95 100644 --- a/lang/tarteaucitron.pl.js +++ b/lang/tarteaucitron.pl.js @@ -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.", diff --git a/lang/tarteaucitron.pt.js b/lang/tarteaucitron.pt.js index 690fd20..303893b 100644 --- a/lang/tarteaucitron.pt.js +++ b/lang/tarteaucitron.pt.js @@ -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", diff --git a/lang/tarteaucitron.ru.js b/lang/tarteaucitron.ru.js index d99370c..995c8c8 100644 --- a/lang/tarteaucitron.ru.js +++ b/lang/tarteaucitron.ru.js @@ -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": "Деактивирован.", diff --git a/tarteaucitron.js b/tarteaucitron.js index d5a2e3b..f7c544e 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -3,7 +3,8 @@ // define correct path for files inclusion var scripts = document.getElementsByTagName('script'), path = scripts[scripts.length - 1].src.split('?')[0], - cdn = path.split('/').slice(0, -1).join('/') + '/', + tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN, + cdn = (tarteaucitronForceCDN === '') ? path.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN, alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch, tarteaucitronForceLanguage = (tarteaucitronForceLanguage === undefined) ? '' : tarteaucitronForceLanguage, tarteaucitronForceExpire = (tarteaucitronForceExpire === undefined) ? '' : tarteaucitronForceExpire, @@ -15,7 +16,7 @@ var scripts = document.getElementsByTagName('script'), var tarteaucitron = { - "version": 323, + "version": 20180828, "cdn": cdn, "user": {}, "lang": {}, @@ -54,7 +55,7 @@ var tarteaucitron = { if (scrollPos > (screen.height * 2)) { tarteaucitron.userInterface.respondAll(true); } else if (scrollPos > (screen.height / 2)) { - document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '' + tarteaucitron.lang.alertBigScroll + ' ' + tarteaucitron.lang.alertBig; + document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '' + tarteaucitron.lang.alertBigScroll + ' ' + tarteaucitron.lang.alertBig; } if (tarteaucitron.orientation === 'top') { @@ -66,6 +67,7 @@ var tarteaucitron = { } } }, false); + window.addEventListener("keydown", function (evt) { if (evt.keyCode === 27) { tarteaucitron.userInterface.closePanel(); @@ -109,7 +111,7 @@ var tarteaucitron = { if (scrollPos > (screen.height * 2)) { tarteaucitron.userInterface.respondAll(true); } else if (scrollPos > (screen.height / 2)) { - document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '' + tarteaucitron.lang.alertBigScroll + ' ' + tarteaucitron.lang.alertBig; + document.getElementById('tarteaucitronDisclaimerAlert').innerHTML = '' + tarteaucitron.lang.alertBigScroll + ' ' + tarteaucitron.lang.alertBig; } if (tarteaucitron.orientation === 'top') { document.getElementById('tarteaucitronPercentage').style.top = heightPosition; @@ -124,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 !== '') { @@ -191,20 +208,26 @@ var tarteaucitron = { "showAlertSmall": true, "cookieslist": true, "handleBrowserDNTRequest": false, - "AcceptAllCta" : false + "AcceptAllCta" : false, + "moreInfoLink": true }, params = tarteaucitron.parameters; // Step 0: get params if (params !== undefined) { - tarteaucitron.extend(defaults, params); + + for (var k in defaults) { + if(!tarteaucitron.parameters.hasOwnProperty(k)) { + tarteaucitron.parameters[k] = defaults[k]; + } + } } // global - tarteaucitron.orientation = defaults.orientation; - tarteaucitron.hashtag = defaults.hashtag; - tarteaucitron.highPrivacy = defaults.highPrivacy; - tarteaucitron.handleBrowserDNTRequest = defaults.handleBrowserDNTRequest; + tarteaucitron.orientation = tarteaucitron.parameters.orientation; + tarteaucitron.hashtag = tarteaucitron.parameters.hashtag; + tarteaucitron.highPrivacy = tarteaucitron.parameters.highPrivacy; + tarteaucitron.handleBrowserDNTRequest = tarteaucitron.parameters.handleBrowserDNTRequest; // Step 1: load css linkElement.rel = 'stylesheet'; @@ -236,97 +259,95 @@ var tarteaucitron = { // Step 3: prepare the html html += '
'; - html += '
'; - html += '
'; - html += '
'; + html += ''; + html += ''; + html += ' '; html += '
'; - html += '
'; + html += '

'+ tarteaucitron.lang.title + '

'; html += '
'; - html += ' ' + tarteaucitron.lang.all + ''; + html += '

' + tarteaucitron.lang.all + '

'; html += '
'; html += '
'; - html += '
'; - html += ' ✓ ' + tarteaucitron.lang.allow; - html += '
'; - html += '
'; - html += ' ✗ ' + tarteaucitron.lang.deny; - html += '
'; + html += ' '; + html += ' '; html += '
'; html += '
'; html += '
'; html += ' ' + tarteaucitron.lang.disclaimer; - if (defaults.removeCredit === false) { + if (tarteaucitron.parameters.removeCredit === false) { html += '

'; - html += ' ' + tarteaucitron.lang.credit + ''; + html += ' ' + tarteaucitron.lang.credit + ''; } html += '
'; html += '
'; - html += '
'; + html += '
    '; for (i = 0; i < cat.length; i += 1) { - html += '
    '; + html += '
  • '; html += '
    '; - html += ' ' + tarteaucitron.lang[cat[i]].title; + html += ' '; html += '
    '; html += '
    '; html += ' ' + tarteaucitron.lang[cat[i]].details; html += '
    '; - html += '
  • '; - html += '
    '; + html += '
      '; } - html += '
      '; + html += '
    '; html += '
    '; html += '
    '; html += '
    '; - if (defaults.orientation === 'bottom') { + if (tarteaucitron.parameters.orientation === 'bottom') { orientation = 'Bottom'; } - if (defaults.highPrivacy && !defaults.AcceptAllCta) { - + if (tarteaucitron.parameters.highPrivacy && !defaults.AcceptAllCta) { html += '
    '; html += ' '; html += ' ' + tarteaucitron.lang.alertBigPrivacy; html += ' '; - html += ' '; + html += ' '; html += '
    '; } else { html += '
    '; html += ' '; html += ' ' + tarteaucitron.lang.alertBigClick + ' ' + tarteaucitron.lang.alertBig; html += ' '; - html += ' '; + html += ' '; + html += ' '; html += '
    '; html += '
    '; } - if (defaults.showAlertSmall === true) { + if (tarteaucitron.parameters.showAlertSmall === true) { html += '
    '; - html += '
    '; + html += '
    0
    '; + html += ' '; + if (tarteaucitron.parameters.cookieslist === true) { + html += ' '; html += '
    '; - html += '
    '; + html += '
    '; + html += ' '; html += '
    '; - html += ' 0 cookie'; + html += '

    0 cookie

    '; html += '
    '; html += '
    '; html += '
    '; @@ -337,7 +358,20 @@ var tarteaucitron = { } tarteaucitron.addScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () { - if (tarteaucitronNoAdBlocker === true || defaults.adblocker === false) { + 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 = "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; @@ -381,21 +415,33 @@ var tarteaucitron = { tarteaucitron.cookie.number(); setInterval(tarteaucitron.cookie.number, 60000); } - }, defaults.adblocker); + }, tarteaucitron.parameters.adblocker); - if (defaults.adblocker === true) { + if (tarteaucitron.parameters.adblocker === true) { setTimeout(function () { if (tarteaucitronNoAdBlocker === false) { - html = '
    '; - html += ' '; + html = ''; html += '
    '; + + // 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; @@ -427,27 +473,29 @@ var tarteaucitron = { if (tarteaucitron.added[service.key] !== true) { tarteaucitron.added[service.key] = true; - html += '
    '; + html += '
  • '; html += '
    '; - html += ' ' + service.name + '
    '; + html += '

    ' + service.name + '


    '; html += '
    '; - html += ' '; - html += ' ' + tarteaucitron.lang.more; - html += ' '; - html += ' - '; - html += ' '; - html += ' ' + tarteaucitron.lang.source; - html += ' '; + if (tarteaucitron.parameters.moreInfoLink == true) { + html += ' '; + html += ' ' + tarteaucitron.lang.more; + html += ' '; + html += ' - '; + html += ' '; + html += ' ' + tarteaucitron.lang.source; + html += ' '; + } html += '
    '; html += '
    '; - html += '
    '; + html += '
    '; - html += '
    '; + html += ' '; + html += '
    '; + html += ' '; html += '
    '; - html += '
  • '; + html += ''; tarteaucitron.userInterface.css('tarteaucitronServicesTitle_' + service.type, 'display', 'block'); @@ -651,9 +699,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 () { @@ -674,6 +728,52 @@ var tarteaucitron = { } else { tarteaucitron.userInterface.css('tarteaucitronBack', 'display', 'none'); } + if (document.getElementById('tarteaucitronCloseAlert') !== null) { + 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"; @@ -1024,27 +1124,28 @@ var tarteaucitron = { if (tarteaucitron.cookie.owner[name] !== undefined && tarteaucitron.cookie.owner[name].join(' // ') !== savedname) { savedname = tarteaucitron.cookie.owner[name].join(' // '); html += '
    '; - html += '
    '; + html += '

    '; html += ' ' + tarteaucitron.cookie.owner[name].join(' // '); - html += '

    '; - html += '
    '; + html += ' '; + html += '
    '; } else { html += '
    '; - html += '
    -
    '; + html += '
    -
    '; html += '
    '; html += '
    '; } @@ -1244,10 +1345,10 @@ var tarteaucitron = { html += '
    '; html += '
    '; - html += ' ' + tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback; - html += '
    '; + html += ' ' + tarteaucitron.services[id].name + ' ' + tarteaucitron.lang.fallback; + html += '
    '; + html += ' '; html += '
    '; html += '
    '; diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index e85bbb8..f5096b2 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -1020,7 +1020,16 @@ tarteaucitron.services.gajs = { "use strict"; window._gaq = window._gaq || []; window._gaq.push(['_setAccount', tarteaucitron.user.gajsUa]); - window._gaq.push(['_trackPageview']); + + if (tarteaucitron.user.gajsAnonymizeIp) { + window._gaq.push (['_gat._anonymizeIp']); + } + + if (tarteaucitron.user.gajsPageView) { + window._gaq.push(['_trackPageview, ' + tarteaucitron.user.gajsPageView]); + } else { + window._gaq.push(['_trackPageview']); + } tarteaucitron.addScript('//www.google-analytics.com/ga.js', '', function () { if (typeof tarteaucitron.user.gajsMore === 'function') { @@ -1047,8 +1056,24 @@ tarteaucitron.services.analytics = { }; window.ga.l = new Date(); tarteaucitron.addScript('https://www.google-analytics.com/analytics.js', '', function () { - ga('create', tarteaucitron.user.analyticsUa, {'cookieExpires': 34128000}); - ga('send', 'pageview'); + var uaCreate = {'cookieExpires': 34128000}; + tarteaucitron.extend(uaCreate, tarteaucitron.user.analyticsUaCreate || {}); + ga('create', tarteaucitron.user.analyticsUa, uaCreate); + + if (tarteaucitron.user.analyticsAnonymizeIp) { + ga('set', 'anonymizeIp', true); + } + + if (typeof tarteaucitron.user.analyticsPrepare === 'function') { + tarteaucitron.user.analyticsPrepare(); + } + + if (tarteaucitron.user.analyticsPageView) { + ga('send', 'pageview', tarteaucitron.user.analyticsPageView); + } else { + ga('send', 'pageview'); + } + if (typeof tarteaucitron.user.analyticsMore === 'function') { tarteaucitron.user.analyticsMore(); } @@ -2273,3 +2298,31 @@ tarteaucitron.services.matomo = { tarteaucitron.addScript(tarteaucitron.user.matomoHost + 'piwik.js', '', '', true, 'defer', true); } }; + +// bing ads universal event tracking +tarteaucitron.services.bingads = { + 'key': 'bingads', + 'type': 'ads', + 'name': 'Bing Ads Universal Event Tracking', + 'uri': 'https://advertise.bingads.microsoft.com/en-us/resources/policies/personalized-ads', + 'needConsent': true, + 'cookies': ['_uetmsclkid'], + 'js': function () { + 'use strict'; + var u = tarteaucitron.user.bingadsTag || 'uetq'; + window[u] = window[u] || []; + + tarteaucitron.addScript('https://bat.bing.com/bat.js', '', function () { + var bingadsCreate = {ti: tarteaucitron.user.bingadsID}; + + if ('bingadsStoreCookies' in tarteaucitron.user) { + bingadsCreate['storeConvTrackCookies'] = tarteaucitron.user.bingadsStoreCookies; + } + + bingadsCreate.q = window[u]; + window[u] = new UET(bingadsCreate); + window[u].push('pageload'); + }); + } +}; +