dForms has been shutdown

This commit is contained in:
Archie Baer 2019-06-20 18:35:07 +01:00
parent a2ddd6490f
commit 5779127565
2 changed files with 1 additions and 34 deletions

View File

@ -33,9 +33,7 @@
<form action=""> <form action="">
<p>WebDNS</p> <p>WebDNS</p>
<p>API integrations for Route53, DNSSimple, Digital Ocean, and more.</p> <p>API integrations for Route53, DNSSimple, Digital Ocean, and more.</p>
<p>Stay in the know:</p> <p>
<p>Email: <input id="emailAddr" /></p>
<p><button class="fa mail-button" id="mailbtn"></button></p>
</form> </form>
</main> </main>
<footer> <footer>

View File

@ -1,31 +0,0 @@
var sent = false;
function signup() {
if (sent) return;
var email = emailAddr.value;
if (!validateEmail(email)) return;
mailbtn.classList.add("fa-clock");
mailbtn.classList.remove("mail-button");
mailbtn.blur();
console.log("Sending request...");
sent = true;
var req = new XMLHttpRequest();
req.onload = function () {
console.log(this.status + ": " + this.responseText);
mailbtn.classList.remove("fa-clock");
mailbtn.classList.add("fa-" + (this.status === 200 ? "check" : "times"));
};
req.open("POST", "https://wh.dforms.net/589550963468140574");
req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
req.send("email=" + encodeURIComponent(email));
}
function validateEmail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());
}
document.getElementsByTagName("form")[0].onsubmit = function (e) {
e.preventDefault();
signup();
};