Merge pull request #113 from thomascombe/feat/domain-param
Select cookie domain
This commit is contained in:
commit
65f6af288b
20
README.md
20
README.md
|
|
@ -99,3 +99,23 @@ In PHP for example, you can bypass all the script by setting this var `tarteauci
|
||||||
|
|
||||||
# Installation guide
|
# Installation guide
|
||||||
[Visit opt-out.ferank.eu](https://opt-out.ferank.eu/)
|
[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>
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -865,14 +865,15 @@ var tarteaucitron = {
|
||||||
expireTime = time + 31536000000, // 365 days
|
expireTime = time + 31536000000, // 365 days
|
||||||
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
regex = new RegExp("!" + key + "=(wait|true|false)", "g"),
|
||||||
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
cookie = tarteaucitron.cookie.read().replace(regex, ""),
|
||||||
value = 'tarteaucitron=' + cookie + '!' + key + '=' + status;
|
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) {
|
|
||||||
|
if (tarteaucitron.cookie.read().indexOf(key + '=' + status) === -1) {
|
||||||
tarteaucitron.pro('!' + key + '=' + status);
|
tarteaucitron.pro('!' + key + '=' + status);
|
||||||
}
|
}
|
||||||
|
|
||||||
d.setTime(expireTime);
|
d.setTime(expireTime);
|
||||||
document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;';
|
document.cookie = value + '; expires=' + d.toGMTString() + '; path=/;' + domain;
|
||||||
},
|
},
|
||||||
"read": function () {
|
"read": function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue