Schwebenden Cookie-Schalter entfernen

This commit is contained in:
2026-08-27 13:34:45 +02:00
parent 2179744ddf
commit 70770236eb
4 changed files with 7 additions and 28 deletions
-1
View File
@@ -164,7 +164,6 @@ function app_analytics_body_html(): string
</div>
</div>
</section>
<button type="button" class="analytics-consent-settings" id="analytics-consent-settings" data-analytics-settings hidden>Cookie-Einstellungen</button>
HTML
. "\n<script type=\"application/json\" id=\"analytics-configuration\">{$json}</script>\n"
. '<script src="assets/js/privacy-settings.js" defer></script>' . "\n";
+4 -19
View File
@@ -1,5 +1,4 @@
.analytics-consent[hidden],
.analytics-consent-settings[hidden] {
.analytics-consent[hidden] {
display: none !important;
}
@@ -49,8 +48,7 @@
gap: 0.75rem;
}
.analytics-consent__actions button,
.analytics-consent-settings {
.analytics-consent__actions button {
appearance: none;
background: #38761d;
border: solid 2px #38761d;
@@ -69,8 +67,7 @@
white-space: nowrap;
}
.analytics-consent__actions button:hover,
.analytics-consent-settings:hover {
.analytics-consent__actions button:hover {
background: #2f6418;
border-color: #2f6418;
}
@@ -86,23 +83,11 @@
color: #244f13 !important;
}
.analytics-consent__actions button:focus-visible,
.analytics-consent-settings:focus-visible {
.analytics-consent__actions button:focus-visible {
outline: solid 3px #f0b429;
outline-offset: 3px;
}
.analytics-consent-settings {
position: fixed;
bottom: 0.75rem;
left: 0.75rem;
z-index: 9999;
background: #ffffff;
color: #2f6418 !important;
font-size: 0.75rem;
padding: 0.55rem 0.7rem;
}
.footer-cookie-settings {
appearance: none;
background: transparent;
+1 -6
View File
@@ -3,10 +3,9 @@
var configurationElement = document.getElementById('analytics-configuration');
var banner = document.getElementById('analytics-consent');
var floatingSettingsButton = document.getElementById('analytics-consent-settings');
var settingsButtons = document.querySelectorAll('[data-analytics-settings]');
if (!configurationElement || !banner || !floatingSettingsButton) {
if (!configurationElement || !banner) {
return;
}
@@ -149,7 +148,6 @@
function closeBanner() {
banner.hidden = true;
floatingSettingsButton.hidden = false;
}
function choose(decision) {
@@ -174,7 +172,6 @@
settingsButtons.forEach(function (button) {
button.addEventListener('click', function () {
banner.hidden = false;
floatingSettingsButton.hidden = true;
var firstButton = banner.querySelector('[data-analytics-consent="denied"]');
if (firstButton) {
firstButton.focus();
@@ -184,10 +181,8 @@
var initialDecision = readDecision();
if (initialDecision === 'granted') {
floatingSettingsButton.hidden = false;
sendPageView();
} else if (initialDecision === 'denied') {
floatingSettingsButton.hidden = false;
removeAnalysisCookies();
} else {
banner.hidden = false;
+2 -2
View File
@@ -72,8 +72,8 @@ $assert('Nur notwendige Cookies ist innen weiß gestaltet',
$assert('Matomo selbst ist im HTML nicht vorab eingebunden',
!str_contains($body, 'https://analytics.example.test')
&& !str_contains($body, '"siteId"'));
$assert('Cookie-Einstellungen bleiben nach der Entscheidung erreichbar',
str_contains($body, 'analytics-consent-settings'));
$assert('Kein schwebender Cookie-Schalter wird mehr ausgegeben',
!str_contains($body, 'analytics-consent-settings'));
$assert('Footer-Schalter wird bei aktiver Analyse ausgegeben',
str_contains(app_analytics_footer_settings_button_html(), 'data-analytics-settings')
&& str_contains(app_public_legal_footer(), 'Cookie-Einstellungen'));