editor.py aktualisiert
This commit is contained in:
@@ -434,7 +434,16 @@ audio.addEventListener('timeupdate', () => {
|
|||||||
renderPlayhead();
|
renderPlayhead();
|
||||||
if (audio.currentTime >= end && !audio.paused) audio.pause();
|
if (audio.currentTime >= end && !audio.paused) audio.pause();
|
||||||
});
|
});
|
||||||
|
audio.addEventListener('loadedmetadata', renderPlayhead);
|
||||||
|
audio.addEventListener('play', renderPlayhead);
|
||||||
|
audio.addEventListener('pause', renderPlayhead);
|
||||||
audio.addEventListener('seeking', 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 jump(sec) { audio.currentTime=Math.max(0,Math.min(duration,audio.currentTime+sec)); renderPlayhead(); }
|
||||||
function playFromStart() { audio.currentTime=start; renderPlayhead(); audio.play(); }
|
function playFromStart() { audio.currentTime=start; renderPlayhead(); audio.play(); }
|
||||||
function playSelection() { 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();
|
const newName = entered.trim();
|
||||||
if (!newName || newName === current) return;
|
if (!newName || newName === current) return;
|
||||||
|
|
||||||
|
try {
|
||||||
const response = await fetch('/api/file', {
|
const response = await fetch('/api/file', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({action: 'rename', kind, filename, new_filename: newName})
|
body: JSON.stringify({action: 'rename', kind, filename, new_filename: newName})
|
||||||
});
|
});
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (!result.success) {
|
if (!response.ok || !result.success) throw new Error(result.error || `HTTP ${response.status}`);
|
||||||
alert(result.error || 'Umbenennen fehlgeschlagen.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Umbenennen fehlgeschlagen:', error);
|
||||||
|
alert('Umbenennen fehlgeschlagen: ' + error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteFile(kind, filename) {
|
async function deleteFile(kind, filename) {
|
||||||
if (!confirm('Datei wirklich löschen?\n\n' + filename)) return;
|
if (!confirm('Datei wirklich löschen?\n\n' + filename)) return;
|
||||||
|
|
||||||
|
try {
|
||||||
const response = await fetch('/api/file', {
|
const response = await fetch('/api/file', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type': 'application/json'},
|
headers: {'Content-Type': 'application/json'},
|
||||||
body: JSON.stringify({action: 'delete', kind, filename})
|
body: JSON.stringify({action: 'delete', kind, filename})
|
||||||
});
|
});
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (!result.success) {
|
if (!response.ok || !result.success) throw new Error(result.error || `HTTP ${response.status}`);
|
||||||
alert(result.error || 'Löschen fehlgeschlagen.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
location.reload();
|
location.reload();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Löschen fehlgeschlagen:', error);
|
||||||
|
alert('Löschen fehlgeschlagen: ' + error.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user