Datenschutzeinstellungen-Hinweis neu erstellt (noch funktionslos)

This commit is contained in:
Alexander Müller 2024-12-29 12:20:30 +01:00
parent e85e4d9742
commit 5a76a237bf
3 changed files with 65 additions and 48 deletions

View file

@ -2,21 +2,28 @@ import { createStarterKitElement, enhanceStarterKits } from './utils/starterkit-
import { seededShuffleChildren } from './utils/shuffle-utils.js';
import { initializeCreateStarterKitPopup } from './utils/create-starterkit.js';
import { loadPostwall } from './components/postwall.js';
let userConsent = null;
export { userConsent };
async function loadTemplates() {
const response = await fetch('src/template/template.html');
const templateHTML = await response.text();
const templateContainer = document.createElement('div');
templateContainer.innerHTML = templateHTML;
document.body.appendChild(templateContainer);
}
import { checkConsent, setUserConsent, showConsentPopup } from './utils/consent-utils.js';
document.addEventListener('DOMContentLoaded', async function () {
// Überprüfe Consent, bevor Inhalte geladen werden
const consent = checkConsent();
if (!consent) {
showConsentPopup(
() => {
setUserConsent(true);
initializeApp();
},
() => {
setUserConsent(false);
initializeApp();
}
);
} else {
initializeApp();
}
});
async function initializeApp() {
await loadTemplates();
initializeCreateStarterKitPopup();
@ -50,4 +57,13 @@ document.addEventListener('DOMContentLoaded', async function () {
enhanceStarterKits();
})
.catch(error => console.error('Fehler beim Laden der StarterKits:', error));
});
}
async function loadTemplates() {
const response = await fetch('src/template/template.html');
const templateHTML = await response.text();
const templateContainer = document.createElement('div');
templateContainer.innerHTML = templateHTML;
document.body.appendChild(templateContainer);
}