Browse Source

Merge branch 'master' of https://github.com/thomascombe/tarteaucitron.js into feat/hide-read-more

Thomas Combe 7 years ago
parent
commit
e1fbad4a33
4 changed files with 50 additions and 10 deletions
  1. 20 0
      README.md
  2. 3 3
      lang/tarteaucitron.es.js
  3. 5 4
      tarteaucitron.js
  4. 22 3
      tarteaucitron.services.js

+ 20 - 0
README.md

@@ -99,3 +99,23 @@ In PHP for example, you can bypass all the script by setting this var `tarteauci
 
 # Installation guide
 [Visit opt-out.ferank.eu](https://opt-out.ferank.eu/)
+
+
+# How to use
+
+```html
+<script type="text/javascript" src="/tarteaucitron/tarteaucitron.js"></script>
+
+<script type="text/javascript">
+tarteaucitron.init({
+    "hashtag": "#tarteaucitron", /* Ouverture automatique du panel avec le hashtag */
+    "highPrivacy": false, /* désactiver le consentement implicite (en naviguant) ? */
+    "orientation": "top", /* le bandeau doit être en haut (top) ou en bas (bottom) ? */
+    "adblocker": false, /* Afficher un message si un adblocker est détecté */
+    "showAlertSmall": true, /* afficher le petit bandeau en bas à droite ? */
+    "cookieslist": true, /* Afficher la liste des cookies installés ? */
+    "removeCredit": false, /* supprimer le lien vers la source ? */
+    "cookieDomain": ".my-multisite-domaine.fr" /* Nom de domaine sur lequel sera posé le cookie - pour les multisites / sous-domaines - Facultatif */
+});
+</script>
+```

+ 3 - 3
lang/tarteaucitron.es.js

@@ -1,7 +1,7 @@
 /*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 comenzar a personalizar.",
+    "adblock_call": "Por favor deshabilite su AdBlocker para empezar a personalizar los servicios.",
     "reload": "Actualizar esta página",
     
     "alertBigScroll": "Al continuar para desplazarse,",
@@ -14,7 +14,7 @@ tarteaucitron.lang = {
     "acceptAll": "OK, aceptar todas",
     "close": "Cerrar",
     
-    "all": "Preference for all services",
+    "all": "Ajustes para todos los servicios",
 
     "info": "Protegiendo tu privacidad",
     "disclaimer": "Aceptando estos servicios terceros, estas aceptando sus cookies y el uso de tecnologías de rastreo necesarias para su correcto funcionamiento.",
@@ -28,7 +28,7 @@ tarteaucitron.lang = {
     "source": "Ver sitio web oficial",
     "credit": "Gestor de cookies realizada por tarteaucitron.js",
     
-    "fallback": "esta deshabilitado.",
+    "fallback": "está deshabilitado.",
 
     "ads": {
         "title": "Red de publicidad",

+ 5 - 4
tarteaucitron.js

@@ -867,14 +867,15 @@ var tarteaucitron = {
                 expireTime = time + 31536000000, // 365 days
                 regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
                 cookie = tarteaucitron.cookie.read().replace(regex, ""),
-                value = 'tarteaucitron=' + cookie + '!' + key + '=' + status;
-            
-            if (tarteaucitron.cookie.read().indexOf(key + '=' + status) === -1) {
+                value = 'tarteaucitron=' + cookie + '!' + key + '=' + status,
+                domain = (tarteaucitron.parameters.cookieDomain !== undefined && tarteaucitron.parameters.cookieDomain !== '') ? 'domain=' + tarteaucitron.parameters.cookieDomain + ';' : '';
+
+          if (tarteaucitron.cookie.read().indexOf(key + '=' + status) === -1) {
                 tarteaucitron.pro('!' + key + '=' + status);
             }
 
             d.setTime(expireTime);
-            document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;';
+            document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
         },
         "read": function () {
             "use strict";

+ 22 - 3
tarteaucitron.services.js

@@ -854,7 +854,7 @@ tarteaucitron.services.analytics = {
         };
         window.ga.l = new Date();
         
-        tarteaucitron.addScript('//www.google-analytics.com/analytics.js', '', function () {
+        tarteaucitron.addScript('https://www.google-analytics.com/analytics.js', '', function () {
             ga('create', tarteaucitron.user.analyticsUa, {'cookieExpires': 34128000});
             ga('send', 'pageview');
             if (typeof tarteaucitron.user.analyticsMore === 'function') {
@@ -871,12 +871,17 @@ tarteaucitron.services.gtag = {
     "name": "Google Analytics (gtag.js)",
     "uri": "https://support.google.com/analytics/answer/6004245",
     "needConsent": true,
-    "cookies": ['_ga', '_gat', '_gid', '__utma', '__utmb', '__utmc', '__utmt', '__utmz'],
+    "cookies": (function () {
+        // Add _gat_gtag_UA_XXXXXXX_XX cookie to cookies array
+        var gatGtagUaCookie = '_gat_gtag_' + tarteaucitron.user.gtagUa;
+        gatGtagUaCookie = gatGtagUaCookie.replace(/-/g, '_');
+        return ['_ga', '_gat', '_gid', '__utma', '__utmb', '__utmc', '__utmt', '__utmz', gatGtagUaCookie];
+    })(),
     "js": function () {
         "use strict";
         window.dataLayer = window.dataLayer || [];
         
-        tarteaucitron.addScript('//www.googletagmanager.com/gtag/js?id=' + tarteaucitron.user.gtagUa, '', function () {
+        tarteaucitron.addScript('https://www.googletagmanager.com/gtag/js?id=' + tarteaucitron.user.gtagUa, '', function () {
             function gtag(){dataLayer.push(arguments);}
             gtag('js', new Date());
             gtag('config', tarteaucitron.user.gtagUa);
@@ -968,6 +973,20 @@ tarteaucitron.services.jsapi = {
     }
 };
 
+// recaptcha
+tarteaucitron.services.recaptcha = {
+    "key": "recaptcha",
+    "type": "api",
+    "name": "reCAPTCHA",
+    "uri": "http://www.google.com/policies/privacy/",
+    "needConsent": true,
+    "cookies": ['nid'],
+    "js": function () {
+        "use strict";
+        tarteaucitron.addScript('https://www.google.com/recaptcha/api.js');
+    }
+};
+
 // linkedin
 tarteaucitron.services.linkedin = {
     "key": "linkedin",