fix: Restore all files lost during destructive rebase
A previous `git pull --rebase origin main` dropped 177 local commits,
losing 3400+ files across admin-v2, backend, studio-v2, website,
klausur-service, and many other services. The partial restore attempt
(660295e2) only recovered some files.
This commit restores all missing files from pre-rebase ref 98933f5e
while preserving post-rebase additions (night-scheduler, night-mode UI,
NightModeWidget dashboard integration).
Restored features include:
- AI Module Sidebar (FAB), OCR Labeling, OCR Compare
- GPU Dashboard, RAG Pipeline, Magic Help
- Klausur-Korrektur (8 files), Abitur-Archiv (5+ files)
- Companion, Zeugnisse-Crawler, Screen Flow
- Full backend, studio-v2, website, klausur-service
- All compliance SDKs, agent-core, voice-service
- CI/CD configs, documentation, scripts
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
390
h5p-service/editors/course-presentation-editor.html
Normal file
390
h5p-service/editors/course-presentation-editor.html
Normal file
@@ -0,0 +1,390 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Course Presentation Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], input[type="url"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, input[type="url"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 120px;
|
||||
}
|
||||
.slides-section {
|
||||
background: #f9fafb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.slide-card {
|
||||
background: white;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.slide-card:hover {
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
|
||||
}
|
||||
.slide-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.slide-number {
|
||||
font-weight: 700;
|
||||
color: #667eea;
|
||||
font-size: 18px;
|
||||
}
|
||||
.slide-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
.color-picker-wrapper {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
input[type="color"] {
|
||||
width: 60px;
|
||||
height: 40px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-sm {
|
||||
padding: 6px 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-slide-btn {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.add-slide-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
.hint {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
margin-top: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>📊</span>
|
||||
Course Presentation Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Präsentation erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3 style="color: #1e40af; margin-bottom: 8px; font-size: 14px;">💡 Wie funktioniert Course Presentation?</h3>
|
||||
<p style="color: #475569; font-size: 14px; line-height: 1.6;">
|
||||
Erstelle eine interaktive Präsentation mit mehreren Folien. Jede Folie kann Titel, Text und Bilder enthalten.
|
||||
Ideal für Kurse, Tutorials und Lernmaterialien.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel der Präsentation</label>
|
||||
<input type="text" id="title" placeholder="z.B. Einführung in die Programmierung">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung (optional)</label>
|
||||
<textarea id="description" placeholder="Kurze Beschreibung der Präsentation..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="slides-section">
|
||||
<h3 style="margin-bottom: 16px; color: #374151;">📄 Folien</h3>
|
||||
<div id="slidesContainer"></div>
|
||||
<button class="add-slide-btn" onclick="addSlide()">+ Neue Folie hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="savePresentation()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewPresentation()">📊 Vorschau</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let slides = [];
|
||||
|
||||
function addSlide() {
|
||||
const slideId = Date.now();
|
||||
slides.push({
|
||||
id: slideId,
|
||||
title: '',
|
||||
content: '',
|
||||
imageUrl: '',
|
||||
backgroundColor: '#ffffff'
|
||||
});
|
||||
renderSlides();
|
||||
}
|
||||
|
||||
function removeSlide(slideId) {
|
||||
if (slides.length <= 1) {
|
||||
alert('Du musst mindestens eine Folie haben!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (confirm('Folie wirklich löschen?')) {
|
||||
slides = slides.filter(s => s.id !== slideId);
|
||||
renderSlides();
|
||||
}
|
||||
}
|
||||
|
||||
function moveSlide(slideId, direction) {
|
||||
const index = slides.findIndex(s => s.id === slideId);
|
||||
if (index === -1) return;
|
||||
|
||||
const newIndex = direction === 'up' ? index - 1 : index + 1;
|
||||
if (newIndex < 0 || newIndex >= slides.length) return;
|
||||
|
||||
// Swap slides
|
||||
[slides[index], slides[newIndex]] = [slides[newIndex], slides[index]];
|
||||
renderSlides();
|
||||
}
|
||||
|
||||
function updateSlide(slideId, field, value) {
|
||||
const slide = slides.find(s => s.id === slideId);
|
||||
if (slide) {
|
||||
slide[field] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderSlides() {
|
||||
const container = document.getElementById('slidesContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
slides.forEach((slide, index) => {
|
||||
const slideEl = document.createElement('div');
|
||||
slideEl.className = 'slide-card';
|
||||
slideEl.innerHTML = `
|
||||
<div class="slide-header">
|
||||
<span class="slide-number">📄 Folie ${index + 1}</span>
|
||||
<div class="slide-actions">
|
||||
${index > 0 ? `<button class="btn btn-secondary btn-sm" onclick="moveSlide(${slide.id}, 'up')">↑</button>` : ''}
|
||||
${index < slides.length - 1 ? `<button class="btn btn-secondary btn-sm" onclick="moveSlide(${slide.id}, 'down')">↓</button>` : ''}
|
||||
<button class="btn btn-danger btn-sm" onclick="removeSlide(${slide.id})">🗑️</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Titel der Folie</label>
|
||||
<input type="text"
|
||||
value="${slide.title}"
|
||||
onchange="updateSlide(${slide.id}, 'title', this.value)"
|
||||
placeholder="z.B. Einführung">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Inhalt</label>
|
||||
<textarea
|
||||
onchange="updateSlide(${slide.id}, 'content', this.value)"
|
||||
placeholder="Text der Folie...">${slide.content}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Bild-URL (optional)</label>
|
||||
<input type="url"
|
||||
value="${slide.imageUrl}"
|
||||
onchange="updateSlide(${slide.id}, 'imageUrl', this.value)"
|
||||
placeholder="https://example.com/image.jpg">
|
||||
<div class="hint">URL zu einem Bild, das auf der Folie angezeigt werden soll</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Hintergrundfarbe</label>
|
||||
<div class="color-picker-wrapper">
|
||||
<input type="color"
|
||||
value="${slide.backgroundColor}"
|
||||
onchange="updateSlide(${slide.id}, 'backgroundColor', this.value)">
|
||||
<span style="color: #6b7280; font-size: 14px;">${slide.backgroundColor}</span>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(slideEl);
|
||||
});
|
||||
}
|
||||
|
||||
function savePresentation() {
|
||||
const title = document.getElementById('title').value;
|
||||
const description = document.getElementById('description').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (slides.length === 0) {
|
||||
alert('Bitte füge mindestens eine Folie hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < slides.length; i++) {
|
||||
if (!slides[i].title) {
|
||||
alert(`Folie ${i + 1} hat keinen Titel!`);
|
||||
return;
|
||||
}
|
||||
if (!slides[i].content) {
|
||||
alert(`Folie ${i + 1} hat keinen Inhalt!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const presentationData = {
|
||||
type: 'course-presentation',
|
||||
title,
|
||||
description,
|
||||
slides,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'presentation_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(presentationData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Präsentation gespeichert:', presentationData);
|
||||
}
|
||||
|
||||
function previewPresentation() {
|
||||
const title = document.getElementById('title').value;
|
||||
|
||||
if (!title || slides.length === 0) {
|
||||
alert('Bitte fülle erst alle Felder aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
description: document.getElementById('description').value,
|
||||
slides
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/course-presentation?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize with 3 slides
|
||||
addSlide();
|
||||
addSlide();
|
||||
addSlide();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
407
h5p-service/editors/drag-drop-editor.html
Normal file
407
h5p-service/editors/drag-drop-editor.html
Normal file
@@ -0,0 +1,407 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Drag and Drop Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 80px;
|
||||
}
|
||||
.zones-section {
|
||||
background: #f9fafb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.zone-card {
|
||||
background: white;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.zone-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.zone-number {
|
||||
font-weight: 600;
|
||||
color: #667eea;
|
||||
font-size: 14px;
|
||||
}
|
||||
.draggables-section {
|
||||
background: #fef3c7;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.draggable-card {
|
||||
background: white;
|
||||
border: 2px solid #f59e0b;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
}
|
||||
.draggable-card input[type="text"] {
|
||||
flex: 1;
|
||||
}
|
||||
select {
|
||||
padding: 8px 12px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.add-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>🎯</span>
|
||||
Drag and Drop Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Drag and Drop Aufgabe erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3 style="color: #1e40af; margin-bottom: 8px; font-size: 14px;">💡 Wie funktioniert Drag and Drop?</h3>
|
||||
<p style="color: #475569; font-size: 14px; line-height: 1.6;">
|
||||
Erstelle Ablage-Zonen und zugehörige Elemente. Lernende müssen die Elemente per Drag & Drop in die richtigen Zonen ziehen.
|
||||
Ideal für Zuordnungsaufgaben, Kategorisierung und mehr.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel der Aufgabe</label>
|
||||
<input type="text" id="title" placeholder="z.B. Ordne die Tiere den richtigen Kategorien zu">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="question">Aufgabenstellung</label>
|
||||
<textarea id="question" placeholder="z.B. Ziehe jedes Tier in die passende Kategorie: Säugetiere, Vögel oder Reptilien."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="zones-section">
|
||||
<h3 style="margin-bottom: 16px; color: #374151;">📍 Ablage-Zonen (Drop Zones)</h3>
|
||||
<div id="zonesContainer"></div>
|
||||
<button class="add-btn" onclick="addZone()">+ Neue Zone hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<div class="draggables-section">
|
||||
<h3 style="margin-bottom: 16px; color: #78350f;">🔲 Ziehbare Elemente (Draggables)</h3>
|
||||
<div id="draggablesContainer"></div>
|
||||
<button class="add-btn" onclick="addDraggable()">+ Neues Element hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveDragDrop()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewDragDrop()">🎮 Testen</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let zones = [];
|
||||
let draggables = [];
|
||||
|
||||
function addZone() {
|
||||
const zoneId = Date.now();
|
||||
zones.push({
|
||||
id: zoneId,
|
||||
name: ''
|
||||
});
|
||||
renderZones();
|
||||
}
|
||||
|
||||
function removeZone(zoneId) {
|
||||
if (confirm('Zone wirklich löschen?')) {
|
||||
zones = zones.filter(z => z.id !== zoneId);
|
||||
renderZones();
|
||||
renderDraggables(); // Re-render to update zone selections
|
||||
}
|
||||
}
|
||||
|
||||
function updateZone(zoneId, value) {
|
||||
const zone = zones.find(z => z.id === zoneId);
|
||||
if (zone) {
|
||||
zone.name = value;
|
||||
renderDraggables(); // Update dropdowns
|
||||
}
|
||||
}
|
||||
|
||||
function renderZones() {
|
||||
const container = document.getElementById('zonesContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
zones.forEach((zone, index) => {
|
||||
const zoneEl = document.createElement('div');
|
||||
zoneEl.className = 'zone-card';
|
||||
zoneEl.innerHTML = `
|
||||
<div class="zone-header">
|
||||
<span class="zone-number">Zone ${index + 1}</span>
|
||||
<button class="btn btn-danger" style="padding: 6px 12px; font-size: 12px;" onclick="removeZone(${zone.id})">🗑️</button>
|
||||
</div>
|
||||
<input type="text"
|
||||
value="${zone.name}"
|
||||
onchange="updateZone(${zone.id}, this.value)"
|
||||
placeholder="z.B. 'Säugetiere' oder 'Vögel'">
|
||||
`;
|
||||
container.appendChild(zoneEl);
|
||||
});
|
||||
}
|
||||
|
||||
function addDraggable() {
|
||||
const draggableId = Date.now();
|
||||
draggables.push({
|
||||
id: draggableId,
|
||||
text: '',
|
||||
correctZoneId: zones.length > 0 ? zones[0].id : null
|
||||
});
|
||||
renderDraggables();
|
||||
}
|
||||
|
||||
function removeDraggable(draggableId) {
|
||||
if (confirm('Element wirklich löschen?')) {
|
||||
draggables = draggables.filter(d => d.id !== draggableId);
|
||||
renderDraggables();
|
||||
}
|
||||
}
|
||||
|
||||
function updateDraggable(draggableId, field, value) {
|
||||
const draggable = draggables.find(d => d.id === draggableId);
|
||||
if (draggable) {
|
||||
draggable[field] = field === 'correctZoneId' ? parseInt(value) : value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderDraggables() {
|
||||
const container = document.getElementById('draggablesContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
draggables.forEach((draggable, index) => {
|
||||
const draggableEl = document.createElement('div');
|
||||
draggableEl.className = 'draggable-card';
|
||||
draggableEl.innerHTML = `
|
||||
<span style="color: #92400e; font-weight: 600; font-size: 14px;">${index + 1}.</span>
|
||||
<input type="text"
|
||||
value="${draggable.text}"
|
||||
onchange="updateDraggable(${draggable.id}, 'text', this.value)"
|
||||
placeholder="z.B. 'Hund' oder 'Adler'">
|
||||
<select onchange="updateDraggable(${draggable.id}, 'correctZoneId', this.value)">
|
||||
<option value="">Richtige Zone wählen...</option>
|
||||
${zones.map(zone => `
|
||||
<option value="${zone.id}" ${draggable.correctZoneId === zone.id ? 'selected' : ''}>
|
||||
${zone.name || 'Zone ' + (zones.indexOf(zone) + 1)}
|
||||
</option>
|
||||
`).join('')}
|
||||
</select>
|
||||
<button class="btn btn-danger" style="padding: 6px 12px; font-size: 12px;" onclick="removeDraggable(${draggable.id})">🗑️</button>
|
||||
`;
|
||||
container.appendChild(draggableEl);
|
||||
});
|
||||
}
|
||||
|
||||
function saveDragDrop() {
|
||||
const title = document.getElementById('title').value;
|
||||
const question = document.getElementById('question').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (zones.length < 2) {
|
||||
alert('Bitte füge mindestens 2 Ablage-Zonen hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (draggables.length < 3) {
|
||||
alert('Bitte füge mindestens 3 ziehbare Elemente hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < zones.length; i++) {
|
||||
if (!zones[i].name) {
|
||||
alert(`Zone ${i + 1} hat keinen Namen!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < draggables.length; i++) {
|
||||
if (!draggables[i].text) {
|
||||
alert(`Element ${i + 1} hat keinen Text!`);
|
||||
return;
|
||||
}
|
||||
if (!draggables[i].correctZoneId) {
|
||||
alert(`Element ${i + 1} hat keine richtige Zone zugewiesen!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const dragDropData = {
|
||||
type: 'drag-drop',
|
||||
title,
|
||||
question,
|
||||
zones,
|
||||
draggables,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'dragdrop_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(dragDropData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Drag and Drop gespeichert:', dragDropData);
|
||||
}
|
||||
|
||||
function previewDragDrop() {
|
||||
const title = document.getElementById('title').value;
|
||||
|
||||
if (!title || zones.length < 2 || draggables.length < 3) {
|
||||
alert('Bitte fülle erst alle Felder aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
question: document.getElementById('question').value,
|
||||
zones,
|
||||
draggables
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/drag-drop?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize with 2 zones
|
||||
addZone();
|
||||
addZone();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
312
h5p-service/editors/fill-blanks-editor.html
Normal file
312
h5p-service/editors/fill-blanks-editor.html
Normal file
@@ -0,0 +1,312 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Fill in the Blanks Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.info-box h3 {
|
||||
color: #1e40af;
|
||||
margin-bottom: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.info-box p {
|
||||
color: #475569;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 120px;
|
||||
font-family: monospace;
|
||||
}
|
||||
.preview {
|
||||
background: #f9fafb;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.preview h3 {
|
||||
color: #374151;
|
||||
margin-bottom: 12px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.preview-text {
|
||||
font-size: 16px;
|
||||
line-height: 1.8;
|
||||
color: #1f2937;
|
||||
}
|
||||
.blank {
|
||||
display: inline-block;
|
||||
background: #667eea;
|
||||
color: white;
|
||||
padding: 2px 12px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
margin: 0 4px;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
.example {
|
||||
background: #fef3c7;
|
||||
border-left: 4px solid #f59e0b;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.example strong {
|
||||
color: #92400e;
|
||||
}
|
||||
.example code {
|
||||
background: #fffbeb;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
font-family: monospace;
|
||||
color: #78350f;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>📝</span>
|
||||
Fill in the Blanks Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Lückentext erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3>💡 Wie funktioniert es?</h3>
|
||||
<p>
|
||||
Erstelle einen Text mit Lücken. Markiere die Wörter, die als Lücke erscheinen sollen, mit Sternchen: *Wort*
|
||||
</p>
|
||||
<div class="example">
|
||||
<strong>Beispiel:</strong><br>
|
||||
<code>Berlin ist die *Hauptstadt* von *Deutschland*.</code><br>
|
||||
→ Wird zu: "Berlin ist die _____ von _____."
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel</label>
|
||||
<input type="text" id="title" placeholder="z.B. Geografie Quiz - Deutsche Städte">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="instructions">Anleitung (optional)</label>
|
||||
<input type="text" id="instructions" placeholder="z.B. Fülle die Lücken mit den richtigen Wörtern aus.">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="text">Text mit Lücken</label>
|
||||
<textarea id="text" oninput="updatePreview()"
|
||||
placeholder="Beispiel: Die *Sonne* ist ein *Stern*. Sie ist etwa *150* Millionen Kilometer von der Erde entfernt.">Die *Sonne* ist ein *Stern*. Sie ist etwa *150* Millionen Kilometer von der *Erde* entfernt.</textarea>
|
||||
</div>
|
||||
|
||||
<div class="preview">
|
||||
<h3>👁️ Vorschau (wie es für Lernende aussieht):</h3>
|
||||
<div class="preview-text" id="previewText"></div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveFillBlanks()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewFillBlanks()">👁️ Testen</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function updatePreview() {
|
||||
const text = document.getElementById('text').value;
|
||||
const previewEl = document.getElementById('previewText');
|
||||
|
||||
if (!text) {
|
||||
previewEl.innerHTML = '<em style="color: #9ca3af;">Gib oben einen Text ein...</em>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace *word* with blank placeholder
|
||||
const previewText = text.replace(/\*([^*]+)\*/g, (match, word) => {
|
||||
return `<span class="blank">_____</span>`;
|
||||
});
|
||||
|
||||
previewEl.innerHTML = previewText;
|
||||
}
|
||||
|
||||
function extractBlanks(text) {
|
||||
const blanks = [];
|
||||
const regex = /\*([^*]+)\*/g;
|
||||
let match;
|
||||
|
||||
while ((match = regex.exec(text)) !== null) {
|
||||
blanks.push({
|
||||
word: match[1],
|
||||
position: match.index
|
||||
});
|
||||
}
|
||||
|
||||
return blanks;
|
||||
}
|
||||
|
||||
function saveFillBlanks() {
|
||||
const title = document.getElementById('title').value;
|
||||
const instructions = document.getElementById('instructions').value;
|
||||
const text = document.getElementById('text').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
alert('Bitte gib einen Text ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
const blanks = extractBlanks(text);
|
||||
|
||||
if (blanks.length === 0) {
|
||||
alert('Bitte markiere mindestens ein Wort mit Sternchen (*Wort*) als Lücke!');
|
||||
return;
|
||||
}
|
||||
|
||||
const fillBlanksData = {
|
||||
type: 'fill-blanks',
|
||||
title,
|
||||
instructions,
|
||||
text,
|
||||
blanks,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'fillblanks_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(fillBlanksData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Fill in the Blanks gespeichert:', fillBlanksData);
|
||||
}
|
||||
|
||||
function previewFillBlanks() {
|
||||
const title = document.getElementById('title').value;
|
||||
const text = document.getElementById('text').value;
|
||||
|
||||
if (!title || !text) {
|
||||
alert('Bitte fülle erst Titel und Text aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
const blanks = extractBlanks(text);
|
||||
|
||||
if (blanks.length === 0) {
|
||||
alert('Bitte markiere mindestens ein Wort mit Sternchen (*Wort*) als Lücke!');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
instructions: document.getElementById('instructions').value,
|
||||
text,
|
||||
blanks
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/fill-blanks?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize preview
|
||||
updatePreview();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
291
h5p-service/editors/flashcards-editor.html
Normal file
291
h5p-service/editors/flashcards-editor.html
Normal file
@@ -0,0 +1,291 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Flashcards Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
.card {
|
||||
background: #f9fafb;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.card-number {
|
||||
font-weight: 600;
|
||||
color: #667eea;
|
||||
font-size: 16px;
|
||||
}
|
||||
.card-sides {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
.card-side {
|
||||
background: white;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
border: 2px solid #e5e7eb;
|
||||
}
|
||||
.card-side h4 {
|
||||
color: #6b7280;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-card-btn {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.add-card-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>🃏</span>
|
||||
Flashcards Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Flashcards erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel des Kartensatzes</label>
|
||||
<input type="text" id="title" placeholder="z.B. Englisch Vokabeln Kapitel 3">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung (optional)</label>
|
||||
<textarea id="description" placeholder="Kurze Beschreibung der Lernkarten..."></textarea>
|
||||
</div>
|
||||
|
||||
<div id="cardsContainer"></div>
|
||||
|
||||
<button class="add-card-btn" onclick="addCard()">
|
||||
+ Neue Karte hinzufügen
|
||||
</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveFlashcards()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let cards = [];
|
||||
|
||||
function addCard() {
|
||||
const cardId = Date.now();
|
||||
cards.push({
|
||||
id: cardId,
|
||||
front: '',
|
||||
back: ''
|
||||
});
|
||||
renderCards();
|
||||
}
|
||||
|
||||
function removeCard(cardId) {
|
||||
if (confirm('Karte wirklich löschen?')) {
|
||||
cards = cards.filter(c => c.id !== cardId);
|
||||
renderCards();
|
||||
}
|
||||
}
|
||||
|
||||
function updateCard(cardId, side, value) {
|
||||
const card = cards.find(c => c.id === cardId);
|
||||
if (card) {
|
||||
card[side] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderCards() {
|
||||
const container = document.getElementById('cardsContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
cards.forEach((card, index) => {
|
||||
const cardEl = document.createElement('div');
|
||||
cardEl.className = 'card';
|
||||
cardEl.innerHTML = `
|
||||
<div class="card-header">
|
||||
<span class="card-number">Karte ${index + 1}</span>
|
||||
<button class="btn btn-danger" onclick="removeCard(${card.id})">🗑️ Löschen</button>
|
||||
</div>
|
||||
<div class="card-sides">
|
||||
<div class="card-side">
|
||||
<h4>Vorderseite</h4>
|
||||
<textarea
|
||||
onchange="updateCard(${card.id}, 'front', this.value)"
|
||||
placeholder="z.B. 'Hello'">${card.front}</textarea>
|
||||
</div>
|
||||
<div class="card-side">
|
||||
<h4>Rückseite</h4>
|
||||
<textarea
|
||||
onchange="updateCard(${card.id}, 'back', this.value)"
|
||||
placeholder="z.B. 'Hallo'">${card.back}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(cardEl);
|
||||
});
|
||||
}
|
||||
|
||||
function saveFlashcards() {
|
||||
const title = document.getElementById('title').value;
|
||||
const description = document.getElementById('description').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (cards.length === 0) {
|
||||
alert('Bitte füge mindestens eine Karte hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < cards.length; i++) {
|
||||
if (!cards[i].front || !cards[i].back) {
|
||||
alert(`Karte ${i + 1} ist nicht vollständig ausgefüllt!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const flashcardsData = {
|
||||
type: 'flashcards',
|
||||
title,
|
||||
description,
|
||||
cards,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'flashcards_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(flashcardsData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Flashcards gespeichert:', flashcardsData);
|
||||
}
|
||||
|
||||
// Initialize with 3 cards
|
||||
addCard();
|
||||
addCard();
|
||||
addCard();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
441
h5p-service/editors/interactive-video-editor.html
Normal file
441
h5p-service/editors/interactive-video-editor.html
Normal file
@@ -0,0 +1,441 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Interactive Video Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], input[type="url"], textarea, select {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, input[type="url"]:focus, textarea:focus, select:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 80px;
|
||||
}
|
||||
.video-preview {
|
||||
background: #000;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 24px;
|
||||
aspect-ratio: 16/9;
|
||||
display: none;
|
||||
}
|
||||
.video-preview iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.interactions-section {
|
||||
background: #fef3c7;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.interaction-card {
|
||||
background: white;
|
||||
border: 2px solid #f59e0b;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.interaction-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.interaction-time {
|
||||
font-weight: 700;
|
||||
color: #92400e;
|
||||
font-size: 16px;
|
||||
}
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 120px 1fr;
|
||||
gap: 12px;
|
||||
align-items: start;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.add-btn:hover {
|
||||
border-color: #f59e0b;
|
||||
color: #f59e0b;
|
||||
background: #fef3c7;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
.time-input {
|
||||
width: 120px !important;
|
||||
font-family: monospace;
|
||||
}
|
||||
.hint {
|
||||
font-size: 12px;
|
||||
color: #6b7280;
|
||||
margin-top: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>🎬</span>
|
||||
Interactive Video Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Interactive Video erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3 style="color: #1e40af; margin-bottom: 8px; font-size: 14px;">💡 Wie funktioniert Interactive Video?</h3>
|
||||
<p style="color: #475569; font-size: 14px; line-height: 1.6;">
|
||||
Füge einem Video interaktive Elemente wie Fragen, Infotexte oder Links hinzu.
|
||||
Das Video pausiert automatisch an den definierten Zeitpunkten und zeigt die Interaktionen an.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel des Videos</label>
|
||||
<input type="text" id="title" placeholder="z.B. Einführung in die Photosynthese">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="videoUrl">Video-URL</label>
|
||||
<input type="url" id="videoUrl" placeholder="https://www.youtube.com/watch?v=... oder https://player.vimeo.com/video/...">
|
||||
<div class="hint">Unterstützt: YouTube, Vimeo oder direkte MP4-Links</div>
|
||||
</div>
|
||||
|
||||
<div class="video-preview" id="videoPreview"></div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung (optional)</label>
|
||||
<textarea id="description" placeholder="Kurze Beschreibung des Video-Inhalts..."></textarea>
|
||||
</div>
|
||||
|
||||
<div class="interactions-section">
|
||||
<h3 style="margin-bottom: 16px; color: #78350f;">⏱️ Interaktive Elemente</h3>
|
||||
<div id="interactionsContainer"></div>
|
||||
<button class="add-btn" onclick="addInteraction()">+ Neue Interaktion hinzufügen</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveVideo()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewVideo()">▶️ Vorschau</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let interactions = [];
|
||||
|
||||
function addInteraction() {
|
||||
const interactionId = Date.now();
|
||||
interactions.push({
|
||||
id: interactionId,
|
||||
time: '00:00',
|
||||
type: 'question',
|
||||
title: '',
|
||||
content: ''
|
||||
});
|
||||
renderInteractions();
|
||||
}
|
||||
|
||||
function removeInteraction(interactionId) {
|
||||
if (confirm('Interaktion wirklich löschen?')) {
|
||||
interactions = interactions.filter(i => i.id !== interactionId);
|
||||
renderInteractions();
|
||||
}
|
||||
}
|
||||
|
||||
function updateInteraction(interactionId, field, value) {
|
||||
const interaction = interactions.find(i => i.id === interactionId);
|
||||
if (interaction) {
|
||||
interaction[field] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderInteractions() {
|
||||
const container = document.getElementById('interactionsContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
// Sort by time
|
||||
const sortedInteractions = [...interactions].sort((a, b) => {
|
||||
const aSeconds = timeToSeconds(a.time);
|
||||
const bSeconds = timeToSeconds(b.time);
|
||||
return aSeconds - bSeconds;
|
||||
});
|
||||
|
||||
sortedInteractions.forEach((interaction, index) => {
|
||||
const interactionEl = document.createElement('div');
|
||||
interactionEl.className = 'interaction-card';
|
||||
interactionEl.innerHTML = `
|
||||
<div class="interaction-header">
|
||||
<span class="interaction-time">⏱️ ${interaction.time}</span>
|
||||
<button class="btn btn-danger" style="padding: 6px 12px; font-size: 12px;" onclick="removeInteraction(${interaction.id})">🗑️</button>
|
||||
</div>
|
||||
|
||||
<div class="form-row" style="margin-bottom: 12px;">
|
||||
<input type="text"
|
||||
class="time-input"
|
||||
value="${interaction.time}"
|
||||
onchange="updateInteraction(${interaction.id}, 'time', this.value); renderInteractions();"
|
||||
placeholder="mm:ss">
|
||||
<select onchange="updateInteraction(${interaction.id}, 'type', this.value)">
|
||||
<option value="question" ${interaction.type === 'question' ? 'selected' : ''}>❓ Frage</option>
|
||||
<option value="info" ${interaction.type === 'info' ? 'selected' : ''}>ℹ️ Information</option>
|
||||
<option value="link" ${interaction.type === 'link' ? 'selected' : ''}>🔗 Link</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group" style="margin-bottom: 12px;">
|
||||
<input type="text"
|
||||
value="${interaction.title}"
|
||||
onchange="updateInteraction(${interaction.id}, 'title', this.value)"
|
||||
placeholder="Titel der Interaktion">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<textarea
|
||||
onchange="updateInteraction(${interaction.id}, 'content', this.value)"
|
||||
placeholder="${getPlaceholderForType(interaction.type)}">${interaction.content}</textarea>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(interactionEl);
|
||||
});
|
||||
}
|
||||
|
||||
function getPlaceholderForType(type) {
|
||||
switch (type) {
|
||||
case 'question':
|
||||
return 'Frage eingeben (z.B. Was passiert bei der Photosynthese?)';
|
||||
case 'info':
|
||||
return 'Informationstext eingeben';
|
||||
case 'link':
|
||||
return 'URL eingeben (z.B. https://example.com)';
|
||||
default:
|
||||
return 'Inhalt eingeben';
|
||||
}
|
||||
}
|
||||
|
||||
function timeToSeconds(timeStr) {
|
||||
const parts = timeStr.split(':');
|
||||
const minutes = parseInt(parts[0]) || 0;
|
||||
const seconds = parseInt(parts[1]) || 0;
|
||||
return minutes * 60 + seconds;
|
||||
}
|
||||
|
||||
function saveVideo() {
|
||||
const title = document.getElementById('title').value;
|
||||
const videoUrl = document.getElementById('videoUrl').value;
|
||||
const description = document.getElementById('description').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!videoUrl) {
|
||||
alert('Bitte gib eine Video-URL ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (interactions.length === 0) {
|
||||
alert('Bitte füge mindestens eine Interaktion hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < interactions.length; i++) {
|
||||
if (!interactions[i].title) {
|
||||
alert(`Interaktion ${i + 1} hat keinen Titel!`);
|
||||
return;
|
||||
}
|
||||
if (!interactions[i].content) {
|
||||
alert(`Interaktion ${i + 1} hat keinen Inhalt!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const videoData = {
|
||||
type: 'interactive-video',
|
||||
title,
|
||||
videoUrl,
|
||||
description,
|
||||
interactions: interactions.sort((a, b) => timeToSeconds(a.time) - timeToSeconds(b.time)),
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'video_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(videoData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Interactive Video gespeichert:', videoData);
|
||||
}
|
||||
|
||||
function previewVideo() {
|
||||
const title = document.getElementById('title').value;
|
||||
const videoUrl = document.getElementById('videoUrl').value;
|
||||
|
||||
if (!title || !videoUrl || interactions.length === 0) {
|
||||
alert('Bitte fülle erst alle Felder aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
videoUrl,
|
||||
description: document.getElementById('description').value,
|
||||
interactions: interactions.sort((a, b) => timeToSeconds(a.time) - timeToSeconds(b.time))
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/interactive-video?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Video preview on URL change
|
||||
document.getElementById('videoUrl').addEventListener('change', function() {
|
||||
const url = this.value;
|
||||
const preview = document.getElementById('videoPreview');
|
||||
|
||||
if (!url) {
|
||||
preview.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
let embedUrl = '';
|
||||
|
||||
// YouTube
|
||||
if (url.includes('youtube.com') || url.includes('youtu.be')) {
|
||||
const videoId = url.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([^&]+)/)?.[1];
|
||||
if (videoId) {
|
||||
embedUrl = `https://www.youtube.com/embed/${videoId}`;
|
||||
}
|
||||
}
|
||||
// Vimeo
|
||||
else if (url.includes('vimeo.com')) {
|
||||
const videoId = url.match(/vimeo\.com\/(\d+)/)?.[1];
|
||||
if (videoId) {
|
||||
embedUrl = `https://player.vimeo.com/video/${videoId}`;
|
||||
}
|
||||
}
|
||||
// Direct MP4
|
||||
else if (url.endsWith('.mp4')) {
|
||||
preview.innerHTML = `<video controls style="width: 100%; height: 100%;"><source src="${url}" type="video/mp4"></video>`;
|
||||
preview.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
if (embedUrl) {
|
||||
preview.innerHTML = `<iframe src="${embedUrl}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`;
|
||||
preview.style.display = 'block';
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize with 2 interactions
|
||||
addInteraction();
|
||||
addInteraction();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
330
h5p-service/editors/memory-editor.html
Normal file
330
h5p-service/editors/memory-editor.html
Normal file
@@ -0,0 +1,330 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Memory Game Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
.pair-card {
|
||||
background: #f9fafb;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.pair-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.pair-number {
|
||||
font-weight: 600;
|
||||
color: #667eea;
|
||||
font-size: 16px;
|
||||
}
|
||||
.pair-inputs {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 16px;
|
||||
}
|
||||
.pair-input {
|
||||
background: white;
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
border: 2px solid #e5e7eb;
|
||||
}
|
||||
.pair-input h4 {
|
||||
color: #6b7280;
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-pair-btn {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.add-pair-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>🧠</span>
|
||||
Memory Game Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Memory Game erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3 style="color: #1e40af; margin-bottom: 8px; font-size: 14px;">💡 Wie funktioniert Memory?</h3>
|
||||
<p style="color: #475569; font-size: 14px; line-height: 1.6;">
|
||||
Erstelle Kartenpaare. Die Lernenden müssen die zusammengehörenden Karten finden.
|
||||
Jedes Paar besteht aus zwei Karten mit verschiedenen Inhalten (z.B. Wort ↔ Übersetzung, Begriff ↔ Definition).
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel des Memory-Spiels</label>
|
||||
<input type="text" id="title" placeholder="z.B. Englisch Vokabeln - Tiere">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung (optional)</label>
|
||||
<input type="text" id="description" placeholder="Kurze Beschreibung...">
|
||||
</div>
|
||||
|
||||
<div id="pairsContainer"></div>
|
||||
|
||||
<button class="add-pair-btn" onclick="addPair()">
|
||||
+ Neues Kartenpaar hinzufügen
|
||||
</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveMemory()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewMemory()">🎮 Spielen</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let pairs = [];
|
||||
|
||||
function addPair() {
|
||||
const pairId = Date.now();
|
||||
pairs.push({
|
||||
id: pairId,
|
||||
card1: '',
|
||||
card2: ''
|
||||
});
|
||||
renderPairs();
|
||||
}
|
||||
|
||||
function removePair(pairId) {
|
||||
if (confirm('Paar wirklich löschen?')) {
|
||||
pairs = pairs.filter(p => p.id !== pairId);
|
||||
renderPairs();
|
||||
}
|
||||
}
|
||||
|
||||
function updatePair(pairId, card, value) {
|
||||
const pair = pairs.find(p => p.id === pairId);
|
||||
if (pair) {
|
||||
pair[card] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderPairs() {
|
||||
const container = document.getElementById('pairsContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
pairs.forEach((pair, index) => {
|
||||
const pairEl = document.createElement('div');
|
||||
pairEl.className = 'pair-card';
|
||||
pairEl.innerHTML = `
|
||||
<div class="pair-header">
|
||||
<span class="pair-number">Paar ${index + 1}</span>
|
||||
<button class="btn btn-danger" onclick="removePair(${pair.id})">🗑️ Löschen</button>
|
||||
</div>
|
||||
<div class="pair-inputs">
|
||||
<div class="pair-input">
|
||||
<h4>Karte 1</h4>
|
||||
<input type="text"
|
||||
value="${pair.card1}"
|
||||
onchange="updatePair(${pair.id}, 'card1', this.value)"
|
||||
placeholder="z.B. 'Cat'">
|
||||
</div>
|
||||
<div class="pair-input">
|
||||
<h4>Karte 2</h4>
|
||||
<input type="text"
|
||||
value="${pair.card2}"
|
||||
onchange="updatePair(${pair.id}, 'card2', this.value)"
|
||||
placeholder="z.B. 'Katze'">
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(pairEl);
|
||||
});
|
||||
}
|
||||
|
||||
function saveMemory() {
|
||||
const title = document.getElementById('title').value;
|
||||
const description = document.getElementById('description').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (pairs.length < 3) {
|
||||
alert('Bitte füge mindestens 3 Kartenpaare hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
if (!pairs[i].card1 || !pairs[i].card2) {
|
||||
alert(`Paar ${i + 1} ist nicht vollständig ausgefüllt!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const memoryData = {
|
||||
type: 'memory',
|
||||
title,
|
||||
description,
|
||||
pairs,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'memory_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(memoryData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Memory gespeichert:', memoryData);
|
||||
}
|
||||
|
||||
function previewMemory() {
|
||||
const title = document.getElementById('title').value;
|
||||
|
||||
if (!title || pairs.length < 3) {
|
||||
alert('Bitte fülle erst den Titel und mindestens 3 Paare aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < pairs.length; i++) {
|
||||
if (!pairs[i].card1 || !pairs[i].card2) {
|
||||
alert(`Paar ${i + 1} ist nicht vollständig ausgefüllt!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
description: document.getElementById('description').value,
|
||||
pairs
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/memory?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize with 4 pairs
|
||||
addPair();
|
||||
addPair();
|
||||
addPair();
|
||||
addPair();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
380
h5p-service/editors/quiz-editor.html
Normal file
380
h5p-service/editors/quiz-editor.html
Normal file
@@ -0,0 +1,380 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Quiz Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 80px;
|
||||
}
|
||||
.question-card {
|
||||
background: #f9fafb;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.question-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.question-number {
|
||||
font-weight: 600;
|
||||
color: #667eea;
|
||||
font-size: 16px;
|
||||
}
|
||||
.answer-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
padding: 12px;
|
||||
background: white;
|
||||
border-radius: 6px;
|
||||
border: 2px solid #e5e7eb;
|
||||
}
|
||||
.answer-option.correct {
|
||||
border-color: #10b981;
|
||||
background: #f0fdf4;
|
||||
}
|
||||
.answer-option input[type="text"] {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
.answer-option input[type="text"]:focus {
|
||||
background: white;
|
||||
border: 1px solid #667eea;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-success {
|
||||
background: #10b981;
|
||||
color: white;
|
||||
}
|
||||
.btn-success:hover {
|
||||
background: #059669;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
font-weight: normal;
|
||||
}
|
||||
input[type="checkbox"] {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
.add-question-btn {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.add-question-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>✍️</span>
|
||||
Quiz Editor (Question Set)
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Quiz erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="quizTitle">Quiz Titel</label>
|
||||
<input type="text" id="quizTitle" placeholder="z.B. Mathematik Grundlagen Quiz">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="quizDescription">Beschreibung (optional)</label>
|
||||
<textarea id="quizDescription" placeholder="Kurze Beschreibung des Quiz..."></textarea>
|
||||
</div>
|
||||
|
||||
<div id="questionsContainer">
|
||||
<!-- Questions will be added here -->
|
||||
</div>
|
||||
|
||||
<button class="add-question-btn" onclick="addQuestion()">
|
||||
+ Neue Frage hinzufügen
|
||||
</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveQuiz()">💾 Quiz speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewQuiz()">👁️ Vorschau</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let questions = [];
|
||||
|
||||
function addQuestion() {
|
||||
const questionId = Date.now();
|
||||
questions.push({
|
||||
id: questionId,
|
||||
text: '',
|
||||
answers: [
|
||||
{ text: '', correct: true },
|
||||
{ text: '', correct: false },
|
||||
{ text: '', correct: false },
|
||||
{ text: '', correct: false }
|
||||
]
|
||||
});
|
||||
renderQuestions();
|
||||
}
|
||||
|
||||
function removeQuestion(questionId) {
|
||||
if (confirm('Frage wirklich löschen?')) {
|
||||
questions = questions.filter(q => q.id !== questionId);
|
||||
renderQuestions();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleCorrectAnswer(questionId, answerIndex) {
|
||||
const question = questions.find(q => q.id === questionId);
|
||||
if (question) {
|
||||
// Toggle correct answer
|
||||
question.answers[answerIndex].correct = !question.answers[answerIndex].correct;
|
||||
renderQuestions();
|
||||
}
|
||||
}
|
||||
|
||||
function updateQuestionText(questionId, text) {
|
||||
const question = questions.find(q => q.id === questionId);
|
||||
if (question) {
|
||||
question.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
function updateAnswerText(questionId, answerIndex, text) {
|
||||
const question = questions.find(q => q.id === questionId);
|
||||
if (question) {
|
||||
question.answers[answerIndex].text = text;
|
||||
}
|
||||
}
|
||||
|
||||
function renderQuestions() {
|
||||
const container = document.getElementById('questionsContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
questions.forEach((question, qIndex) => {
|
||||
const questionCard = document.createElement('div');
|
||||
questionCard.className = 'question-card';
|
||||
questionCard.innerHTML = `
|
||||
<div class="question-header">
|
||||
<span class="question-number">Frage ${qIndex + 1}</span>
|
||||
<button class="btn btn-danger" onclick="removeQuestion(${question.id})">🗑️ Löschen</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Frage:</label>
|
||||
<input type="text"
|
||||
value="${question.text}"
|
||||
onchange="updateQuestionText(${question.id}, this.value)"
|
||||
placeholder="Gib hier deine Frage ein...">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Antwortmöglichkeiten (Markiere richtige Antworten):</label>
|
||||
${question.answers.map((answer, aIndex) => `
|
||||
<div class="answer-option ${answer.correct ? 'correct' : ''}">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox"
|
||||
${answer.correct ? 'checked' : ''}
|
||||
onchange="toggleCorrectAnswer(${question.id}, ${aIndex})">
|
||||
<span>${answer.correct ? '✓ Richtig' : 'Falsch'}</span>
|
||||
</label>
|
||||
<input type="text"
|
||||
value="${answer.text}"
|
||||
onchange="updateAnswerText(${question.id}, ${aIndex}, this.value)"
|
||||
placeholder="Antwort ${aIndex + 1}">
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(questionCard);
|
||||
});
|
||||
}
|
||||
|
||||
function saveQuiz() {
|
||||
const title = document.getElementById('quizTitle').value;
|
||||
const description = document.getElementById('quizDescription').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel für das Quiz ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (questions.length === 0) {
|
||||
alert('Bitte füge mindestens eine Frage hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate questions
|
||||
for (let i = 0; i < questions.length; i++) {
|
||||
const q = questions[i];
|
||||
if (!q.text) {
|
||||
alert(`Frage ${i + 1} hat keinen Text!`);
|
||||
return;
|
||||
}
|
||||
const hasCorrectAnswer = q.answers.some(a => a.correct);
|
||||
if (!hasCorrectAnswer) {
|
||||
alert(`Frage ${i + 1} hat keine richtige Antwort markiert!`);
|
||||
return;
|
||||
}
|
||||
const filledAnswers = q.answers.filter(a => a.text).length;
|
||||
if (filledAnswers < 2) {
|
||||
alert(`Frage ${i + 1} benötigt mindestens 2 Antworten!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const quizData = {
|
||||
type: 'quiz',
|
||||
title,
|
||||
description,
|
||||
questions,
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
// Save to localStorage for now
|
||||
const contentId = 'quiz_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(quizData));
|
||||
|
||||
// Show success message
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Quiz gespeichert:', quizData);
|
||||
}
|
||||
|
||||
function previewQuiz() {
|
||||
const title = document.getElementById('quizTitle').value;
|
||||
if (!title || questions.length === 0) {
|
||||
alert('Bitte fülle erst den Titel und mindestens eine Frage aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
// Open preview in new window
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
description: document.getElementById('quizDescription').value,
|
||||
questions
|
||||
}));
|
||||
window.open(`/h5p/player/quiz?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize with one question
|
||||
addQuestion();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
329
h5p-service/editors/timeline-editor.html
Normal file
329
h5p-service/editors/timeline-editor.html
Normal file
@@ -0,0 +1,329 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Timeline Editor - BreakPilot H5P</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: #f5f5f5;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||
padding: 30px;
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
h1 {
|
||||
color: #333;
|
||||
margin-bottom: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f0f9ff;
|
||||
border-left: 4px solid #3b82f6;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
input[type="text"], input[type="number"], textarea {
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
}
|
||||
textarea {
|
||||
resize: vertical;
|
||||
min-height: 80px;
|
||||
}
|
||||
.event-card {
|
||||
background: #f9fafb;
|
||||
border-left: 4px solid #667eea;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.event-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.event-number {
|
||||
font-weight: 700;
|
||||
color: #667eea;
|
||||
font-size: 16px;
|
||||
}
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
.btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #5568d3;
|
||||
}
|
||||
.btn-secondary {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
.btn-secondary:hover {
|
||||
background: #d1d5db;
|
||||
}
|
||||
.btn-danger {
|
||||
background: #ef4444;
|
||||
color: white;
|
||||
}
|
||||
.btn-danger:hover {
|
||||
background: #dc2626;
|
||||
}
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 24px;
|
||||
}
|
||||
.add-event-btn {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border: 2px dashed #9ca3af;
|
||||
background: transparent;
|
||||
color: #6b7280;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.add-event-btn:hover {
|
||||
border-color: #667eea;
|
||||
color: #667eea;
|
||||
background: #f9fafb;
|
||||
}
|
||||
.success-message {
|
||||
background: #d1fae5;
|
||||
border: 2px solid #10b981;
|
||||
color: #065f46;
|
||||
padding: 16px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>
|
||||
<span>📅</span>
|
||||
Timeline Editor
|
||||
</h1>
|
||||
|
||||
<div class="success-message" id="successMessage">
|
||||
✅ Timeline erfolgreich gespeichert!
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<h3 style="color: #1e40af; margin-bottom: 8px; font-size: 14px;">💡 Wie funktioniert Timeline?</h3>
|
||||
<p style="color: #475569; font-size: 14px; line-height: 1.6;">
|
||||
Erstelle eine interaktive Zeitleiste mit historischen Ereignissen oder Meilensteinen.
|
||||
Ideal für Geschichte, Biografie, Projektverläufe und mehr.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">Titel der Timeline</label>
|
||||
<input type="text" id="title" placeholder="z.B. Wichtige Ereignisse des 20. Jahrhunderts">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Beschreibung (optional)</label>
|
||||
<textarea id="description" placeholder="Kurze Einführung zur Timeline..."></textarea>
|
||||
</div>
|
||||
|
||||
<div id="eventsContainer"></div>
|
||||
|
||||
<button class="add-event-btn" onclick="addEvent()">
|
||||
+ Neues Ereignis hinzufügen
|
||||
</button>
|
||||
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-primary" onclick="saveTimeline()">💾 Speichern</button>
|
||||
<button class="btn btn-secondary" onclick="previewTimeline()">📅 Anzeigen</button>
|
||||
<button class="btn btn-secondary" onclick="window.history.back()">← Zurück</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let events = [];
|
||||
|
||||
function addEvent() {
|
||||
const eventId = Date.now();
|
||||
events.push({
|
||||
id: eventId,
|
||||
year: new Date().getFullYear(),
|
||||
title: '',
|
||||
description: ''
|
||||
});
|
||||
renderEvents();
|
||||
}
|
||||
|
||||
function removeEvent(eventId) {
|
||||
if (confirm('Ereignis wirklich löschen?')) {
|
||||
events = events.filter(e => e.id !== eventId);
|
||||
renderEvents();
|
||||
}
|
||||
}
|
||||
|
||||
function updateEvent(eventId, field, value) {
|
||||
const event = events.find(e => e.id === eventId);
|
||||
if (event) {
|
||||
event[field] = field === 'year' ? parseInt(value) || 0 : value;
|
||||
}
|
||||
}
|
||||
|
||||
function renderEvents() {
|
||||
const container = document.getElementById('eventsContainer');
|
||||
container.innerHTML = '';
|
||||
|
||||
// Sort by year
|
||||
const sortedEvents = [...events].sort((a, b) => a.year - b.year);
|
||||
|
||||
sortedEvents.forEach((event, index) => {
|
||||
const eventEl = document.createElement('div');
|
||||
eventEl.className = 'event-card';
|
||||
eventEl.innerHTML = `
|
||||
<div class="event-header">
|
||||
<span class="event-number">📍 Ereignis ${index + 1}</span>
|
||||
<button class="btn btn-danger" style="padding: 6px 12px; font-size: 12px;" onclick="removeEvent(${event.id})">🗑️ Löschen</button>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Jahr</label>
|
||||
<input type="number"
|
||||
value="${event.year}"
|
||||
onchange="updateEvent(${event.id}, 'year', this.value); renderEvents();"
|
||||
placeholder="z.B. 1945">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Titel des Ereignisses</label>
|
||||
<input type="text"
|
||||
value="${event.title}"
|
||||
onchange="updateEvent(${event.id}, 'title', this.value)"
|
||||
placeholder="z.B. Ende des Zweiten Weltkriegs">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Beschreibung</label>
|
||||
<textarea
|
||||
onchange="updateEvent(${event.id}, 'description', this.value)"
|
||||
placeholder="Kurze Beschreibung des Ereignisses...">${event.description}</textarea>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(eventEl);
|
||||
});
|
||||
}
|
||||
|
||||
function saveTimeline() {
|
||||
const title = document.getElementById('title').value;
|
||||
const description = document.getElementById('description').value;
|
||||
|
||||
if (!title) {
|
||||
alert('Bitte gib einen Titel ein!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (events.length < 2) {
|
||||
alert('Bitte füge mindestens 2 Ereignisse hinzu!');
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
if (!events[i].title) {
|
||||
alert(`Ereignis ${i + 1} hat keinen Titel!`);
|
||||
return;
|
||||
}
|
||||
if (!events[i].year) {
|
||||
alert(`Ereignis ${i + 1} hat kein Jahr!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const timelineData = {
|
||||
type: 'timeline',
|
||||
title,
|
||||
description,
|
||||
events: events.sort((a, b) => a.year - b.year),
|
||||
created: new Date().toISOString()
|
||||
};
|
||||
|
||||
const contentId = 'timeline_' + Date.now();
|
||||
localStorage.setItem(contentId, JSON.stringify(timelineData));
|
||||
|
||||
const successMsg = document.getElementById('successMessage');
|
||||
successMsg.style.display = 'block';
|
||||
setTimeout(() => {
|
||||
successMsg.style.display = 'none';
|
||||
}, 3000);
|
||||
|
||||
console.log('Timeline gespeichert:', timelineData);
|
||||
}
|
||||
|
||||
function previewTimeline() {
|
||||
const title = document.getElementById('title').value;
|
||||
|
||||
if (!title || events.length < 2) {
|
||||
alert('Bitte fülle erst den Titel und mindestens 2 Ereignisse aus!');
|
||||
return;
|
||||
}
|
||||
|
||||
const previewData = encodeURIComponent(JSON.stringify({
|
||||
title,
|
||||
description: document.getElementById('description').value,
|
||||
events: events.sort((a, b) => a.year - b.year)
|
||||
}));
|
||||
|
||||
window.open(`/h5p/player/timeline?data=${previewData}`, '_blank');
|
||||
}
|
||||
|
||||
// Initialize with 3 events
|
||||
addEvent();
|
||||
addEvent();
|
||||
addEvent();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user