setto.basspistol.com/_includes/_cookie-consent.html

60 lines
2 KiB
HTML
Raw Permalink Normal View History

2020-07-24 14:34:09 +02:00
<div id="cookie-notice">
2020-08-03 21:40:11 +02:00
2020-09-11 19:02:26 +02:00
<p>
2021-06-24 09:01:08 +02:00
I only use cookies if you consent to it, or if you give me your nickname so I can remember you next time you come by.
<br />These cookies are all placed by my crew: Basspistol. No big tech involved.
2020-09-11 19:02:26 +02:00
<br />Read more about <a href="/cookies/"> how {{ site.title }} use cookies</a>
2020-08-03 21:40:11 +02:00
</p>
2021-06-24 09:01:08 +02:00
<button class="button no" id="cookie-notice-decline">
Nah
</button>
<button class="button yes" id="cookie-notice-accept">
Ok
</button>
2020-08-03 21:40:11 +02:00
2020-07-24 14:34:09 +02:00
</div>
<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 + "; domain=.{{ site.publisher.domain }}" + expires + "; path=/;SameSite=Strict";
2020-07-24 14:34:09 +02:00
}
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') == 'wantCookies') {
2021-10-12 13:40:00 +02:00
2021-10-12 13:47:30 +02:00
{% include mautic - tracker.js %}
2020-07-24 14:34:09 +02:00
} else {
document.getElementById('cookie-notice').style.display = 'flex';
}
if (readCookie('cookie-notice-dismissed') == 'dontWantCookies') {
document.getElementById('cookie-notice').style.display = 'none';
}
document.getElementById('cookie-notice-accept').addEventListener("click", function () {
createCookie('cookie-notice-dismissed', 'wantCookies', 365);
2020-07-24 14:34:09 +02:00
document.getElementById('cookie-notice').style.display = 'none';
});
document.getElementById('cookie-notice-decline').addEventListener("click", function () {
createCookie('cookie-notice-dismissed', 'dontWantCookies', 365);
2020-07-24 14:34:09 +02:00
document.getElementById('cookie-notice').style.display = 'none';
});
</script>