mirror of
https://codeberg.org/kirche-im-netz/Startodon-Hub.git
synced 2025-07-14 03:15:13 +02:00
Alles via kirche.social laden
Gleicher Anbieter (LUKi), daher kein Datenschutzpopup notwendig
This commit is contained in:
parent
47460e0104
commit
089183abd8
18 changed files with 55 additions and 235 deletions
|
@ -3,15 +3,8 @@ import { checkConsent, showConsentPopup, setUserConsent } from '../components/co
|
|||
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';
|
||||
const apiUrl = 'https://kirche.social/api/v1/timelines/tag/fedikirche?limit=20';
|
||||
|
||||
// Posts laden
|
||||
async function fetchPosts() {
|
||||
|
@ -106,54 +99,6 @@ export async function loadPostwall() {
|
|||
fetchPosts();
|
||||
}
|
||||
|
||||
// Alternative Kachel anzeigen, wenn kein Consent erteilt wurde
|
||||
function renderConsentRequest() {
|
||||
const container = document.getElementById('postswall-container');
|
||||
container.innerHTML = ''; // Vorherige Inhalte leeren
|
||||
|
||||
const consentCard = document.createElement('div');
|
||||
consentCard.classList.add('post'); // Verwendet die Post-Klasse für Konsistenz
|
||||
|
||||
consentCard.innerHTML = `
|
||||
<div class="post-header">
|
||||
<!-- Skeleton-Loader für Avatar -->
|
||||
<div class="skeleton avatar-skeleton"></div>
|
||||
|
||||
<!-- Skeleton-Loader für Autor und Username -->
|
||||
<div class="post-author">
|
||||
<div class="skeleton skeleton-text skeleton-text-name"></div>
|
||||
<div class="skeleton skeleton-text skeleton-text-username"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
<p>Du musst zuerst zustimmen, um Inhalte anzuzeigen.</p>
|
||||
<div class="consent-buttons">
|
||||
<button id="open-consent-popup" class="btn">Datenschutzeinstellungen öffnen</button>
|
||||
<a href="https://libori.social/tags/fedikirche" target="_blank" rel="noopener noreferrer">
|
||||
<button class="btn">Beiträge auf Mastodon ansehen</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
container.appendChild(consentCard);
|
||||
|
||||
// Event-Listener für Button zum erneuten Anzeigen des Consent-Popups
|
||||
document.getElementById('open-consent-popup').addEventListener('click', () => {
|
||||
showConsentPopup(
|
||||
() => {
|
||||
setUserConsent(true); // Zustimmung speichern
|
||||
loadPostwall(); // Nachträglich Posts laden
|
||||
},
|
||||
() => {
|
||||
setUserConsent(false); // Ablehnung speichern
|
||||
console.log('Consent abgelehnt');
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Zeitberechnung für Posts
|
||||
function getTimeAgo(date) {
|
||||
const now = new Date();
|
||||
|
@ -177,7 +122,7 @@ function getTimeAgo(date) {
|
|||
function addReadMoreButton() {
|
||||
const container = document.getElementById('postswall-container');
|
||||
const readMoreButton = document.createElement('a');
|
||||
readMoreButton.href = 'https://libori.social/tags/fedikirche';
|
||||
readMoreButton.href = 'https://kirche.social/tags/fedikirche';
|
||||
readMoreButton.target = '_blank';
|
||||
readMoreButton.rel = 'noopener noreferrer';
|
||||
readMoreButton.classList.add('read-more-button');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue