Schwebenden Cookie-Schalter entfernen
This commit is contained in:
@@ -164,7 +164,6 @@ function app_analytics_body_html(): string
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<button type="button" class="analytics-consent-settings" id="analytics-consent-settings" data-analytics-settings hidden>Cookie-Einstellungen</button>
|
|
||||||
HTML
|
HTML
|
||||||
. "\n<script type=\"application/json\" id=\"analytics-configuration\">{$json}</script>\n"
|
. "\n<script type=\"application/json\" id=\"analytics-configuration\">{$json}</script>\n"
|
||||||
. '<script src="assets/js/privacy-settings.js" defer></script>' . "\n";
|
. '<script src="assets/js/privacy-settings.js" defer></script>' . "\n";
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
.analytics-consent[hidden],
|
.analytics-consent[hidden] {
|
||||||
.analytics-consent-settings[hidden] {
|
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +48,7 @@
|
|||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analytics-consent__actions button,
|
.analytics-consent__actions button {
|
||||||
.analytics-consent-settings {
|
|
||||||
appearance: none;
|
appearance: none;
|
||||||
background: #38761d;
|
background: #38761d;
|
||||||
border: solid 2px #38761d;
|
border: solid 2px #38761d;
|
||||||
@@ -69,8 +67,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analytics-consent__actions button:hover,
|
.analytics-consent__actions button:hover {
|
||||||
.analytics-consent-settings:hover {
|
|
||||||
background: #2f6418;
|
background: #2f6418;
|
||||||
border-color: #2f6418;
|
border-color: #2f6418;
|
||||||
}
|
}
|
||||||
@@ -86,23 +83,11 @@
|
|||||||
color: #244f13 !important;
|
color: #244f13 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.analytics-consent__actions button:focus-visible,
|
.analytics-consent__actions button:focus-visible {
|
||||||
.analytics-consent-settings:focus-visible {
|
|
||||||
outline: solid 3px #f0b429;
|
outline: solid 3px #f0b429;
|
||||||
outline-offset: 3px;
|
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 {
|
.footer-cookie-settings {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|||||||
@@ -3,10 +3,9 @@
|
|||||||
|
|
||||||
var configurationElement = document.getElementById('analytics-configuration');
|
var configurationElement = document.getElementById('analytics-configuration');
|
||||||
var banner = document.getElementById('analytics-consent');
|
var banner = document.getElementById('analytics-consent');
|
||||||
var floatingSettingsButton = document.getElementById('analytics-consent-settings');
|
|
||||||
var settingsButtons = document.querySelectorAll('[data-analytics-settings]');
|
var settingsButtons = document.querySelectorAll('[data-analytics-settings]');
|
||||||
|
|
||||||
if (!configurationElement || !banner || !floatingSettingsButton) {
|
if (!configurationElement || !banner) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +148,6 @@
|
|||||||
|
|
||||||
function closeBanner() {
|
function closeBanner() {
|
||||||
banner.hidden = true;
|
banner.hidden = true;
|
||||||
floatingSettingsButton.hidden = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function choose(decision) {
|
function choose(decision) {
|
||||||
@@ -174,7 +172,6 @@
|
|||||||
settingsButtons.forEach(function (button) {
|
settingsButtons.forEach(function (button) {
|
||||||
button.addEventListener('click', function () {
|
button.addEventListener('click', function () {
|
||||||
banner.hidden = false;
|
banner.hidden = false;
|
||||||
floatingSettingsButton.hidden = true;
|
|
||||||
var firstButton = banner.querySelector('[data-analytics-consent="denied"]');
|
var firstButton = banner.querySelector('[data-analytics-consent="denied"]');
|
||||||
if (firstButton) {
|
if (firstButton) {
|
||||||
firstButton.focus();
|
firstButton.focus();
|
||||||
@@ -184,10 +181,8 @@
|
|||||||
|
|
||||||
var initialDecision = readDecision();
|
var initialDecision = readDecision();
|
||||||
if (initialDecision === 'granted') {
|
if (initialDecision === 'granted') {
|
||||||
floatingSettingsButton.hidden = false;
|
|
||||||
sendPageView();
|
sendPageView();
|
||||||
} else if (initialDecision === 'denied') {
|
} else if (initialDecision === 'denied') {
|
||||||
floatingSettingsButton.hidden = false;
|
|
||||||
removeAnalysisCookies();
|
removeAnalysisCookies();
|
||||||
} else {
|
} else {
|
||||||
banner.hidden = false;
|
banner.hidden = false;
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ $assert('Nur notwendige Cookies ist innen weiß gestaltet',
|
|||||||
$assert('Matomo selbst ist im HTML nicht vorab eingebunden',
|
$assert('Matomo selbst ist im HTML nicht vorab eingebunden',
|
||||||
!str_contains($body, 'https://analytics.example.test')
|
!str_contains($body, 'https://analytics.example.test')
|
||||||
&& !str_contains($body, '"siteId"'));
|
&& !str_contains($body, '"siteId"'));
|
||||||
$assert('Cookie-Einstellungen bleiben nach der Entscheidung erreichbar',
|
$assert('Kein schwebender Cookie-Schalter wird mehr ausgegeben',
|
||||||
str_contains($body, 'analytics-consent-settings'));
|
!str_contains($body, 'analytics-consent-settings'));
|
||||||
$assert('Footer-Schalter wird bei aktiver Analyse ausgegeben',
|
$assert('Footer-Schalter wird bei aktiver Analyse ausgegeben',
|
||||||
str_contains(app_analytics_footer_settings_button_html(), 'data-analytics-settings')
|
str_contains(app_analytics_footer_settings_button_html(), 'data-analytics-settings')
|
||||||
&& str_contains(app_public_legal_footer(), 'Cookie-Einstellungen'));
|
&& str_contains(app_public_legal_footer(), 'Cookie-Einstellungen'));
|
||||||
|
|||||||
Reference in New Issue
Block a user