Add section images, larger covers and track tags
Section images:
- A section gets an optional image, set from its new "Modifier" dialog
(name and image), which replaces "Renommer". It goes through the same
conversion as track covers and is deleted with its section.
- Track and section uploads share routes/coverUpload.js. The cover
folder is created again if it went missing, instead of failing.
Larger images: 72 px for tracks (was 48), 96 px for section headers,
160 px in the player and the edit dialog (was 96); smaller on phones.
Tags:
- Library tracks take free tags, edited in the "Modifier" dialog, which
suggests the tags already in use. Case is ignored ("Épique" and
"épique" are one tag); at most 15 tags of 30 characters.
- A tag bar above the library filters it, and the "Tout ajouter"
buttons (global and per section) then only queue its tracks
(enqueue-all takes a tag). The search also matches tags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
793765fb79
commit
bda95ca946
13 changed files with 601 additions and 165 deletions
|
|
@ -14,6 +14,8 @@
|
|||
* - Tout texte venu de l'API passe par escapeHtml avant d'aller dans innerHTML.
|
||||
* - Les morceaux de la file n'ont pas de pochette : elle est prise sur leur morceau de bibliothèque
|
||||
* (libraryTrackId), d'où le nouvel affichage de la file à chaque changement de la bibliothèque.
|
||||
* - Le filtre par étiquette (state.activeTag) vaut aussi pour les boutons « Tout ajouter » : seuls
|
||||
* les morceaux affichés partent dans la file. La recherche, elle, n'agit que sur l'affichage.
|
||||
* - L'aperçu d'une pochette choisie passe par une URL data: ; la politique de sécurité des contenus
|
||||
* (helmet) refuse les URL blob:.
|
||||
* @see README.md#jukebox
|
||||
|
|
@ -52,6 +54,8 @@ const state = {
|
|||
sections: [],
|
||||
// Sections repliées par la personne ("" : les morceaux sans section).
|
||||
collapsedSections: new Set(),
|
||||
// Étiquette choisie pour filtrer la bibliothèque, ou null.
|
||||
activeTag: null,
|
||||
status: "idle",
|
||||
loop: false,
|
||||
// Position du morceau en cours (ms) au moment où l'état a été reçu.
|
||||
|
|
@ -89,6 +93,7 @@ const elements = {
|
|||
libraryList: $("libraryList"),
|
||||
libraryEmpty: $("libraryEmpty"),
|
||||
librarySearch: $("librarySearch"),
|
||||
libraryTags: $("libraryTags"),
|
||||
newSectionBtn: $("newSectionBtn"),
|
||||
enqueueAllBtn: $("enqueueAllBtn"),
|
||||
enqueueAllShuffledBtn: $("enqueueAllShuffledBtn"),
|
||||
|
|
@ -108,15 +113,22 @@ const elements = {
|
|||
heroUploadBtn: $("heroUploadBtn"),
|
||||
heroQueueBtn: $("heroQueueBtn"),
|
||||
queueSection: $("queueSection"),
|
||||
trackDialog: $("trackDialog"),
|
||||
trackForm: $("trackForm"),
|
||||
trackCoverPreview: $("trackCoverPreview"),
|
||||
trackCoverInput: $("trackCoverInput"),
|
||||
trackCoverRemoveBtn: $("trackCoverRemoveBtn"),
|
||||
trackTitleInput: $("trackTitleInput"),
|
||||
trackSectionSelect: $("trackSectionSelect"),
|
||||
trackCancelBtn: $("trackCancelBtn"),
|
||||
trackSaveBtn: $("trackSaveBtn"),
|
||||
editDialog: $("editDialog"),
|
||||
editDialogTitle: $("editDialogTitle"),
|
||||
editForm: $("editForm"),
|
||||
editCoverPreview: $("editCoverPreview"),
|
||||
editCoverLabel: $("editCoverLabel"),
|
||||
editCoverInput: $("editCoverInput"),
|
||||
editCoverRemoveBtn: $("editCoverRemoveBtn"),
|
||||
editNameLabel: $("editNameLabel"),
|
||||
editNameInput: $("editNameInput"),
|
||||
editSectionField: $("editSectionField"),
|
||||
editSectionSelect: $("editSectionSelect"),
|
||||
editTagsField: $("editTagsField"),
|
||||
editTagsInput: $("editTagsInput"),
|
||||
editTagSuggestions: $("editTagSuggestions"),
|
||||
editCancelBtn: $("editCancelBtn"),
|
||||
editSaveBtn: $("editSaveBtn"),
|
||||
};
|
||||
|
||||
const { setStatus, clearStatus } = createStatusManager(elements.status);
|
||||
|
|
@ -423,22 +435,86 @@ function libraryGroups() {
|
|||
return [...groups, unsorted];
|
||||
}
|
||||
|
||||
// Étiquettes : « Calme » et « calme » sont la même (comme sur le serveur, features/tags.js).
|
||||
const tagKey = (tag) => tag.toLocaleLowerCase("fr");
|
||||
const trackHasTag = (track, tag) => (track.tags ?? []).some((item) => tagKey(item) === tagKey(tag));
|
||||
|
||||
// Étiquettes de la bibliothèque, par ordre alphabétique, avec leur nombre de morceaux.
|
||||
function libraryTags() {
|
||||
const tags = new Map();
|
||||
for (const track of state.library) {
|
||||
for (const tag of track.tags ?? []) {
|
||||
const entry = tags.get(tagKey(tag)) ?? { label: tag, count: 0 };
|
||||
entry.count += 1;
|
||||
tags.set(tagKey(tag), entry);
|
||||
}
|
||||
}
|
||||
return [...tags.values()].sort((a, b) => a.label.localeCompare(b.label, "fr"));
|
||||
}
|
||||
|
||||
function setActiveTag(tag) {
|
||||
state.activeTag = tag && state.activeTag && tagKey(tag) === tagKey(state.activeTag) ? null : tag;
|
||||
renderLibrary();
|
||||
}
|
||||
|
||||
function tagButton(tag, { pressed = false, count } = {}) {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "tag";
|
||||
button.textContent = tag;
|
||||
if (count !== undefined) {
|
||||
const badge = document.createElement("span");
|
||||
badge.className = "tag__count";
|
||||
badge.textContent = String(count);
|
||||
button.append(badge);
|
||||
}
|
||||
button.setAttribute("aria-pressed", String(pressed));
|
||||
button.addEventListener("click", () => setActiveTag(tag));
|
||||
return button;
|
||||
}
|
||||
|
||||
function renderTagFilter() {
|
||||
const tags = libraryTags();
|
||||
if (state.activeTag && !tags.some(({ label }) => tagKey(label) === tagKey(state.activeTag))) {
|
||||
state.activeTag = null;
|
||||
}
|
||||
elements.libraryTags.hidden = tags.length === 0;
|
||||
elements.libraryTags.replaceChildren(
|
||||
...tags.map(({ label, count }) =>
|
||||
tagButton(label, {
|
||||
count,
|
||||
pressed: Boolean(state.activeTag) && tagKey(label) === tagKey(state.activeTag),
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function renderLibrary() {
|
||||
renderTagFilter();
|
||||
const query = elements.librarySearch.value.trim().toLowerCase();
|
||||
const tag = state.activeTag;
|
||||
const matches = (track) =>
|
||||
`${track.title || ""} ${track.originalName || ""} ${track.artist || ""}`
|
||||
(!tag || trackHasTag(track, tag)) &&
|
||||
`${track.title || ""} ${track.originalName || ""} ${track.artist || ""} ${(track.tags ?? []).join(" ")}`
|
||||
.toLowerCase()
|
||||
.includes(query);
|
||||
const matchCount = state.library.filter(matches).length;
|
||||
const filtering = Boolean(query || tag);
|
||||
|
||||
elements.libraryList.replaceChildren();
|
||||
const isEmpty = state.library.length === 0 && state.sections.length === 0;
|
||||
elements.libraryEmpty.hidden = !isEmpty && (matchCount > 0 || !query);
|
||||
elements.libraryEmpty.hidden = !isEmpty && (matchCount > 0 || !filtering);
|
||||
elements.libraryEmpty.textContent = isEmpty
|
||||
? "Aucun fichier permanent enregistré."
|
||||
: "Aucun morceau ne correspond à la recherche.";
|
||||
elements.enqueueAllBtn.disabled = state.library.length === 0;
|
||||
elements.enqueueAllShuffledBtn.disabled = state.library.length === 0;
|
||||
// Avec une étiquette choisie, les boutons n'ajoutent que ses morceaux.
|
||||
const taggedCount = tag ? state.library.filter((track) => trackHasTag(track, tag)).length : 0;
|
||||
elements.enqueueAllBtn.textContent = tag ? `Ajouter « ${tag} »` : "Tout ajouter";
|
||||
elements.enqueueAllShuffledBtn.textContent = tag
|
||||
? `Ajouter « ${tag} », mélangé`
|
||||
: "Tout ajouter, mélangé";
|
||||
elements.enqueueAllBtn.disabled = (tag ? taggedCount : state.library.length) === 0;
|
||||
elements.enqueueAllShuffledBtn.disabled = elements.enqueueAllBtn.disabled;
|
||||
|
||||
// Sans section créée, la bibliothèque reste une simple liste.
|
||||
if (state.sections.length === 0) {
|
||||
|
|
@ -449,12 +525,12 @@ function renderLibrary() {
|
|||
const groups = libraryGroups();
|
||||
groups.forEach((group, index) => {
|
||||
const shown = group.tracks.filter(matches);
|
||||
if (shown.length === 0 && (query || !group.section)) return;
|
||||
if (shown.length === 0 && (filtering || !group.section)) return;
|
||||
elements.libraryList.append(
|
||||
renderSection(group, shown, {
|
||||
index,
|
||||
last: state.sections.length - 1,
|
||||
searching: Boolean(query),
|
||||
searching: filtering,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
@ -473,12 +549,19 @@ function renderSection({ section, tracks }, shown, { index, last, searching }) {
|
|||
|
||||
const total = tracks.reduce((sum, track) => sum + (track.duration || 0), 0);
|
||||
const count = searching ? `${shown.length} sur ${tracks.length}` : String(tracks.length);
|
||||
const disabledIfEmpty = tracks.length === 0 ? "disabled" : "";
|
||||
// Avec une étiquette choisie, « Tout ajouter » n'ajoute que les morceaux qui la portent.
|
||||
const addable = state.activeTag
|
||||
? tracks.filter((track) => trackHasTag(track, state.activeTag)).length
|
||||
: tracks.length;
|
||||
const disabledIfEmpty = addable === 0 ? "disabled" : "";
|
||||
details.innerHTML = `
|
||||
<summary class="library-section__summary">
|
||||
<span class="library-section__name">${escapeHtml(section?.name ?? "Sans section")}</span>
|
||||
<span class="library-section__count">
|
||||
${count} morceau(x)${total ? ` • ${formatDuration(total)}` : ""}
|
||||
${section?.coverUrl ? `<img class="cover cover--section" src="${escapeHtml(section.coverUrl)}" alt="" loading="lazy" />` : ""}
|
||||
<span class="library-section__heading">
|
||||
<span class="library-section__name">${escapeHtml(section?.name ?? "Sans section")}</span>
|
||||
<span class="library-section__count">
|
||||
${count} morceau(x)${total ? ` • ${formatDuration(total)}` : ""}
|
||||
</span>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="library-section__toolbar toolbar">
|
||||
|
|
@ -486,7 +569,7 @@ function renderSection({ section, tracks }, shown, { index, last, searching }) {
|
|||
<button class="btn btn--secondary btn--small" type="button" data-action="shuffle" ${disabledIfEmpty}>Mélangé</button>
|
||||
${
|
||||
section
|
||||
? `<button class="btn btn--secondary btn--small" type="button" data-action="rename">Renommer</button>
|
||||
? `<button class="btn btn--secondary btn--small" type="button" data-action="edit">Modifier</button>
|
||||
<button class="btn btn--secondary btn--small" type="button" data-action="up" aria-label="Monter la section" title="Monter" ${index === 0 ? "disabled" : ""}>▲</button>
|
||||
<button class="btn btn--secondary btn--small" type="button" data-action="down" aria-label="Descendre la section" title="Descendre" ${index === last ? "disabled" : ""}>▼</button>
|
||||
<button class="btn btn--danger btn--small" type="button" data-action="delete">Supprimer</button>`
|
||||
|
|
@ -525,6 +608,7 @@ function renderTrackList(tracks) {
|
|||
<div class="media-item__meta">
|
||||
${duration ? `${duration} • ` : ""}${formatBytes(track.size)} • Ajouté le ${formatDate(track.createdAt)}
|
||||
</div>
|
||||
<div class="tag-list"></div>
|
||||
</div>
|
||||
<div class="media-item__actions">
|
||||
<button class="btn btn--small" type="button" data-action="enqueue">Ajouter</button>
|
||||
|
|
@ -532,11 +616,18 @@ function renderTrackList(tracks) {
|
|||
<button class="btn btn--danger btn--small" type="button" data-action="delete">Supprimer</button>
|
||||
</div>
|
||||
`;
|
||||
li.querySelectorAll("button").forEach((button) => {
|
||||
li.querySelectorAll(".media-item__actions button").forEach((button) => {
|
||||
button.addEventListener("click", () =>
|
||||
handleLibraryAction(button.dataset.action, track, button)
|
||||
);
|
||||
});
|
||||
li.querySelector(".tag-list").append(
|
||||
...(track.tags ?? []).map((tag) =>
|
||||
tagButton(tag, {
|
||||
pressed: Boolean(state.activeTag) && tagKey(tag) === tagKey(state.activeTag),
|
||||
})
|
||||
)
|
||||
);
|
||||
list.append(li);
|
||||
}
|
||||
return list;
|
||||
|
|
@ -544,7 +635,7 @@ function renderTrackList(tracks) {
|
|||
|
||||
// Listes de sections du formulaire d'ajout et de la fenêtre de modification.
|
||||
function renderSectionChoices() {
|
||||
for (const select of [elements.uploadSectionSelect, elements.trackSectionSelect]) {
|
||||
for (const select of [elements.uploadSectionSelect, elements.editSectionSelect]) {
|
||||
const selected = select.value;
|
||||
select.replaceChildren(new Option("Sans section", ""));
|
||||
for (const section of state.sections) {
|
||||
|
|
@ -625,7 +716,7 @@ async function handleLibraryAction(action, track, button) {
|
|||
);
|
||||
setStatus(`« ${track.title || track.originalName} » ajouté à la file`, "success");
|
||||
} else if (action === "edit") {
|
||||
openTrackEditor(track);
|
||||
openEditor("track", track);
|
||||
return;
|
||||
} else if (action === "delete") {
|
||||
if (!confirm(`Supprimer « ${track.title || track.originalName} » de la bibliothèque ?`)) {
|
||||
|
|
@ -648,7 +739,7 @@ async function enqueueAll(shuffle, button, sectionId) {
|
|||
const { tracks } = await withBusyButton(button, () =>
|
||||
apiFetch("/library/enqueue-all", {
|
||||
method: "POST",
|
||||
body: { shuffle, sectionId, requestedBy: requesterName() },
|
||||
body: { shuffle, sectionId, tag: state.activeTag ?? undefined, requestedBy: requesterName() },
|
||||
})
|
||||
);
|
||||
setStatus(`${tracks.length} morceau(x) ajouté(s) à la file`, "success");
|
||||
|
|
@ -678,16 +769,11 @@ async function handleSectionAction(action, section, index, button) {
|
|||
await enqueueAll(action === "shuffle", button, section?.id ?? null);
|
||||
return;
|
||||
}
|
||||
if (action === "rename") {
|
||||
const name = prompt("Nouveau nom de la section", section.name);
|
||||
if (!name || !name.trim()) return;
|
||||
await withBusyButton(button, () =>
|
||||
apiFetch(`/library/sections/${section.id}`, {
|
||||
method: "PATCH",
|
||||
body: { name: name.trim() },
|
||||
})
|
||||
);
|
||||
} else if (action === "up" || action === "down") {
|
||||
if (action === "edit") {
|
||||
openEditor("section", section);
|
||||
return;
|
||||
}
|
||||
if (action === "up" || action === "down") {
|
||||
const position = index + (action === "up" ? -1 : 1);
|
||||
await withBusyButton(button, () =>
|
||||
apiFetch(`/library/sections/${section.id}`, { method: "PATCH", body: { position } })
|
||||
|
|
@ -711,80 +797,132 @@ async function handleSectionAction(action, section, index, button) {
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Fenêtre de modification d'un morceau (titre, section, pochette)
|
||||
// Fenêtre de modification : morceau (titre, section, pochette) ou section (nom, image)
|
||||
|
||||
const MAX_COVER_SIZE = 10 * 1024 * 1024;
|
||||
let editedTrack = null;
|
||||
// { kind: "track" | "section", item } pendant que la fenêtre est ouverte.
|
||||
let editing = null;
|
||||
let removeCover = false;
|
||||
|
||||
function showCoverPreview(url) {
|
||||
const preview = elements.trackCoverPreview;
|
||||
const preview = elements.editCoverPreview;
|
||||
preview.classList.toggle("cover--empty", !url);
|
||||
preview.style.backgroundImage = url ? `url("${url}")` : "";
|
||||
}
|
||||
|
||||
function openTrackEditor(track) {
|
||||
editedTrack = track;
|
||||
function openEditor(kind, item) {
|
||||
const isTrack = kind === "track";
|
||||
editing = { kind, item };
|
||||
removeCover = false;
|
||||
elements.trackTitleInput.value = track.title || track.originalName;
|
||||
renderSectionChoices();
|
||||
elements.trackSectionSelect.value = track.sectionId ?? "";
|
||||
elements.trackCoverInput.value = "";
|
||||
elements.trackCoverRemoveBtn.hidden = !track.coverUrl;
|
||||
showCoverPreview(track.coverUrl);
|
||||
elements.trackDialog.showModal();
|
||||
elements.editDialogTitle.textContent = isTrack ? "Modifier le morceau" : "Modifier la section";
|
||||
elements.editCoverLabel.textContent = isTrack ? "Pochette" : "Image";
|
||||
elements.editCoverRemoveBtn.textContent = isTrack ? "Retirer la pochette" : "Retirer l'image";
|
||||
elements.editNameLabel.textContent = isTrack ? "Titre" : "Nom";
|
||||
elements.editNameInput.maxLength = isTrack ? 200 : 80;
|
||||
elements.editNameInput.value = isTrack ? item.title || item.originalName : item.name;
|
||||
elements.editSectionField.hidden = !isTrack;
|
||||
elements.editTagsField.hidden = !isTrack;
|
||||
if (isTrack) {
|
||||
renderSectionChoices();
|
||||
elements.editSectionSelect.value = item.sectionId ?? "";
|
||||
elements.editTagsInput.value = (item.tags ?? []).join(", ");
|
||||
renderTagSuggestions();
|
||||
}
|
||||
elements.editCoverInput.value = "";
|
||||
elements.editCoverRemoveBtn.hidden = !item.coverUrl;
|
||||
showCoverPreview(item.coverUrl);
|
||||
elements.editDialog.showModal();
|
||||
}
|
||||
|
||||
function previewChosenCover() {
|
||||
const file = elements.trackCoverInput.files[0];
|
||||
const file = elements.editCoverInput.files[0];
|
||||
if (!file) {
|
||||
showCoverPreview(removeCover ? null : editedTrack?.coverUrl);
|
||||
showCoverPreview(removeCover ? null : editing?.item.coverUrl);
|
||||
return;
|
||||
}
|
||||
if (file.size > MAX_COVER_SIZE) {
|
||||
setStatus("Image trop lourde : 10 Mo au plus", "error");
|
||||
elements.trackCoverInput.value = "";
|
||||
elements.editCoverInput.value = "";
|
||||
return;
|
||||
}
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener("load", () => showCoverPreview(reader.result));
|
||||
reader.readAsDataURL(file);
|
||||
elements.trackCoverRemoveBtn.hidden = false;
|
||||
elements.editCoverRemoveBtn.hidden = false;
|
||||
}
|
||||
|
||||
function clearChosenCover() {
|
||||
removeCover = true;
|
||||
elements.trackCoverInput.value = "";
|
||||
elements.trackCoverRemoveBtn.hidden = true;
|
||||
elements.editCoverInput.value = "";
|
||||
elements.editCoverRemoveBtn.hidden = true;
|
||||
showCoverPreview(null);
|
||||
}
|
||||
|
||||
async function saveTrackEditor(event) {
|
||||
event.preventDefault();
|
||||
const track = editedTrack;
|
||||
if (!track) return;
|
||||
// Étiquettes tapées dans la fenêtre, séparées par des virgules.
|
||||
function typedTags() {
|
||||
return elements.editTagsInput.value
|
||||
.split(",")
|
||||
.map((tag) => tag.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
// Étiquettes déjà utilisées dans la bibliothèque et pas encore tapées : un clic les ajoute.
|
||||
function renderTagSuggestions() {
|
||||
const typed = new Set(typedTags().map(tagKey));
|
||||
const suggestions = libraryTags().filter(({ label }) => !typed.has(tagKey(label)));
|
||||
elements.editTagSuggestions.replaceChildren(
|
||||
...suggestions.map(({ label }) => {
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.className = "tag";
|
||||
button.textContent = `+ ${label}`;
|
||||
button.addEventListener("click", () => {
|
||||
elements.editTagsInput.value = [...typedTags(), label].join(", ");
|
||||
renderTagSuggestions();
|
||||
});
|
||||
return button;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Changements de texte à envoyer : titre, section et étiquettes d'un morceau, nom d'une section.
|
||||
function editorChanges({ kind, item }) {
|
||||
const changes = {};
|
||||
const title = elements.trackTitleInput.value.trim();
|
||||
if (title && title !== (track.title || track.originalName)) changes.title = title;
|
||||
const sectionId = elements.trackSectionSelect.value || null;
|
||||
if (sectionId !== (track.sectionId ?? null)) changes.sectionId = sectionId;
|
||||
const coverFile = elements.trackCoverInput.files[0];
|
||||
const name = elements.editNameInput.value.trim();
|
||||
if (kind === "section") {
|
||||
if (name && name !== item.name) changes.name = name;
|
||||
return changes;
|
||||
}
|
||||
if (name && name !== (item.title || item.originalName)) changes.title = name;
|
||||
const sectionId = elements.editSectionSelect.value || null;
|
||||
if (sectionId !== (item.sectionId ?? null)) changes.sectionId = sectionId;
|
||||
const tags = typedTags();
|
||||
if (tags.join("\n") !== (item.tags ?? []).join("\n")) changes.tags = tags;
|
||||
return changes;
|
||||
}
|
||||
|
||||
async function saveEditor(event) {
|
||||
event.preventDefault();
|
||||
if (!editing) return;
|
||||
const { kind, item } = editing;
|
||||
const path = kind === "track" ? `/library/${item.id}` : `/library/sections/${item.id}`;
|
||||
const changes = editorChanges(editing);
|
||||
const coverFile = elements.editCoverInput.files[0];
|
||||
|
||||
try {
|
||||
await withBusyButton(elements.trackSaveBtn, async () => {
|
||||
await withBusyButton(elements.editSaveBtn, async () => {
|
||||
if (Object.keys(changes).length > 0) {
|
||||
await apiFetch(`/library/${track.id}`, { method: "PATCH", body: changes });
|
||||
await apiFetch(path, { method: "PATCH", body: changes });
|
||||
}
|
||||
if (coverFile) {
|
||||
const data = new FormData();
|
||||
data.append("cover", coverFile);
|
||||
await apiFetch(`/library/${track.id}/cover`, { method: "PUT", body: data });
|
||||
} else if (removeCover && track.coverUrl) {
|
||||
await apiFetch(`/library/${track.id}/cover`, { method: "DELETE" });
|
||||
await apiFetch(`${path}/cover`, { method: "PUT", body: data });
|
||||
} else if (removeCover && item.coverUrl) {
|
||||
await apiFetch(`${path}/cover`, { method: "DELETE" });
|
||||
}
|
||||
});
|
||||
elements.trackDialog.close();
|
||||
elements.editDialog.close();
|
||||
if (!state.live) await refreshLibrary();
|
||||
} catch (error) {
|
||||
// La fenêtre reste ouverte : la personne peut corriger (autre image…) et réessayer.
|
||||
|
|
@ -1019,12 +1157,13 @@ function bindEvents() {
|
|||
elements.newSectionBtn.addEventListener("click", () => createSection(elements.newSectionBtn));
|
||||
elements.permanentCheckbox.addEventListener("change", renderSectionChoices);
|
||||
|
||||
elements.trackForm.addEventListener("submit", saveTrackEditor);
|
||||
elements.trackCancelBtn.addEventListener("click", () => elements.trackDialog.close());
|
||||
elements.trackCoverInput.addEventListener("change", previewChosenCover);
|
||||
elements.trackCoverRemoveBtn.addEventListener("click", clearChosenCover);
|
||||
elements.trackDialog.addEventListener("close", () => {
|
||||
editedTrack = null;
|
||||
elements.editForm.addEventListener("submit", saveEditor);
|
||||
elements.editCancelBtn.addEventListener("click", () => elements.editDialog.close());
|
||||
elements.editCoverInput.addEventListener("change", previewChosenCover);
|
||||
elements.editTagsInput.addEventListener("input", renderTagSuggestions);
|
||||
elements.editCoverRemoveBtn.addEventListener("click", clearChosenCover);
|
||||
elements.editDialog.addEventListener("close", () => {
|
||||
editing = null;
|
||||
});
|
||||
elements.enqueueAllBtn.addEventListener("click", () =>
|
||||
enqueueAll(false, elements.enqueueAllBtn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue