File size: 4,561 Bytes
8a21bc0
 
216167a
8a21bc0
216167a
 
 
 
 
 
8a21bc0
216167a
f131aa9
216167a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a21bc0
216167a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a21bc0
216167a
8a21bc0
216167a
8a21bc0
 
 
b7dbc51
216167a
 
 
 
27010b4
 
 
216167a
 
 
 
 
 
 
de588ef
216167a
 
 
8a21bc0
216167a
 
 
8a21bc0
216167a
 
 
 
 
 
 
 
 
8a21bc0
216167a
 
 
 
 
 
 
 
8a21bc0
 
216167a
 
8a21bc0
 
 
 
216167a
 
 
8a21bc0
216167a
 
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html>
  <head>
    <title>Private Domain Checker | ToKnow.ai</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
      rel="stylesheet"
    />
  </head>

  <body class="bg-light">
    <div class="container-fluid mt-5">
      <div class="row justify-content-center">
        <div class="col-lg-6 col-md-8">
          <div class="card">
            <div class="card-body">
              <h3 class="text-center">Private Domain Checker</h3>
              <p class="text-center text-body-secondary">
                <a
                  target="_blank"
                  href="https://toknow.ai/posts/private-domain-checker"
                  class="text-decoration-none text-reset"
                >
                  <b><u>ToKnow</u></b
                  >.ai
                </a>
              </p>
              <form id="searchForm" class="mb-3 mt-4">
                <div class="input-group">
                  <input
                    type="text"
                    id="domain"
                    class="form-control"
                    placeholder="Enter domain name... eg: example.com"
                    required
                  />
                  <button class="btn btn-primary" type="submit">Check</button>
                </div>
              </form>
              <div id="result" class="text-center d-none">
                <div
                  class="spinner-border text-primary d-none"
                  id="spinner"
                ></div>
                <div id="resultText"></div>
              </div>
              <p class="text-center text-body-secondary mt-4 text-lowercase">
                Protecting Against
                <a
                  target="_blank"
                  href="https://toknow.ai/posts/private-domain-checker"
                  class="text-decoration-none text-reset"
                  ><u>Domain Front-Running by Registrars</u></a
                >
                <br />
                <a
                  target="_blank"
                  href="https://toknow.ai/posts/private-domain-checker"
                  class="text-decoration-none"
                >
                  <i>get help or get more details</i>
                </a>
                <img
                  class="rounded mx-auto d-block"
                  src="https://api.visitorbadge.io/api/visitors?path=https://toknow.ai/posts/private-domain-checker"
                />
              </p>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script>
      document.addEventListener("DOMContentLoaded", () => {
        const domain = [...new URL(location.href).searchParams]
          .find(([key, value]) => key?.toLowerCase()?.trim() === "domain")?.[1]
          ?.toLowerCase()
          ?.trim();
        if ((domain || "").length > 0) {
          document.getElementById("domain").value = domain;
        }
      });
      document.getElementById("searchForm").onsubmit = async (e) => {
        e.preventDefault();
        const domain = document.getElementById("domain").value;
        if ((domain || "").trim().length == 0) {
          return;
        }

        const result = document.getElementById("result");
        const spinner = document.getElementById("spinner");
        const resultText = document.getElementById("resultText");

        result.classList.remove("d-none");
        spinner.classList.remove("d-none");
        resultText.innerHTML = "";

        try {
          const response = await fetch(`/check`, {
            method: "POST",
            headers: {
              "Content-Type": "application/json",
            },
            body: JSON.stringify({ domain }),
          });
          const data = await response.json();

          resultText.innerHTML = `
                <div class="alert ${
                  data.available ? "alert-success" : "alert-danger"
                } mt-3">
                    <strong>${data.domain ?? domain}</strong> is ${
            data.available ? "available" : "not available"
          }
                    ${data.method ? `<br><i>(${data.method})</i>` : ""}
                </div>
            `;
        } catch (err) {
          resultText.innerHTML = `
                <div class="alert alert-warning mt-3">
                    Error checking domain
                </div>
            `;
        }
        spinner.classList.add("d-none");
      };
    </script>
  </body>
</html>