From c8ce5f9965324530d71e7f443c24a6febeebf6a6 Mon Sep 17 00:00:00 2001 From: 1002Studio Date: Sun, 11 Jan 2015 02:03:22 +0100 Subject: [PATCH] More informations about installed cookies --- css/tarteaucitron.css | 10 ---------- lang/tarteaucitron.en.js | 7 ++++--- lang/tarteaucitron.fr.js | 7 ++++--- tarteaucitron.js | 40 ++++++++++++++++++++++++---------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/css/tarteaucitron.css b/css/tarteaucitron.css index eb492ea..56f52a0 100644 --- a/css/tarteaucitron.css +++ b/css/tarteaucitron.css @@ -238,16 +238,6 @@ font-size: 12px; } -#tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies b { - color: darkgreen; - font-size: 12px; -} - -#tarteaucitron #tarteaucitronServices .tarteaucitronLine .tarteaucitronName .tarteaucitronListCookies s { - color: gray; - font-size: 12px; -} - #tarteaucitron #tarteaucitronFooter { background: #f2f2f2; border-top: 1px solid #eee; diff --git a/lang/tarteaucitron.en.js b/lang/tarteaucitron.en.js index 68f8dc8..add3bac 100644 --- a/lang/tarteaucitron.en.js +++ b/lang/tarteaucitron.en.js @@ -9,13 +9,14 @@ tarteaucitron.lang = { "all": "Preference for all services", - "info": "Transparency about cookies", + "info": "Protecting your privacy", "disclaimer": "By allowing these third party services, you accept theirs cookies and the use of tracking technologies necessary for their proper functioning.", "allow": "Allow", "deny": "Deny", - "noCookie": "This service does not use cookie to work.", + "noCookie": "This service does not use cookie.", "useCookie": "This service can install", - "useCookieCurrent": "on this browser", + "useCookieCurrent": "This service has installed", + "useNoCookie": "This service has not installed any cookie.", "more": "Read more", "source": "View the official website", "credit": "Cookies manager by tarteaucitron.js", diff --git a/lang/tarteaucitron.fr.js b/lang/tarteaucitron.fr.js index 064a5ed..ccfdc72 100644 --- a/lang/tarteaucitron.fr.js +++ b/lang/tarteaucitron.fr.js @@ -9,13 +9,14 @@ tarteaucitron.lang = { "all": "Préférence pour tous les services", - "info": "Transparence sur les cookies", + "info": "Protection de votre vie privée", "disclaimer": "En autorisant ces services tiers, vous acceptez le dépôt et la lecture de cookies et l'utilisation de technologies de suivi nécessaires à leur bon fonctionnement.", "allow": "Autoriser", "deny": "Interdire", - "noCookie": "Ce service ne dépose aucun cookie pour fonctionner.", + "noCookie": "Ce service ne dépose aucun cookie.", "useCookie": "Ce service peut déposer", - "useCookieCurrent": "sur ce navigateur", + "useCookieCurrent": "Ce service a déposé", + "useNoCookie": "Ce service n'a déposé aucun cookie.", "more": "En savoir plus", "source": "Voir le site officiel", "credit": "Gestion des cookies par tarteaucitron.js", diff --git a/tarteaucitron.js b/tarteaucitron.js index 8c9cb6f..914d123 100644 --- a/tarteaucitron.js +++ b/tarteaucitron.js @@ -463,27 +463,35 @@ var tarteaucitron = { nb = arr.length, nbCurrent = 0, html = '', - htmlPlus = '', - i; + i, + status = document.cookie.indexOf(key + '=true'); - if (nb > 0) { + if (status >= 0 && nb === 0) { + html += tarteaucitron.lang.useNoCookie; + } else if (status >= 0) { + for (i = 0; i < nb; i += 1) { + if (document.cookie.indexOf(arr[i] + '=') !== -1) { + nbCurrent += 1; + } + } + + if (nbCurrent > 0) { + html += tarteaucitron.lang.useCookieCurrent + ' ' + nbCurrent + ' cookie'; + if (nbCurrent > 1) { + html += 's'; + } + html += '.'; + } else { + html += tarteaucitron.lang.useNoCookie; + } + } else if (nb === 0) { + html = tarteaucitron.lang.noCookie; + } else { html += tarteaucitron.lang.useCookie + ' ' + nb + ' cookie'; if (nb > 1) { html += 's'; } - - for (i = 0; i < nb; i += 1) { - if (document.cookie.indexOf(arr[i] + '=') !== -1) { - htmlPlus += '' + arr[i] + ' '; - nbCurrent += 1; - } else { - htmlPlus += '' + arr[i] + ' '; - } - } - - html += ' (' + nbCurrent + ' ' + tarteaucitron.lang.useCookieCurrent + ')
' + htmlPlus; - } else { - html += tarteaucitron.lang.noCookie; + html += '.'; } document.getElementById('tacCL' + key).innerHTML = html;