mirror of
https://codeberg.org/kirche-im-netz/Startodon-Hub.git
synced 2025-08-28 13:58:14 +02:00
Merge pull request 'Consent Manager und css und alte popup-utils entfernen' (#8) from consent-entfernen into pages
Reviewed-on: https://codeberg.org/kirche-im-netz/Startodon-Hub/pulls/8
This commit is contained in:
commit
c65e791ea9
5 changed files with 0 additions and 172 deletions
|
@ -1,58 +0,0 @@
|
||||||
import { createPopup, closePopup } from './popupManager.js';
|
|
||||||
|
|
||||||
// Speichert die Benutzerzustimmung
|
|
||||||
export function setUserConsent(consent) {
|
|
||||||
localStorage.setItem('userConsent', JSON.stringify(consent));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ruft die Benutzerzustimmung ab
|
|
||||||
export function getUserConsent() {
|
|
||||||
const consent = localStorage.getItem('userConsent');
|
|
||||||
return consent !== null ? JSON.parse(consent) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Überprüft, ob bereits eine Zustimmung vorliegt
|
|
||||||
export function checkConsent() {
|
|
||||||
const consent = getUserConsent();
|
|
||||||
return consent === true; // Nur true wird akzeptiert
|
|
||||||
}
|
|
||||||
|
|
||||||
// Zeigt das Consent-Banner an
|
|
||||||
export function showConsentPopup(onAccept, onDecline) {
|
|
||||||
const title = 'Datenschutzeinstellungen';
|
|
||||||
const body = `
|
|
||||||
<p>Diese Seite ruft Informationen von verschiedenen Mastodon-Instanzen ab, um dir passende Inhalte zu präsentieren.
|
|
||||||
Wir können zwar nicht für die Datenschutzpraktiken jeder einzelnen Instanz garantieren, wissen aber, dass vielen im Fediverse der Schutz persönlicher Daten und Datenminimierung wichtig sind.
|
|
||||||
<p>
|
|
||||||
Mit einem Klick auf "Bestätigen" erlaubst du, dass diese Informationen abgefragt werden.
|
|
||||||
Deine Entscheidung wird lokal in deinem Browser gespeichert.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Weitere Informationen findest du in unseren
|
|
||||||
<a href="/rechtlicheHinweise.html" target="_blank">🛡️ Datenschutzhinweisen</a>.
|
|
||||||
</p>
|
|
||||||
<div class="consent-popup-buttons">
|
|
||||||
<button id="consent-decline">Ablehnen</button>
|
|
||||||
<button id="consent-accept">Bestätigen</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Erstelle das Popup
|
|
||||||
const popup = createPopup({
|
|
||||||
title,
|
|
||||||
body,
|
|
||||||
customClass: 'consent-popup'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Event-Listener für die Buttons
|
|
||||||
popup.querySelector('#consent-accept').addEventListener('click', () => {
|
|
||||||
setUserConsent(true); // Zustimmung speichern
|
|
||||||
closePopup(popup); // Popup schließen
|
|
||||||
window.location.reload(); // **Seite neuladen**
|
|
||||||
});
|
|
||||||
|
|
||||||
popup.querySelector('#consent-decline').addEventListener('click', () => {
|
|
||||||
setUserConsent(false); // Ablehnung speichern
|
|
||||||
closePopup(popup); // Popup schließen
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,5 +1,3 @@
|
||||||
import { checkConsent, showConsentPopup, setUserConsent } from '../components/consentManager.js';
|
|
||||||
|
|
||||||
export async function loadPostwall() {
|
export async function loadPostwall() {
|
||||||
const container = document.getElementById('postswall-container');
|
const container = document.getElementById('postswall-container');
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
export function openPopup(popupElement) {
|
|
||||||
// Füge einen neuen Eintrag zur Browser-Historie hinzu
|
|
||||||
history.pushState({ popupOpen: true }, null, '');
|
|
||||||
|
|
||||||
// Klasse hinzufügen, um das Scrollen zu deaktivieren
|
|
||||||
document.body.classList.add('body-no-scroll');
|
|
||||||
|
|
||||||
// Event-Listener für "Zurück"-Button
|
|
||||||
const onPopState = () => closePopup(popupElement, onPopState);
|
|
||||||
window.addEventListener('popstate', onPopState);
|
|
||||||
|
|
||||||
popupElement.dataset.onPopState = onPopState; // Speichere den Listener für spätere Entfernung
|
|
||||||
popupElement.classList.add('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function closePopup(popupElement, onPopState = null) {
|
|
||||||
// Popup ausblenden
|
|
||||||
popupElement.remove();
|
|
||||||
|
|
||||||
// Klasse zum Deaktivieren des Scrollens entfernen
|
|
||||||
document.body.classList.remove('body-no-scroll');
|
|
||||||
|
|
||||||
// Historie zurücksetzen
|
|
||||||
history.back();
|
|
||||||
|
|
||||||
// Entferne den `popstate`-Listener
|
|
||||||
if (onPopState) {
|
|
||||||
window.removeEventListener('popstate', onPopState);
|
|
||||||
} else if (popupElement.dataset.onPopState) {
|
|
||||||
window.removeEventListener('popstate', popupElement.dataset.onPopState);
|
|
||||||
delete popupElement.dataset.onPopState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function attachCloseHandlers(popupElement, closeButtonSelector) {
|
|
||||||
// Schließen-Button
|
|
||||||
const closeButton = popupElement.querySelector(closeButtonSelector);
|
|
||||||
if (closeButton) {
|
|
||||||
closeButton.addEventListener('click', () => closePopup(popupElement));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schließen bei Klick auf den Hintergrund
|
|
||||||
popupElement.addEventListener('click', (event) => {
|
|
||||||
if (event.target === popupElement) {
|
|
||||||
closePopup(popupElement);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
.consent-popup-content {
|
|
||||||
background-color: var(--background-color);
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 15px;
|
|
||||||
text-align: center;
|
|
||||||
width: 90%;
|
|
||||||
max-width: 500px;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-content h3 {
|
|
||||||
margin-bottom: 15px;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-content p {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-size: 1rem;
|
|
||||||
color: #fff;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-content a {
|
|
||||||
color: #007BFF;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-content a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.consent-popup-buttons button {
|
|
||||||
padding: 10px 15px;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 1rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consent-accept {
|
|
||||||
background: #28a745;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consent-accept:hover {
|
|
||||||
background: #218838;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consent-decline {
|
|
||||||
background: #dc3545;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
#consent-decline:hover {
|
|
||||||
background: #c82333;
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
@import "./base.css";
|
@import "./base.css";
|
||||||
@import "./site.css";
|
@import "./site.css";
|
||||||
@import "./consentPopup.css";
|
|
||||||
@import "./starterkit.css";
|
@import "./starterkit.css";
|
||||||
@import "./recommendationPopup.css";
|
@import "./recommendationPopup.css";
|
||||||
@import "./profile.css";
|
@import "./profile.css";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue