-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
193 lines (192 loc) · 5.7 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="shortcut icon"
href="https://horans.github.io/asset/favicon.ico"
/>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<style>
aside {
z-index: 3;
}
.transition {
transition: all ease 0.3s;
}
.cursor-pointer,
.form-check input,
.form-check label {
cursor: pointer;
}
nav.transition:not(.enabled) {
opacity: 0;
pointer-events: none;
}
.list-inline {
font-size: 0.75rem;
}
.list-inline::before {
margin-right: .5rem;
content: "\2192";
}
.toast {
width: 6rem;
}
</style>
<title>Random String Generator</title>
</head>
<body>
<!--
/*****************************************************
* project: random string generator *
* description: simple online password generator *
* author: [email protected] *
* url: https://github.com/horans/random *
* update: 210331 *
*****************************************************/
-->
<header class="my-4">
<h1 class="text-center">Random String Generator</h1>
</header>
<main class="position-relative" id="random">
<aside
class="position-absolute bg-white w-100 h-100"
:class="{ invisible : init }"
></aside>
<form class="container">
<div class="input-group mb-3">
<button
class="btn btn-outline-primary dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
name="shortcut"
>
Length: {{ option.length.current }}
</button>
<ul class="dropdown-menu">
<li v-for="i in option.length.shortcut" :key="i">
<button
class="dropdown-item"
:class="{ active: i == option.length.current }"
:name="'length-' + i"
@click.prevent="option.length.current = i"
>
{{ i }}
</button>
</li>
</ul>
<input
type="range"
class="form-control form-range px-2 h-auto"
:min="option.length.min"
:max="option.length.max"
name="length"
v-model="option.length.current"
/>
<button
class="btn btn-primary"
type="button"
name="generate"
@click="debouncedRepeat"
>
Generate
</button>
</div>
<nav>
<div
class="form-check form-switch form-check-inline transition"
data-bs-toggle="tooltip"
v-for="(v, k) in option.character"
:key="k"
:title="v.label"
:class="{ 'bg-light': k === 'symbol' && v.enabled }"
>
<input
class="form-check-input"
type="checkbox"
name="character"
:id="'character-' + k"
v-model="v.enabled"
/>
<label class="form-check-label" :for="'character-' + k"
>{{ d.startCase(k) }}</label
>
</div>
</nav>
<nav
class="bg-light transition"
:class="{ enabled: option.character.symbol.enabled }"
>
<div
class="form-check form-check-inline form-control-sm"
data-bs-toggle="tooltip"
v-for="(v, k) in option.character.symbol.case"
:key="k"
:title="d.startCase(k)"
>
<input
class="form-check-input"
type="checkbox"
name="symbol"
:id="'symbol-' + k"
v-model="v.enabled"
/>
<label class="form-check-label" :for="'symbol-' + k"
>{{ v.label }}</label
>
</div>
</nav>
<div class="input-group input-group-lg mt-2">
<output
class="form-control text-center font-monospace cursor-pointer user-select-all"
name="result"
@click="debouncedCopy(result)"
>
{{ result }}
</output>
</div>
<ul
class="list-inline mt-5 text-center text-black-50 font-monospace"
v-if="history.length > 0"
>
<li
class="list-inline-item cursor-pointer user-select-all"
v-for="(i, n) in history"
:key="n"
:id="'history-' + n"
@click="debouncedCopy(i)"
>
{{ i }}
</li>
</ul>
</form>
</main>
<footer>
<div class="position-fixed top-0 end-0 p-3" style="z-index: 5">
<div
id="liveToast"
class="toast hide"
role="alert"
aria-live="assertive"
aria-atomic="true"
>
<div class="toast-body text-center">
Copied!
</div>
</div>
</div>
</footer>
<!-- <script src="https://unpkg.com/vue@next"></script> -->
<script src="https://unpkg.com/[email protected]/dist/vue.global.prod.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="./script.js"></script>
</body>
</html>