-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
111 lines (97 loc) · 3.13 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
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>👻</title>
<style>
/*
Josh's Custom CSS Reset
https://www.joshwcomeau.com/css/custom-css-reset/
*/
*,*::before,*::after{box-sizing:border-box}*{margin:0}html,body{height:100%}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}#root,#__next{isolation:isolate}
body {
background-color: #fafafa;
}
.content {
border: 1px;
padding: 30px;
}
h1 {
font-size: 24px;
}
p {
font-size: 18px;
}
label {
display: block;
margin-bottom: .8em;
}
button {
border: solid 1px #333;
padding: 10px 30px;
}
#nanyaForm {
padding: 15px 0px;
}
#password {
font-size: 1.2em;
width: 50%;
}
@media only screen and (max-width: 600px) {
#password {
width: 70%;
}
span {
display: block;
}
}
</style>
</head>
<body>
<div class="content">
<h1>なんや😡</h1>
<p><span>【shojin_pro さん専用】</span>パスワード入力フォーム</p>
<form id="nanyaForm" method="get" autocomplete="off" action="./nanya.html">
<label for="password">パスワード</label>
<input id="password" type="text" name="password" maxlength="100">
<label for="seeCheckbox"><input id="seeCheckbox" type="checkbox">パスワードを表示する</label>
<button id="btn">決定</button>
</form>
</div>
</div>
<script>
const btn = document.getElementById("btn");
const password = document.getElementById("password");
const see = document.getElementById("seeCheckbox");
const nanya = "なんや".repeat(50);
function eventFunc() {
btn.disabled = !password.value;
if (!see.checked) {
password.value = String.fromCodePoint(128545).repeat([...password.value].length);
}
}
see.addEventListener("click", function () {
if (see.checked) {
password.value = nanya.slice(0, [...password.value].length);
} else {
password.value = String.fromCodePoint(128545).repeat([...password.value].length);
}
});
window.addEventListener("pageshow", eventFunc);
let isComposing = false;
password.addEventListener('compositionstart', (e) => {
isComposing = true;
});
password.addEventListener('input', (e) => {
if (!isComposing) {
eventFunc();
}
});
password.addEventListener('compositionend', (e) => {
eventFunc();
isComposing = false;
});
</script>
</body>
</html>