Du musst zuerst zustimmen, um Inhalte anzuzeigen.
+ +diff --git a/src/components/postwall.js b/src/components/postwall.js index 62acb14..c5a6616 100644 --- a/src/components/postwall.js +++ b/src/components/postwall.js @@ -1,6 +1,15 @@ +import { checkConsent, showConsentPopup, setUserConsent } from '../components/consentManager.js'; + export async function loadPostwall() { const container = document.getElementById('postswall-container'); + // Überprüfe, ob Consent erteilt wurde + if (!checkConsent()) { + // Consent nicht erteilt – alternative Kachel anzeigen + renderConsentRequest(); + return; // Beende die Funktion, kein weiterer Datenabruf + } + // Mastodon API-URL für Hashtag-Suche const apiUrl = 'https://libori.social/api/v1/timelines/tag/fedikirche?limit=20'; @@ -30,44 +39,42 @@ export async function loadPostwall() { const postElement = document.createElement('a'); postElement.classList.add('post'); postElement.href = post.url; // Link zum Originalpost - postElement.target = '_blank'; // Link in neuem Tab öffnen - postElement.rel = 'noopener noreferrer'; // Sicherheit für externe Links - postElement.setAttribute('aria-label', 'Zum Originalpost auf Mastodon'); // Accessibility + postElement.target = '_blank'; + postElement.rel = 'noopener noreferrer'; + postElement.setAttribute('aria-label', 'Zum Originalpost auf Mastodon'); // Zeitstempel berechnen - const postDate = new Date(post.created_at); // Datum des Posts - const timeAgo = getTimeAgo(postDate); // Funktion zur Berechnung der Zeitspanne + const postDate = new Date(post.created_at); + const timeAgo = getTimeAgo(postDate); let content = post.content || 'Kein Inhalt verfügbar.'; const author = post.account.display_name || post.account.username; - const username = `@${post.account.acct}`; // Adresse hinzufügen (@nutzer@instanz) - const avatar = post.account.avatar || 'src/assets/default-avatar.png'; // Fallback-Bild + const username = `@${post.account.acct}`; + const avatar = post.account.avatar || 'src/assets/default-avatar.png'; - // Alle anderen Links deaktivieren + // Links deaktivieren const tempContainer = document.createElement('div'); tempContainer.innerHTML = content; - // Links deaktivieren const links = tempContainer.querySelectorAll('a'); links.forEach(link => { - link.removeAttribute('href'); // Entfernt den Link - link.style.pointerEvents = 'none'; // Deaktiviert Klickbarkeit - link.style.color = 'blue'; // Behält Linkfarbe bei - link.style.textDecoration = 'underline'; // Behält Unterstreichung bei + link.removeAttribute('href'); + link.style.pointerEvents = 'none'; + link.style.color = 'blue'; + link.style.textDecoration = 'underline'; }); // Bilder bearbeiten const images = tempContainer.querySelectorAll('img'); images.forEach(img => { - img.style.maxHeight = '200px'; // Maximale Höhe festlegen - img.style.width = 'auto'; // Automatische Breite für Proportionen - img.style.display = 'block'; // Sicherstellen, dass Bilder Blöcke sind - img.style.margin = '10px 0'; // Abstand zu Text einfügen + img.style.maxHeight = '200px'; + img.style.width = 'auto'; + img.style.display = 'block'; + img.style.margin = '10px 0'; }); content = tempContainer.innerHTML; - // Medien-Anhänge (Bilder, Videos, etc.) hinzufügen const mediaAttachments = post.media_attachments || []; let mediaHTML = ''; mediaAttachments.forEach(media => { @@ -78,7 +85,6 @@ export async function loadPostwall() { } }); - // Post zusammenbauen postElement.innerHTML = `
Du musst zuerst zustimmen, um Inhalte anzuzeigen.
+ +