-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
99 lines (95 loc) · 2.6 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
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
<html>
<head>
<title>scug</title>
<meta name="og:type" content="website" />
<meta name="og:title" content="scug" />
<meta name="og:description" content="wawa" />
<style>
:root {
--bg: #ffffff;
--text: #000000;
--placeholder: #5a5a5a;
--submit: #bebfc0;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #02010a;
--text: #ffffff;
--placeholder: #b9b9b9;
--submit: #3f464d;
}
}
body {
background-color: var(--bg);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
font-family: sans-serif;
color: var(--text);
}
form {
display: flex;
flex-direction: column;
box-sizing: border-box;
padding: 12px;
padding-left: 10vw;
padding-right: 10vw;
width: 100%;
gap: 12px;
}
#send {
background-color: var(--submit);
}
form > * {
font-size: xx-large;
background-color: var(--bg);
color: var(--text);
&::placeholder {
color: var(--placeholder);
}
}
textarea {
height: 20vh;
}
</style>
</head>
<body>
<div style="font-size: xxx-large">nothing here yet sorry</div>
<div style="font-size: x-large">you can send me messages:</div>
<form id="form" action="javascript:void(0);">
<input id="username" minlength="1" maxlength="32" value="" placeholder="Your name" type="text" required />
<textarea id="content" minlength="1" maxlength="1024" placeholder="Your message" required></textarea>
<input id="send" type="submit" value="Send" />
</form>
<script>
form.addEventListener('submit', async () => {
send.disabled = true;
username.disabled = true;
content.disabled = true;
let res = await fetch('https://mysite.mypawsaresmall.workers.dev/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: username.value,
content: content.value,
}),
})
.then((e) => e.text())
.then((e) => [true, e])
.catch((e) => [false, e]);
send.disabled = false;
username.disabled = false;
content.disabled = false;
if (res[0]) content.value = '';
alert(res[1]);
});
</script>
</body>
</html>