Skip to content

Commit

Permalink
Update popup.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremGamingYT committed Dec 26, 2024
1 parent c337838 commit 5a0ac90
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,21 @@ function updateImages() {
btn.textContent = st;
btn.style.display = "block";
btn.style.margin = "4px 0";
btn.addEventListener("click", function() {
// Quand on clique sur un statut, on appelle la mutation
updateAnimeStatus(mediaList.id, st);
// On retire le menu
menu.remove();
});

// Désactiver le bouton si c'est le statut actuel
if (st === mediaList.status) {
btn.disabled = true;
btn.style.opacity = "0.5";
btn.style.cursor = "not-allowed";
btn.title = "Current status";
} else {
btn.addEventListener("click", function() {
// Quand on clique sur un statut, on appelle la mutation
updateAnimeStatus(mediaList.id, st);
// On retire le menu
menu.remove();
});
}
menu.appendChild(btn);
});

Expand Down

0 comments on commit 5a0ac90

Please sign in to comment.