Skip to content

Commit b6f2ac2

Browse files
committed
add the search function and it works well
try to create js file for easy loading
1 parent 17f7bf4 commit b6f2ac2

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

index.html

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,27 @@ <h3>Grab your own sweet-looking <span>.is-a.dev</span> subdomain.</h3>
6262

6363
<h2>Check SubDomain Availability</h2>
6464
<div class="search-cntnr">
65-
<input id="search-domain" type="text" placeholder="e.g. william">
66-
<div id="search-btn" class="search-tip">
67-
Check
65+
<input id="search-domain" disabled type="text" placeholder="loading reserved domain...">
66+
<div id="search-keyword" class="search-keyword">
67+
*Please refresh the page if the domain checker is not yet available, Thank You...
6868
</div>
6969
</div>
70-
<div class="search-result-cntnr">
70+
<div>
7171
<div id="result-card" class="hiddens result-card">
7272
<div class="user-infos">
7373
<img id="user-avatar" class="user-avatar" alt="user-avatar" src="http://github.com/wdhdev.png?size=64">
7474
<div style="display:flex;flex-direction:column;width:100%">
75-
<a id="user-gh-link" href="htttps://github.com/wdhdev">
75+
<a id="user-gh-link" target="_blank" href="htttps://github.com/wdhdev">
7676
<h2 id="user-name" style="line-height:1rem">William</h2>
7777
</a>
78-
<a id="user-website-link" href="https://william.is-a.dev" style="margin-top:-1.3rem;font-size:1rem">william.is-a.dev</a>
78+
<a id="user-website-link" target="_blank" href="https://william.is-a.dev" style="margin-top:-1.3rem;font-size:1rem">william.is-a.dev</a>
7979
</div>
8080
</div>
8181
<p id="user-info">Simple Website</p>
8282
</div>
83-
<p id="result-none" class="hidden">Nice! The subdomain is still available, <a href="https://docs.is-a.dev">read more here</a> to register the subdomain!</p>
83+
<p id="result-none" class="hidden">Nice! The subdomain is still available, <a alt="register-docs" target="_blank" href="https://docs.is-a.dev">read more here</a> on how to register this subdomain!</p>
8484
<p id="result-error" class="hidden">An Error Occurred while checking the subdomain, please try again...</p>
85-
<p id="result-reserved" class="hidden">Unfortunately, this domain you are searching is reserved by the developer for development purposes...</p>
85+
<p id="result-reserved" class="hidden">Unfortunately, this domain you are searching is reserved by the developer for development purposes, <a alt="reserved-domain" target="_blank" href="https://github.com/is-a-dev/register/tree/main/util/reserved.json"> visit here </a>to see the list of reserved domain</p>
8686
</div>
8787

8888
<h2>Important Links</h2>
@@ -115,6 +115,7 @@ <h2>Donations</h2>
115115
</main>
116116
<script>
117117
let is_searching=false;
118+
let pattern_domain='^[a-zA-Z0-9_][a-zA-Z0-9.-]*';
118119
let timer_search=undefined;
119120
let reserved_domain=undefined;
120121
const search_domain=document.getElementById('search-domain');
@@ -167,7 +168,7 @@ <h2>Donations</h2>
167168
if (result_card.classList.contains('hidden')) result_card.classList.toggle('hidden');
168169
var gh_link='https://github.com/'+data.owner.username;
169170
var website_link=data.search+'.is-a.dev';
170-
user_avatar.src=gh_link+'.png?size=64';
171+
user_avatar.src=gh_link+'.png?size=120';
171172
user_gh_link.href=gh_link;
172173
user_name.innerHTML=data.owner.username;
173174
user_website_link.href='https://'+website_link;
@@ -204,10 +205,13 @@ <h2>Donations</h2>
204205
})
205206
.then(data => {
206207
reserved_domain=data;
207-
timer_search=setTimeout(()=>check(this.value),300);
208+
search_domain.disabled=false;
209+
search_domain.placeholder='e.g. william';
210+
document.getElementById('search-keyword').innerHTML='*Start typing to check the subdomain availability,<a alt="filname-convention" target="_blank" href="https://docs.is-a.dev/domain-structure/#filename">check here</a> to learn how to create a proper domain name.';
211+
208212
})
209213
.catch((reason)=>{
210-
214+
// silence is the best
211215
});
212216
return;
213217
}
@@ -221,11 +225,12 @@ <h2>Donations</h2>
221225
hide_results();
222226
return;
223227
}
224-
228+
search_domain.value=new RegExp(pattern_domain).exec(this.value);
229+
console.log(this.value)
225230
if (timer_search!==undefined)
226231
clearInterval(timer_search);
227232

228-
timer_search=setTimeout(()=>check(this.value),300);
233+
timer_search=setTimeout(()=>check(this.value),1000);
229234
});
230235

231236
fetch_reserve();

styles/main.css

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ body {
55
--body-fg: #d1c4ff;
66
--hover-bg: #4e3aa3;
77
--hover-accent: #9b7dff;
8-
--card-border: linear-gradient(to right,#1a1331 0%,#4e3aa3 100%) 1;
9-
8+
--styled-border: conic-gradient(#0f0c19 0 0) padding-box,linear-gradient(to right,#1a1331 20%,#4e3aa3 80%) border-box;
9+
1010
margin: 0;
1111
padding: 0;
1212
background-color: #0f0c19;
@@ -129,9 +129,8 @@ input {
129129
padding: 8px;
130130
border-width: 1px;
131131
border-radius: 4px;
132-
border: 5px solid #0000;
133-
/* background-color: #0f0c19 */
134-
background: conic-gradient(#0f0c19 0 0) padding-box,linear-gradient(90deg,#1a1331,#4e3aa3) border-box;
132+
border: 4px solid #0000;
133+
background: var(--styled-border);
135134

136135
}
137136

@@ -140,7 +139,8 @@ input:focus {
140139
}
141140

142141
input::placeholder {
143-
color: var(--body-fg)
142+
color: var(--body-fg);
143+
opacity: 0.8;
144144
}
145145

146146
.search-cntnr {
@@ -152,24 +152,22 @@ input::placeholder {
152152
align-self: center;
153153
}
154154

155-
.search-tip {
155+
.search-keyword {
156156
font-size: 1rem;
157+
opacity: 0.5;
158+
line-height: 1.2rem;
157159
padding-left: 8px;
158160
font-style: italic;
159-
align-items: center;
160-
align-content: center;
161-
border-top-right-radius: 8px;
162-
border-bottom-right-radius: 8px;
163161
-webkit-user-select: none;
164162
-moz-user-select: none;
165163
-ms-user-select: none;
166-
user-select: none
164+
user-select: none;
167165
}
168166

169167
.result-card {
170168
padding: 0.5rem;
171169
border: 5px solid #0000;
172-
background: conic-gradient(#0f0c19 0 0) padding-box,linear-gradient(90deg,#1a1331,#4e3aa3) border-box;
170+
background: var(--styled-border);
173171
border-style: solid;
174172
border-width: 4px;
175173
border-radius: 4px;
@@ -186,8 +184,9 @@ input::placeholder {
186184

187185
.user-avatar {
188186
border-radius: 50%;
189-
background-color: var(--hover-accent);
190-
width: 64px
187+
background-color: var(--hover-bg);
188+
width: 64px;
189+
height: 64px
191190
}
192191

193192
.hidden{

0 commit comments

Comments
 (0)