32 klassische Skripte in der alten Reihenfolge (01-core … 99-init), ohne Änderung am Code darin: geschnitten nur zwischen Anweisungen, je Datei 'use strict' wie vorher für die ganze Datei. Geprüft (acorn): kein Code, der beim Laden läuft, braucht einen Namen aus einer späteren Datei. Globale Funktionen und let/const bleiben global, die App-Schichten (native.js, native-eink.js, …) umhüllen sie wie bisher. Template und sw.js-SHELL listen die Dateien; diora-android build_web nimmt static/js rekursiv. Getestet: 14 Browser-Tests (e2e), Desktop-App (Buch, Lesestand, Leiste im Reader, Hell/Dunkel). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
952 B
JavaScript
30 lines
952 B
JavaScript
'use strict';
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// M3U import
|
|
// ---------------------------------------------------------------------------
|
|
|
|
async function importM3U(input) {
|
|
const file = input.files[0];
|
|
if (!file) return;
|
|
const status = document.getElementById('import-status');
|
|
status.textContent = 'Importiere …';
|
|
|
|
const form = new FormData();
|
|
form.append('file', file);
|
|
form.append('csrfmiddlewaretoken', getCsrfToken());
|
|
|
|
try {
|
|
const res = await fetch('/radio/import/', { method: 'POST', body: form });
|
|
const data = await res.json();
|
|
if (data.ok) {
|
|
status.textContent = `✓ ${data.added} hinzugefügt, ${data.skipped} schon gespeichert`;
|
|
if (data.added > 0) location.reload();
|
|
} else {
|
|
status.textContent = `Fehler: ${_germanError(data.error)}`;
|
|
}
|
|
} catch (e) {
|
|
status.textContent = 'Hochladen fehlgeschlagen';
|
|
}
|
|
input.value = '';
|
|
}
|