41 lines
1.8 KiB
Plaintext
41 lines
1.8 KiB
Plaintext
@using Microsoft.AspNetCore.Http.Features
|
|
|
|
@{
|
|
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
|
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
|
|
var showBanner = !consentFeature?.CanTrack ?? false;
|
|
var cookieString = consentFeature?.CreateConsentCookie();
|
|
}
|
|
|
|
@if (showBanner)
|
|
{
|
|
<div class="modal fade" id="cookieConsent" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h1 class="modal-title fs-5" id="staticBackdropLabel">Datenschutzhinweis</h1>
|
|
</div>
|
|
<div class="modal-body">
|
|
Wir verwenden technisch notwendige Session Cookies. Diese Cookies sind für den ordnungsgemäßen Betrieb dieser Webseite von nöten und können aus diesm Grund nicht abgewählt werden. Es findet keine Übermittlung an Dritte statt.
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary accept-policy close" data-bs-dismiss="modal" data-cookie-string="@cookieString"><span aria-hidden="true">Accept</span></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script nonce="@nonce">
|
|
window.onload = function () {
|
|
var modal = new bootstrap.Modal(document.getElementById('cookieConsent'));
|
|
modal.show();
|
|
};
|
|
|
|
(function () {
|
|
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
|
|
button.addEventListener("click", function (event) {
|
|
document.cookie = button.dataset.cookieString;
|
|
}, false);
|
|
})();
|
|
</script>
|
|
} |