Message cookie
This commit is contained in:
parent
812ad68832
commit
cd73ac6996
@ -221,14 +221,18 @@ core.start = function() {
|
|||||||
/**
|
/**
|
||||||
* Message sur l'utilisation des cookies
|
* Message sur l'utilisation des cookies
|
||||||
*/
|
*/
|
||||||
|
var analytics = "";
|
||||||
|
if (<?php echo json_encode($this->getData(['config', 'analyticsId'])); ?>) {
|
||||||
|
analytics = ' grâce au cookie Google Analytics'
|
||||||
|
}
|
||||||
if(<?php echo json_encode($this->getData(['config', 'cookieConsent'])); ?>) {
|
if(<?php echo json_encode($this->getData(['config', 'cookieConsent'])); ?>) {
|
||||||
if(document.cookie.indexOf("ZWII_COOKIE_CONSENT") === -1) {
|
if(document.cookie.indexOf("ZWII_COOKIE_CONSENT") === -1) {
|
||||||
$("body").append(
|
$("body").append(
|
||||||
$("<div>").attr("id", "cookieConsent").append(
|
$("<div>").attr("id", "cookieConsent").append(
|
||||||
$("<span>").text("En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies et de vos données de visite."),
|
$("<span>").html("<p>Ce site utilise des cookies pour assurer l'authentification, améliorer l'expérience utilisateur"+analytics+". <br/>En cliquant sur ”J’accepte”, vous acceptez l’utilisation de ces cookies.</p>"),
|
||||||
$("<span>")
|
$("<span>")
|
||||||
.attr("id", "cookieConsentConfirm")
|
.attr("id", "cookieConsentConfirm")
|
||||||
.text("OK")
|
.text("Accepter")
|
||||||
.on("click", function() {
|
.on("click", function() {
|
||||||
// Créé le cookie d'acceptation
|
// Créé le cookie d'acceptation
|
||||||
var expires = new Date();
|
var expires = new Date();
|
||||||
@ -237,7 +241,19 @@ core.start = function() {
|
|||||||
document.cookie = "ZWII_COOKIE_CONSENT=true;" + expires;
|
document.cookie = "ZWII_COOKIE_CONSENT=true;" + expires;
|
||||||
// Ferme le message
|
// Ferme le message
|
||||||
$(this).parents("#cookieConsent").fadeOut();
|
$(this).parents("#cookieConsent").fadeOut();
|
||||||
})
|
}),
|
||||||
|
$("<span>")
|
||||||
|
.attr("id", "cookieConsentRefuse")
|
||||||
|
.text("Refuser")
|
||||||
|
.on("click", function() {
|
||||||
|
// Créé le cookie d'acceptation
|
||||||
|
var expires = new Date();
|
||||||
|
expires.setFullYear(expires.getFullYear() + 1);
|
||||||
|
expires = "expires=" + expires.toUTCString();
|
||||||
|
document.cookie = "ZWII_COOKIE_CONSENT=false;" + expires;
|
||||||
|
// Ferme le message
|
||||||
|
$(this).parents("#cookieConsent").fadeOut();
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2297,14 +2297,15 @@ class layout extends common {
|
|||||||
* Affiche le script Google Analytics
|
* Affiche le script Google Analytics
|
||||||
*/
|
*/
|
||||||
public function showAnalytics() {
|
public function showAnalytics() {
|
||||||
if($code = $this->getData(['config', 'analyticsId'])) {
|
if($code = $this->getData(['config', 'analyticsId'])
|
||||||
|
AND $this->getInput('ZWII_COOKIE_CONSENT') === 'true') {
|
||||||
echo '<!-- Global site tag (gtag.js) - Google Analytics -->
|
echo '<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id='. $code .'"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id='. $code .'"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag("js", new Date());
|
gtag("js", new Date());
|
||||||
gtag("config","'. $code .'");
|
gtag("config","'. $code .'");
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -984,20 +984,22 @@ footer #footerSocials .zwiico-github:hover {
|
|||||||
|
|
||||||
/* Message sur les cookies */
|
/* Message sur les cookies */
|
||||||
#cookieConsent {
|
#cookieConsent {
|
||||||
|
width: 80%;
|
||||||
|
margin: auto;
|
||||||
opacity: .9;
|
opacity: .9;
|
||||||
background: #212223;
|
background: #212223;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 5%;
|
||||||
left: 0;
|
left: 0;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
z-index: 60;
|
z-index: 60;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: .9em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cookieConsentConfirm {
|
#cookieConsentConfirm, #cookieConsentRefuse {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
background: #666;
|
background: #666;
|
||||||
@ -1006,10 +1008,12 @@ footer #footerSocials .zwiico-github:hover {
|
|||||||
transition: background .3s ease-out;
|
transition: background .3s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#cookieConsentConfirm:hover {
|
#cookieConsentConfirm:hover, #cookieConsentRefuse:hover {
|
||||||
background: #777;
|
background: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Bloc */
|
/* Bloc */
|
||||||
.block {
|
.block {
|
||||||
/* border: 1px solid #D8DFE3;*/
|
/* border: 1px solid #D8DFE3;*/
|
||||||
|
Loading…
Reference in New Issue
Block a user