1/* Muxtly contact form submission (shared by all languages). 2 * POSTs the form to /api/contact (Cloudflare Pages Function), which forwards 3 * it to the owner's VPS endpoint for storage in PostgreSQL. 4 */ 5(function () { 6 var MSG = { 7 en: { fill: "Please fill in all fields", fail: "Submission failed, please try again", net: "Network error, please try again", sending: "Sending..." }, 8 de: { fill: "Bitte fülle alle Felder aus", fail: "Ãbertragung fehlgeschlagen. Bitte erneut versuchen.", net: "Netzwerkfehler. Bitte erneut versuchen.", sending: "Wird gesendet..." }, 9 es: { fill: "Por favor, rellena todos los campos", fail: "El envÃo falló. Inténtalo de nuevo.", net: "Error de red. Inténtalo de nuevo.", sending: "Enviando..." }, 10 fr: { fill: "Veuillez remplir tous les champs", fail: "L'envoi a échoué. Veuillez réessayer.", net: "Erreur réseau. Veuillez réessayer.", sending: "Envoi en cours..." }, 11 ja: { fill: "ãã¹ã¦ã®é ç®ãå ¥åãã¦ãã ãã", fail: "éä¿¡ã«å¤±æãã¾ãããããä¸åº¦ã試ããã ããã", net: "ãããã¯ã¼ã¯ã¨ã©ã¼ã§ããããä¸åº¦ã試ããã ããã", sending: "éä¿¡ä¸..." }, 12 ko: { fill: "모ë íë를 ì ë ¥í´ ì£¼ì¸ì", fail: "ì ì¡ì ì¤í¨íìµëë¤. ë¤ì ìëí´ ì£¼ì¸ì.", net: "ë¤í¸ìí¬ ì¤ë¥ì ëë¤. ë¤ì ìëí´ ì£¼ì¸ì.", sending: "ë³´ë´ë ì¤..." }, 13 pt: { fill: "Preencha todos os campos", fail: "Falha no envio. Tente novamente.", net: "Erro de rede. Tente novamente.", sending: "Enviando..." }, 14 "zh-CN": { fill: "è¯·å¡«åææåæ®µ", fail: "æäº¤å¤±è´¥ï¼è¯·éè¯", net: "ç½ç»é误ï¼è¯·éè¯", sending: "åéä¸..." }, 15 "zh-TW": { fill: "è«å¡«å¯«æææ¬ä½", fail: "æäº¤å¤±æï¼è«é試", net: "網路é¯èª¤ï¼è«é試", sending: "å³éä¸..." } 16 }; 17 18 function t(key) { 19 var lang = (document.documentElement.lang || "en").toLowerCase(); 20 var m = MSG[lang] || MSG.en; 21 return m[key]; 22 } 23 24 window.sendForm = async function () { 25 var name = (document.getElementById("name").value || "").trim(); 26 var email = (document.getElementById("email").value || "").trim(); 27 var message = (document.getElementById("message").value || "").trim(); 28 var typeEl = document.getElementById("type"); 29 var type = typeEl ? typeEl.value : ""; 30 31 if (!name || !email || !message) { alert(t("fill")); return; } 32 33 var btn = document.querySelector(".btn"); 34 var oldText = btn ? btn.textContent : ""; 35 if (btn) { btn.disabled = true; btn.textContent = t("sending"); } 36 37 try { 38 var resp = await fetch("/api/contact", { 39 method: "POST", 40 headers: { "content-type": "application/json" }, 41 body: JSON.stringify({ 42 name: name, 43 email: email, 44 type: type, 45 message: message, 46 lang: document.documentElement.lang || "en" 47 }) 48 }); 49 if (resp.ok) { 50 document.getElementById("result").style.display = "block"; 51 } else { 52 alert(t("fail")); 53 } 54 } catch (err) { 55 alert(t("net")); 56 } finally { 57 if (btn) { btn.disabled = false; btn.textContent = oldText; } 58 } 59 }; 60})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.