website/_includes/cookie-consent.html

56 lines
2.5 KiB
HTML
Raw Normal View History

2020-02-15 21:45:27 +01:00
<style>
#cookie-notice {padding: 0.5rem 1rem; display: none; text-align: center; position: fixed; bottom: 0; width: calc(100% - 2rem); background: #222; color: rgba(255,255,255,0.8);}
#cookie-notice a {display: inline-block; cursor: pointer; margin-left: 0.5rem;}
@media (max-width: 767px) {
#cookie-notice span {display: block; padding-top: 3px; margin-bottom: 1rem;}
#cookie-notice a {position: relative; bottom: 4px;}
}
</style>
2021-08-23 11:07:05 +02:00
<div id="cookie-notice"><span>Utilizziamo Matomo (una tecnologia libera) per analizzare e migliorare il servizio che offriamo.</span><a id="cookie-notice-accept" class="btn btn-primary btn-sm text-white">Approva</a><a href="https://matomo.org/gdpr/" rel="nofollow" target="_blank" class="btn btn-primary btn-sm text-white">Scopri di più</a><a id="cookie-notice-dismiss" class="mt-1 float-right text-decoration-none border border-secondary rounded btn btn-sm btn-secondary text-white">X</a></div>
2020-02-15 21:45:27 +01:00
<script>
function createCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
if(readCookie('cookie-notice-dismissed')=='true') {
2021-08-23 11:07:05 +02:00
console.log("GDPR Consent Missing");
2020-02-15 21:45:27 +01:00
} else {
document.getElementById('cookie-notice').style.display = 'block';
}
document.getElementById('cookie-notice-accept').addEventListener("click",function() {
createCookie('cookie-notice-dismissed','true',31);
_paq.push(['rememberConsentGiven']);
document.getElementById('cookie-notice').style.display = 'none';
location.reload();
});
2020-02-16 15:29:10 +01:00
document.getElementById('cookie-notice-dismiss').addEventListener("click",function() {
createCookie('cookie-notice-dismissed','true',31);
_paq.push(['forgetConsentGiven']);
_paq.push(['optUserOut']);
document.getElementById('cookie-notice').style.display = 'none';
location.reload();
});
2020-02-15 21:45:27 +01:00
</script>