mirror of
https://github.com/manualdousuario/marreta.git
synced 2025-09-04 11:41:12 +00:00
bloquear botão ao analisar para evitar duplo clique
This commit is contained in:
parent
52985beac5
commit
2d1c089cf0
2 changed files with 25 additions and 3 deletions
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
function validateForm() {
|
function validateForm() {
|
||||||
const urlInput = document.getElementById('url');
|
const urlInput = document.getElementById('url');
|
||||||
|
const submitButton = document.querySelector('button[type="submit"]');
|
||||||
const url = urlInput.value.trim();
|
const url = urlInput.value.trim();
|
||||||
|
|
||||||
// Verifica se a URL não está vazia
|
// Verifica se a URL não está vazia
|
||||||
|
@ -36,7 +37,21 @@ function validateForm() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// Desabilita o input e o botão
|
||||||
|
urlInput.disabled = true;
|
||||||
|
submitButton.disabled = true;
|
||||||
|
|
||||||
|
// Adiciona classes de disabled do Tailwind
|
||||||
|
submitButton.classList.add('cursor-not-allowed', 'disabled:bg-blue-400');
|
||||||
|
submitButton.classList.remove('hover:bg-blue-700');
|
||||||
|
|
||||||
|
// Adiciona estado de loading ao botão
|
||||||
|
submitButton.innerHTML = `
|
||||||
|
<img src="/assets/svg/refresh.svg" class="animate-spin w-5 h-5 mr-2">
|
||||||
|
Analisando...
|
||||||
|
`;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -219,7 +219,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['url'])) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts JavaScript -->
|
<!-- Scripts JavaScript -->
|
||||||
<script src="assets/js/scripts.js"></script>
|
<script>
|
||||||
|
<?php
|
||||||
|
$js_file = 'assets/js/scripts.js';
|
||||||
|
if (file_exists($js_file)) {
|
||||||
|
echo file_get_contents($js_file);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Reference in a new issue