diff options
| author | polo <ordipolo@gmx.fr> | 2026-06-07 21:15:38 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-06-07 21:15:38 +0200 |
| commit | e7c595bdca722858b022ac9ceb2736381f009149 (patch) | |
| tree | ca4c88984879f7f070965bf2e5fba0e7d545f139 /public | |
| parent | 3988f3eb48bafb36b370eecc75a87e804f57c09d (diff) | |
| download | cms-e7c595bdca722858b022ac9ceb2736381f009149.tar.gz cms-e7c595bdca722858b022ac9ceb2736381f009149.tar.bz2 cms-e7c595bdca722858b022ac9ceb2736381f009149.zip | |
anti spam clic
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/main.js | 4 | ||||
| -rw-r--r-- | public/js/maintenance.js | 15 |
2 files changed, 17 insertions, 2 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){ | |||
| 29 | toastNotify('Cette adresse a été copiée dans le presse-papier:<br>' + link); | 29 | toastNotify('Cette adresse a été copiée dans le presse-papier:<br>' + link); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | function toastNotify(message){ | 32 | function toastNotify(message, duration = 5000){ // 5s par défault |
| 33 | var toast = document.getElementById('toast'); | 33 | var toast = document.getElementById('toast'); |
| 34 | toast.innerHTML = message; | 34 | toast.innerHTML = message; |
| 35 | toast.className = 'toast show'; | 35 | toast.className = 'toast show'; |
| 36 | setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, 5000); | 36 | setTimeout(function(){ toast.className = toast.className.replace('show', ''); }, duration); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | 39 | ||
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(){ | |||
| 41 | }); | 41 | }); |
| 42 | fetcher.send({}); | 42 | fetcher.send({}); |
| 43 | } | 43 | } |
| 44 | |||
| 45 | function preventClickSpam(button){ | ||
| 46 | if(button.disabled){ | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | |||
| 50 | button.disabled = true; | ||
| 51 | button.style.color = 'grey'; | ||
| 52 | toastNotify('Veuillez patienter...', 1000); | ||
| 53 | |||
| 54 | setTimeout(() => { | ||
| 55 | button.disabled = false; | ||
| 56 | button.style.color = '#ff1d04'; | ||
| 57 | }, 1000); | ||
| 58 | } \ No newline at end of file | ||
