async function encrypt() { const plaintext = document.getElementById("plaintext").value; const key = document.getElementById("key").value; if (!plaintext) return alert("Inserisci del testo!"); try { const risposta = await fetch("/seal/cesare/encrypt", { method: "POST", headers: { "Content-Type": "application/json" }, // Invia il testo e la chiave (convertita in numero) al server body: JSON.stringify({ plaintext: plaintext, key: parseInt(key) }) }); document.getElementById("ciphertext").value = await risposta.text(); } catch (e) { alert("Errore di connessione con le API di Cesare!"); } } async function decrypt() { const ciphertext = document.getElementById("ciphertext").value; const key = document.getElementById("key").value; if (!ciphertext) return alert("Nessun testo da decifrare!"); try { const res = await fetch("/seal/cesare/decrypt", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ testo: ciphertext, chiave: parseInt(key) }) }); // TODO: SISTEMARE IL SISTEMA DI DECIFRATURA !! document.getElementById("testoDecifrato").value = await res.text(); } catch (e) { alert("Errore di connessione!"); } } // Gestione Menu Mobile function toggleMenu() { document.getElementById("nav-links").classList.toggle("active"); } // Anno dinamico Footer document.getElementById("year").innerText = new Date().getFullYear();