Empereur-Pirate commited on
Commit
a5fe226
1 Parent(s): 043c8cf

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +6 -4
static/script.js CHANGED
@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => {
10
  revealContent();
11
  });
12
 
13
- const textGenForm = document.querySelector(".text-gen-form");
14
 
15
  const generateText = async (text) => {
16
  const response = await fetch('/generate_text', {
@@ -26,9 +26,9 @@ const generateText = async (text) => {
26
  return data.output;
27
  };
28
 
29
- function handleFormSubmit(event) {
30
  event.preventDefault();
31
- // Afficher l'image de chargement
32
  const loader = document.querySelector('#loader');
33
  loader.classList.remove('hidden');
34
  console.log("Form submitted");
@@ -37,4 +37,6 @@ function handleFormSubmit(event) {
37
  textGenParagraph.textContent = await generateText(textGenInput.value);
38
  // Masquer l'image de chargement après le traitement
39
  loader.classList.add('hidden');
40
- }
 
 
 
10
  revealContent();
11
  });
12
 
13
+ const textGenForm = document.querySelector("#text-gen-form");
14
 
15
  const generateText = async (text) => {
16
  const response = await fetch('/generate_text', {
 
26
  return data.output;
27
  };
28
 
29
+ async function handleFormSubmit(event) {
30
  event.preventDefault();
31
+ // Afficher l'image de chargement
32
  const loader = document.querySelector('#loader');
33
  loader.classList.remove('hidden');
34
  console.log("Form submitted");
 
37
  textGenParagraph.textContent = await generateText(textGenInput.value);
38
  // Masquer l'image de chargement après le traitement
39
  loader.classList.add('hidden');
40
+ }
41
+
42
+ textGenForm.addEventListener('submit', handleFormSubmit);