Datenschutz: Cookie-Banner, Zwei-Klick-YouTube, Impressum, Datenschutzerklärung
- Cookie-Banner (gd, gd2) mit den Kategorien Notwendig und Externe Medien (YouTube); Auswahl im Cookie gd_consent (6 Monate), Widerruf über den Footer - YouTube: Platzhalter mit "Video laden", die API wird erst nach Einwilligung geladen; Player über youtube-nocookie.com - Bootstrap, Bootstrap Icons, Chart.js und Montserrat lokal unter assets/vendor statt jsDelivr/Google Fonts (gd, gd2, intern) - Seiten /gd/impressum/ und /gd/datenschutz/, Angaben aus .env (IMPRESSUM_*) - Befehl ip_bereinigen: löscht Melde-IPs nach 30 Tagen, Zähler bleibt - 6 neue Tests (34 insgesamt), Changelog aktualisiert Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b2051fda3
commit
b27dce0bc7
29 files changed
+650
-19
No files matched your search
@@ -0,0 +1,94 @@
|
||||
/* Cookie-Banner: eigenständig, damit er in gd und gd2 gleich aussieht */
|
||||
.gd-consent {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 2000;
|
||||
padding: 16px;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
}
|
||||
.gd-consent[hidden] { display: none; }
|
||||
|
||||
.gd-consent__box {
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 24px;
|
||||
background: #fff;
|
||||
color: #212529;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.gd-consent__box h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
.gd-consent__box p { margin: 0 0 12px; }
|
||||
.gd-consent__box a { color: #0d6efd; }
|
||||
|
||||
.gd-consent__details { display: none; margin-bottom: 12px; }
|
||||
.gd-consent--details .gd-consent__details { display: block; }
|
||||
|
||||
.gd-consent__option {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: flex-start;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid #dee2e6;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.gd-consent__option input { margin-top: 4px; flex-shrink: 0; }
|
||||
.gd-consent__option small { display: block; color: #6c757d; }
|
||||
|
||||
.gd-consent__buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
/* "Nur notwendige" und "Alle akzeptieren" bewusst gleich auffällig (keine Lenkung) */
|
||||
.gd-consent__buttons button {
|
||||
flex: 1 1 auto;
|
||||
padding: 8px 14px;
|
||||
border: 2px solid #2c3e50;
|
||||
border-radius: 6px;
|
||||
background: #2c3e50;
|
||||
color: #fff;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.gd-consent__buttons button.gd-consent__link {
|
||||
background: transparent;
|
||||
color: #2c3e50;
|
||||
}
|
||||
.gd-consent__buttons button:focus-visible { outline: 3px solid #f39c12; outline-offset: 2px; }
|
||||
|
||||
.gd-consent__save { display: none; }
|
||||
.gd-consent--details .gd-consent__save { display: inline-block; }
|
||||
.gd-consent--details .gd-consent__show-details { display: none; }
|
||||
|
||||
/* Platzhalter für YouTube vor der Einwilligung (Zwei-Klick-Lösung) */
|
||||
.yt-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
background: #1c1c1c;
|
||||
color: #e9ecef;
|
||||
text-align: center;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.yt-placeholder .bi-youtube { font-size: 2rem; color: #ff0000; }
|
||||
.yt-placeholder a { color: #9ec5fe; }
|
||||
.yt-placeholder label { cursor: pointer; }
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Cookie-Einwilligung für das Genial-Daneben-Archiv.
|
||||
*
|
||||
* Kategorien:
|
||||
* notwendig immer aktiv (Sitzung, CSRF, diese Auswahl, Meldeschutz, Lautstärke)
|
||||
* youtube externe Medien, nur mit Einwilligung
|
||||
*
|
||||
* Die Auswahl liegt im Cookie "gd_consent" (6 Monate). Seiten fragen sie über
|
||||
* window.gdConsent.has('youtube') ab und hören auf das Ereignis "gd:consent".
|
||||
* Links mit dem Attribut data-consent-open öffnen die Einstellungen erneut.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var COOKIE_NAME = 'gd_consent';
|
||||
// Bei neuen Kategorien erhöhen, dann wird die Einwilligung neu abgefragt
|
||||
var VERSION = 1;
|
||||
var MAX_AGE = 60 * 60 * 24 * 180;
|
||||
|
||||
var banner = null;
|
||||
|
||||
function read() {
|
||||
var match = document.cookie.match(/(?:^|;\s*)gd_consent=([^;]*)/);
|
||||
if (!match) return null;
|
||||
try {
|
||||
var data = JSON.parse(decodeURIComponent(match[1]));
|
||||
return data && data.v === VERSION ? data : null;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function write(choices) {
|
||||
var data = { v: VERSION, youtube: !!choices.youtube, ts: new Date().toISOString() };
|
||||
document.cookie = COOKIE_NAME + '=' + encodeURIComponent(JSON.stringify(data)) +
|
||||
'; Max-Age=' + MAX_AGE + '; Path=/; SameSite=Lax' +
|
||||
(location.protocol === 'https:' ? '; Secure' : '');
|
||||
return data;
|
||||
}
|
||||
|
||||
function has(category) {
|
||||
var data = read();
|
||||
return !!(data && data[category]);
|
||||
}
|
||||
|
||||
function open(withDetails) {
|
||||
if (!banner) return;
|
||||
document.getElementById('gd-consent-youtube').checked = has('youtube');
|
||||
banner.classList.toggle('gd-consent--details', !!withDetails);
|
||||
banner.hidden = false;
|
||||
banner.querySelector('button').focus();
|
||||
}
|
||||
|
||||
function save(choices) {
|
||||
var hadYoutube = has('youtube');
|
||||
var data = write(choices);
|
||||
if (banner) banner.hidden = true;
|
||||
|
||||
// Widerruf: ein bereits geladener Player lässt sich nur durch Neuladen entfernen
|
||||
if (hadYoutube && !data.youtube) {
|
||||
location.reload();
|
||||
return;
|
||||
}
|
||||
document.dispatchEvent(new CustomEvent('gd:consent', { detail: data }));
|
||||
}
|
||||
|
||||
window.gdConsent = { has: has, save: save, open: open };
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
banner = document.getElementById('gd-consent');
|
||||
if (!banner) return;
|
||||
|
||||
banner.addEventListener('click', function (event) {
|
||||
var button = event.target.closest('[data-consent]');
|
||||
if (!button) return;
|
||||
var action = button.getAttribute('data-consent');
|
||||
|
||||
if (action === 'all') save({ youtube: true });
|
||||
else if (action === 'necessary') save({ youtube: false });
|
||||
else if (action === 'save') save({ youtube: document.getElementById('gd-consent-youtube').checked });
|
||||
else if (action === 'details') banner.classList.add('gd-consent--details');
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-consent-open]').forEach(function (link) {
|
||||
link.addEventListener('click', function (event) {
|
||||
event.preventDefault();
|
||||
open(true);
|
||||
});
|
||||
});
|
||||
|
||||
if (!read()) open(false);
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user