editor.py aktualisiert

This commit is contained in:
2026-09-29 09:18:57 +02:00
parent cfeb05befa
commit d1eba18bb7
+33 -20
View File
@@ -434,7 +434,16 @@ audio.addEventListener('timeupdate', () => {
renderPlayhead();
if (audio.currentTime >= end && !audio.paused) audio.pause();
});
audio.addEventListener('loadedmetadata', renderPlayhead);
audio.addEventListener('play', renderPlayhead);
audio.addEventListener('pause', renderPlayhead);
audio.addEventListener('seeking', renderPlayhead);
function animatePlayhead() {
renderPlayhead();
if (!audio.paused) requestAnimationFrame(animatePlayhead);
}
audio.addEventListener('play', () => requestAnimationFrame(animatePlayhead));
function jump(sec) { audio.currentTime=Math.max(0,Math.min(duration,audio.currentTime+sec)); renderPlayhead(); }
function playFromStart() { audio.currentTime=start; renderPlayhead(); audio.play(); }
function playSelection() { audio.currentTime=start; renderPlayhead(); audio.play(); }
@@ -588,33 +597,37 @@ async function renameFile(kind, filename) {
const newName = entered.trim();
if (!newName || newName === current) return;
const response = await fetch('/api/file', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({action: 'rename', kind, filename, new_filename: newName})
});
const result = await response.json();
if (!result.success) {
alert(result.error || 'Umbenennen fehlgeschlagen.');
return;
try {
const response = await fetch('/api/file', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({action: 'rename', kind, filename, new_filename: newName})
});
const result = await response.json();
if (!response.ok || !result.success) throw new Error(result.error || `HTTP ${response.status}`);
location.reload();
} catch (error) {
console.error('Umbenennen fehlgeschlagen:', error);
alert('Umbenennen fehlgeschlagen: ' + error.message);
}
location.reload();
}
async function deleteFile(kind, filename) {
if (!confirm('Datei wirklich löschen?\n\n' + filename)) return;
const response = await fetch('/api/file', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({action: 'delete', kind, filename})
});
const result = await response.json();
if (!result.success) {
alert(result.error || 'Löschen fehlgeschlagen.');
return;
try {
const response = await fetch('/api/file', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({action: 'delete', kind, filename})
});
const result = await response.json();
if (!response.ok || !result.success) throw new Error(result.error || `HTTP ${response.status}`);
location.reload();
} catch (error) {
console.error('Löschen fehlgeschlagen:', error);
alert('Löschen fehlgeschlagen: ' + error.message);
}
location.reload();
}
</script>
</body>