editor.py aktualisiert
This commit is contained in:
@@ -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;
|
||||
|
||||
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 (!result.success) {
|
||||
alert(result.error || 'Umbenennen fehlgeschlagen.');
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteFile(kind, filename) {
|
||||
if (!confirm('Datei wirklich löschen?\n\n' + filename)) 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 (!result.success) {
|
||||
alert(result.error || 'Löschen fehlgeschlagen.');
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user