Skip to content

Instantly share code, notes, and snippets.

@Workman
Created May 22, 2023 08:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Workman/161fbefeca4ce72bc4a34bd6fe47b909 to your computer and use it in GitHub Desktop.
Save Workman/161fbefeca4ce72bc4a34bd6fe47b909 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title><%= @page_title || "Home" %></title>
<!-- Assets -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet" />
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
<script async src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js" integrity="sha512-aVKKRRi/Q/YV+4mjoKBsE4x3H+BkegoM/em46NNlCqNTmUYADjBbeNefNxYV7giUp0VxICtqdrbqU7iVaeZNXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<div class="container wrapper">
<div class="content">
<%=yield%>
</div>
</div>
<script>
window.check_email = (email) => {
}
window.onload = function() {
$("#validate_email").submit(function(e){
e.preventDefault();
let email = $("#validate_email input[name=email]").val();
$("#validate_email input[name=email]").val("");
$("#results tbody").prepend("\
<tr class='query_result' data-email='" + email + "'>\
<td class='logo'>-</td>\
<td class='email'>" + email + "</td>\
<td class='valid'>-</td>\
<td class='notes'>-</td>\
<td class='website'>-</td>\
</tr>\
")
let url = "https://2023-zerobounce-hack-serial.serialapps.com/validate";
$.post(url, {email: email}, function(data) {
console.log(data);
$(".query_result[data-email='" + email + "'] .logo").html(data.is_valid && data.business_info?.icon ? "<img src='" + data.business_info.icon + "' style='height:24px;width:24px;' />" : "");
$(".query_result[data-email='" + email + "'] .valid").html(data.is_valid ? "Valid!" : "Invalid");
$(".query_result[data-email='" + email + "'] .notes").html((data.is_valid && data.free_esp ? " Free ESP " : "") + (data.is_valid && data.business_info?.icon ? " Active Website " : "") );
$(".query_result[data-email='" + email + "'] .website").html(data.is_valid && data.business_info?.url ? "<a href='" + data.business_info.url + "' target='_blank' />Visit ↗</a>" : "");
});
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment