Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (47 loc) · 1.63 KB
/
Copy pathscript.js
File metadata and controls
51 lines (47 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Smooth scroll
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function(e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
// --- Smooth Scroll sur les liens internes ---
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener("click", function(e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth"
});
});
});
// --- Gestion du formulaire ---
document.getElementById('emailForm').addEventListener('submit', function(e) {
e.preventDefault();
// Cibler le bouton d'envoi
const button = this.querySelector('button');
button.disabled = true;
button.textContent = "Envoi...";
let formData = new FormData(this);
fetch('https://script.google.com/macros/s/AKfycbwUeRKsgiVnNIb-dHexu_a0So_qlWDehh7KqF2idayUwY35C8PPoi027maFAyxP4v1h/exec', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(data => {
if (data.trim() === "OK") {
// Téléchargement du PDF
window.location.href = "30_Prompts_IA_pour_Jeunes_Afro_Urbains.pdf";
} else {
alert("❌ Une erreur est survenue. Merci de réessayer.");
}
})
.catch(error => {
console.error("Erreur:", error);
alert("⚠ Impossible de soumettre le formulaire.");
});
});
const button = this.querySelector('button');
button.disabled = true;
button.textContent = "Envoi...";