=================================================================== RCS file: /cvs/cvs/draft/form.min.js,v retrieving revision 1.92 retrieving revision 1.103 diff -u -p -r1.92 -r1.103 --- draft/form.min.js 2024/03/31 16:35:25 1.92 +++ draft/form.min.js 2024/04/02 07:28:58 1.103 @@ -1,7 +1,7 @@ const form = document.querySelector("#cform"); function parseString(str) { - return str.replace(/[~`!@#$%^&*(){}\[\];:"'<,.>?\/\\|+=-]/g, '_'); + return str.replace(/[!~`%&^{}\[\]<>|\\\/"'@#$;]/g, '_'); } function parseMail(email) { @@ -43,10 +43,9 @@ async function sendData() { if(erro) { info.textContent="One or more fields have an error. Please check and try again." } else { - var fcon = document.querySelectorAll(".wpcf7-form-control"), - id = "(NULL)"; + var fcon = document.querySelectorAll(".wpcf7-form-control"); - info.textContent="Please wait..." + info.textContent="Verifying..." fcon.forEach((f) => { f.disabled=true; l=f; @@ -59,24 +58,24 @@ async function sendData() { 'response-field': false, sitekey: '0x4AAAAAAAVpXFEy152AON1L', 'error-callback': function(e) { - info.textContent="Cloudflare Turnstile verification error. Try again later." + info.textContent="Verification error. Try again later."; + turnstile.remove(); }, callback: function(token) { - info.textContent=token; -// const data = JSON.stringify({"add": mail, "sub": subj, "msg": mess, "tok": token}); -// info.textContent="Sending..."; -// fetch("/feedbk/", { -// headers: { "Content-Type": "application/json" }, -// credentials: "same-origin", -// mode: "same-origin", -// method: "post", -// body: data -// }) -// .then(response => response.json()) -// .then(json => info.textContent=json['msg']) - }; + const data = JSON.stringify({"add": mail, "sub": subj, "msg": mess, "tok": token}); + info.textContent="Sending..."; + fetch("/feedbk/", { + headers: { "Content-Type": "application/json" }, + credentials: "same-origin", + mode: "same-origin", + method: "post", + body: data + }) + .then(response => response.json()) + .then(json => info.textContent=json['msg']) + .then(turnstile.remove()); + } }); -// turnstile.remove(); }); }; }