From 9d375850f65340e0f70a3bfab56e5292130bbde6 Mon Sep 17 00:00:00 2001 From: Esenjin Date: Mon, 6 Jan 2025 20:46:06 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20d'un=20bouton=20"tout=20s=C3=A9lectionn?= =?UTF-8?q?er"=20dans=20la=20gestion=20admin=20des=20galeries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arbre-img-prive.php | 37 +++++++++++++++++++++++++++++++++++++ arbre-img.php | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/arbre-img-prive.php b/arbre-img-prive.php index 102e2ac..8cfeb40 100644 --- a/arbre-img-prive.php +++ b/arbre-img-prive.php @@ -170,6 +170,9 @@ $config = getSiteConfig(); + Retour @@ -291,6 +294,40 @@ $config = getSiteConfig(); }); } }); + + // Fonction pour basculer la sélection de toutes les images + function toggleSelectAll() { + const checkboxes = document.querySelectorAll('.image-checkbox'); + const allChecked = document.querySelectorAll('.image-checkbox:checked').length === checkboxes.length; + + checkboxes.forEach(checkbox => { + checkbox.checked = !allChecked; + }); + + updateActionButtons(); + } + + // Modifier la fonction updateActionButtons existante + function updateActionButtons() { + const checkboxes = document.querySelectorAll('.image-checkbox'); + const selectedCheckboxes = document.querySelectorAll('.image-checkbox:checked'); + const count = selectedCheckboxes.length; + + const deleteBtn = document.getElementById('deleteSelectedBtn'); + const selectAllBtn = document.getElementById('selectAllBtn'); + + if (deleteBtn) { + deleteBtn.style.display = count > 0 ? 'inline-flex' : 'none'; + } + + if (selectAllBtn) { + selectAllBtn.textContent = checkboxes.length === selectedCheckboxes.length ? + 'Tout désélectionner' : 'Tout sélectionner'; + } + } + + // Ajouter l'initialisation au chargement de la page + document.addEventListener('DOMContentLoaded', updateActionButtons);