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 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'public') 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 -- cgit v1.2.3