From ed1d0f19d5d866a6bef493f90de4e795c7281935 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 25 Nov 2021 13:44:11 +0100 Subject: [PATCH] commentaires de gestion des cookies --- core/core.js.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/core.js.php b/core/core.js.php index 170ae25a..0e7b98ea 100644 --- a/core/core.js.php +++ b/core/core.js.php @@ -223,6 +223,8 @@ core.start = function() { * Traitement du formulaire cookies */ $("#cookieForm").submit(function(event){ + + // Varables des cookies var samesite = "samesite=lax"; var getUrl = window.location; var domain = "domain=" + getUrl.host; @@ -232,14 +234,19 @@ core.start = function() { e.setFullYear(e.getFullYear() + 1); var expires = "expires=" + e.toUTCString(); - // Crée le cookie d'acceptation Google Analytics si nécessaire + // Crée le cookie d'acceptation Google Analytics si l'ID a été saisie var analytics = "getData(['config', 'seo', 'analyticsId']);?>"; if( analytics.length > 0){ - document.cookie = "ZWII_COOKIE_GA_CONSENT=" + $("#googleAnalytics").prop("checked") + "" +";" + domain + ";" + path + ";" + samesite + ";" + expires; + document.cookie = "ZWII_COOKIE_GA_CONSENT=" + $("#googleAnalytics").prop("checked") + "" +";" + domain + ";" + path + ";" + samesite + ";" + expires; } + + // Stocke lz cookie d'acceptation document.cookie = "ZWII_COOKIE_CONSENT=;" + domain + ";" + path + ";" + samesite + ";" + expires; }); + /** + * Fermeture de la popup des cookies + */ $("#cookieConsent .cookieClose").on("click", function() { $(this).parents("#cookieConsent").fadeOut(); });