This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (53 loc) · 3.15 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- HTML Meta Tags -->
<title>Subdomain Checker | Free Domains</title>
<!-- Scripts -->
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="p-8 max-w-md m-auto bg-zinc-900 text-white text-center">
<main>
<h1 class="text-3xl font-bold mb-6">Subdomain Checker</h1>
<form id="form" class="mb-6" onsubmit="checkDomain()">
<input type="text" id="subdomain" minlength="3" maxlength="64" class="block py-2.5 px-0 w-full text-sm bg-transparent border-0 border-b-2 appearance-none border-gray-600 focus:outline-none focus:ring-0 focus:border-blue-600 mb-4" placeholder="Subdomain" required>
<select name="domain" id="domain" class="block w-full px-2 py-1.5 bg-zinc-700 outline-none border-none rounded-md mb-6" required>
<option value="" disabled selected hidden>Choose a domain</option>
<option value="is-a-fullstack.dev">is-a-fullstack.dev</option>
</select>
<button type="submit" id="btn" class="bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5">Check Domain</button>
</form>
<p id="status" class="hidden">
</main>
<footer class="mt-8">
<p>© <script>document.write(new Date().getFullYear())</script> <span class="font-semibold">Free Domains</span> - All Rights Reserved.</p>
</footer>
</body>
<script>
const form = document.getElementById("form");
const subdomain = document.getElementById("subdomain");
const domain = document.getElementById("domain");
const btn = document.getElementById("btn");
const status = document.getElementById("status");
async function checkDomain() {
event.preventDefault();
btn.setAttribute("disabled", true);
btn.innerHTML = "Checking Domain...";
fetch(`https://free-domains-api.wdh.gg/check?domain=${subdomain.value.trim().toLowerCase()}.${domain.value}`).then(res => res.json()).then(data => {
btn.removeAttribute("disabled");
btn.innerHTML = "Check Domain";
if(data.message === "DOMAIN_AVAILABLE") {
status.classList = "text-green-600 font-semibold";
status.innerHTML = `Congratulations, ${subdomain.value.trim().toLowerCase()}.${domain.value} is available! <a href="https://github.com/free-domains/register?tab=readme-ov-file#-register" class="underline underline-2 hover:no-underline">Register now!</span>`;
} else {
status.classList = "text-red-600 font-semibold";
status.innerHTML = `Sorry, ${subdomain.value.trim().toLowerCase()}.${domain.value} is unavailable!`;
}
form.reset();
})
}
</script>
</html>