From e7c595bdca722858b022ac9ceb2736381f009149 Mon Sep 17 00:00:00 2001 From: polo Date: Sun, 7 Jun 2026 21:15:38 +0200 Subject: anti spam clic --- public/js/main.js | 4 ++-- public/js/maintenance.js | 15 +++++++++++++++ src/view/templates/maintenance.php | 4 ++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index d1459d5..1666b5c 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -29,11 +29,11 @@ function copyInClipBoard(link){ toastNotify('Cette adresse a été copiée dans le presse-papier:
' + link); } -function toastNotify(message){ +function toastNotify(message, duration = 5000){ // 5s par défault var toast = document.getElementById('toast'); toast.innerHTML = message; toast.className = 'toast show'; - setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, 5000); + setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, duration); } diff --git a/public/js/maintenance.js b/public/js/maintenance.js index 2ed7f98..0c28183 100644 --- a/public/js/maintenance.js +++ b/public/js/maintenance.js @@ -41,3 +41,18 @@ function cleanLogs(){ }); fetcher.send({}); } + +function preventClickSpam(button){ + if(button.disabled){ + return; + } + + button.disabled = true; + button.style.color = 'grey'; + toastNotify('Veuillez patienter...', 1000); + + setTimeout(() => { + button.disabled = false; + button.style.color = '#ff1d04'; + }, 1000); +} \ No newline at end of file diff --git a/src/view/templates/maintenance.php b/src/view/templates/maintenance.php index 6b4d223..5b8fd18 100644 --- a/src/view/templates/maintenance.php +++ b/src/view/templates/maintenance.php @@ -19,7 +19,7 @@

- +
Obtenir un fichier SQL à conserver sur votre ordinateur. Une sauvegarde (désignée par "auto") est réalisée à chaque visite de cette page.

@@ -46,7 +46,7 @@