Remove remnants of hugo_cookie_consent.

This commit is contained in:
2026-06-16 17:14:18 +02:00
parent b784459d87
commit 9ae1e6e82c
16 changed files with 15 additions and 166 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2026 daniel Copyright (c) 2026 Daniel Kraus <bovender@bovender.de>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including associated documentation files (the "Software"), to deal in the Software without restriction, including
-43
View File
@@ -1,43 +0,0 @@
(function () {
var KEY = 'cookie_consent';
var banner = document.getElementById('cookie-banner');
if (!banner) return;
updateStatus();
var consent = localStorage.getItem(KEY);
if (!consent) banner.style.display = 'flex';
function dismiss() {
banner.classList.add('fade-out');
setTimeout(function () { banner.style.display = 'none'; }, 500);
}
function updateStatus() {
var el = document.getElementById('cookie-status');
if (!el) return;
var consent = localStorage.getItem(KEY);
el.textContent = consent === 'accepted' ? 'Cookie akzeptiert'
: consent === 'declined' ? 'Cookie abgelehnt'
: 'Nicht entschieden';
}
document.getElementById('cookie-accept').onclick = function () {
localStorage.setItem(KEY, 'accepted');
updateStatus();
dismiss();
window.dispatchEvent(new Event('cookieAccepted'));
};
document.getElementById('cookie-decline').onclick = function () {
localStorage.setItem(KEY, 'declined');
updateStatus();
dismiss();
};
window.reopenCookieBanner = function () {
localStorage.removeItem(KEY);
updateStatus();
banner.classList.remove('fade-out');
banner.style.display = 'flex';
};
})();
-38
View File
@@ -1,38 +0,0 @@
#cookie-banner {
position: fixed;
top: 2.5rem;
left: 50%;
transform: translateX(-50%);
width: min(480px, calc(100vw - 2rem));
background: #fff;
border: 1px solid #e2e2e2;
border-radius: 12px;
padding: 1rem 1.25rem;
box-shadow: 0 4px 24px rgba(0,0,0,.08);
display: flex;
align-items: center;
gap: 1rem;
z-index: 9999;
transition: opacity 0.5s ease;
}
#cookie-banner.fade-out {
opacity: 0;
pointer-events: none;
}
#cookie-banner p { margin: 0; font-size: 14px; flex: 1; }
#cookie-banner button {
padding: .45rem 1rem;
border-radius: 8px;
border: 1px solid #ccc;
cursor: pointer;
font-size: 13px;
white-space: nowrap;
}
#cookie-accept {
background: #0b913a; color: #fff; border-color: #1a1a1a;
}
@@ -1,6 +1,4 @@
// ============================================ @import "bootstrap/bootstrap";
// Custom Site Styles
// ============================================
:root { :root {
--bs-primary: #004a6f; --bs-primary: #004a6f;
+4 -7
View File
@@ -1,7 +1,4 @@
// Import the entire Bootstrap bundle in the correct order // To include custom styles and stylesheets, create a file
@import "bootstrap/bootstrap"; // assets/scss/main.scss with the contents of this file and
// add your imports or styles as needed.
// Custom site styles @import "hugo_bootstrap_theme";
@import "custom";
@import "termine";
@import "cookie-consent";
-20
View File
@@ -1,20 +0,0 @@
.event-details {
ul {
padding: 0;
}
li {
font-weight:normal;
background-color: var(--bs-light);
display: block;
padding: 0.5rem 1rem;
margin-bottom: 0.5rem;
}
li span {
display: block;
color: var(--bs-dark);
font-size: 75%;
font-weight: bold;
letter-spacing: 0.1rem;
text-transform: uppercase;
}
}
+1
View File
@@ -0,0 +1 @@
<!-- Create a file like this in layouts/_partials and define extra tags for the HTML BODY. -->
-11
View File
@@ -1,11 +0,0 @@
{{ if not (isset .Site.Params "cookieConsentDisabled") }}
<div id="cookie-banner" style="display:none" role="dialog"
aria-label="Cookie consent" aria-live="polite">
<p>Diese Website möchte ein Cookie speichern.
<a href="{{ .Site.Params.privacyPolicyURL }}">Mehr darüber.</a></p>
<div>
<button id="cookie-accept">Akzeptieren</button>
<button id="cookie-decline">Ablehnen</button>
</div>
</div>
{{ end }}
+1
View File
@@ -0,0 +1 @@
<!-- Create a file like this in layouts/_partials and define extra tags for the HTML HEAD. -->
+1 -2
View File
@@ -1,9 +1,8 @@
{{ printf "<!-- %s -->" hugo.Environment | safeHTML }}
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ .Page.Params.description }}"> <meta name="description" content="{{ .Page.Params.description }}">
<meta name="author" content="{{ .Site.Params.author }}"> <meta name="author" content="{{ .Site.Params.author }}">
<link rel="me" href="https://neph.social/@nierenverein"> <meta name="generator" content="{{ hugo.Environment }}">
<link rel="icon" type="image/png" href="/img/favicon.png"> <link rel="icon" type="image/png" href="/img/favicon.png">
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title> <title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ .Title }} - {{ .Site.Title }}{{ end }}</title>
+1
View File
@@ -0,0 +1 @@
<!-- Create a file like this in layouts/_partials to include additional javascript. -->
+1 -31
View File
@@ -1,6 +1,3 @@
{{- $js := resources.Get "js/cookie-consent.js" | minify -}}
<script src="{{ $js.RelPermalink }}" defer></script>
<!-- Bootstrap Bundle JS (includes Popper.js) --> <!-- Bootstrap Bundle JS (includes Popper.js) -->
{{ $bs := resources.Get "js/bootstrap.bundle.min.js" | fingerprint "sha512" }} {{ $bs := resources.Get "js/bootstrap.bundle.min.js" | fingerprint "sha512" }}
{{ if $bs }} {{ if $bs }}
@@ -14,31 +11,4 @@
<script src="{{ $custom.RelPermalink }}" integrity="{{ $custom.Data.Integrity }}" crossorigin="anonymous"></script> <script src="{{ $custom.RelPermalink }}" integrity="{{ $custom.Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }} {{ end }}
{{ if eq hugo.Environment "production" }} {{ partial "scripts_extra.html "}}
<!-- Matomo -->
<script>
// Path 1: user just clicked Accept (event fires this session)
window.addEventListener('cookieAccepted', loadMatomo);
// Path 2: user already consented in a previous visit
if (localStorage.getItem('cookie_consent') === 'accepted') {
loadMatomo();
}
function loadMatomo() {
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.bovender.de/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '9']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
}
</script>
<!-- End Matomo Code -->
{{ end }}
-6
View File
@@ -1,6 +0,0 @@
<p>
Aktuelle Cookie-Einstellung: <strong id="cookie-status">&mdash;</strong>
</p>
<button id="cookie-settings" onclick="reopenCookieBanner()" class="btn btn-secondary mb-3">
Cookie-Einstellung ändern
</button>
+2 -2
View File
@@ -2,16 +2,16 @@
<html lang="{{ .Site.Language.Locale }}"> <html lang="{{ .Site.Language.Locale }}">
<head> <head>
{{- partial "meta.html" . -}} {{- partial "meta.html" . -}}
{{- partial "head_extra.html" . -}}
</head> </head>
<body> <body>
{{- partial "cookie-consent.html" . -}}
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
<main role="main" class="container-fluid"> <main role="main" class="container-fluid">
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
</main> </main>
{{- partial "body_extra.html" . -}}
{{- partial "footer.html" . -}} {{- partial "footer.html" . -}}
{{- partial "scripts.html" . -}} {{- partial "scripts.html" . -}}
</body> </body>