-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
134 lines (121 loc) · 3.17 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
<!doctype html>
<html>
<head>
<title>-----</title>
<link rel="shortcut icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-family: Roboto, sans-serif;
font-weight: 500;
}
hr {
margin-top: 33vh;
margin-top: 33dvh;
margin-bottom: calc(33vh - 20px);
margin-bottom: calc(33dvh - 20px);
}
a {
color: #fff;
background-color: #1976d2;
text-decoration: none;
cursor: pointer;
border-color: #1976d2;
border-radius: 4px;
box-shadow:
0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
padding: 8px;
}
.center {
display: flex;
justify-content: center;
align-items: center;
}
#message-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
width: 100dvw;
height: 100vh;
height: 100dvh;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
opacity: 0;
visibility: hidden;
}
#message-overlay.fadeinout {
animation: fadeinout 1.2s;
}
@keyframes fadeinout {
0,
100% {
visibility: hidden;
opacity: 0;
}
33%,
66% {
visibility: visible;
opacity: 1;
}
}
#message {
font-size: 48px;
color: #333;
}
</style>
<script>
function buildUrl(func) {
const url = new URL(location.href);
const params = url.searchParams;
func(params);
return url.toString();
}
function generate() {
const overlay = document.getElementById("message-overlay");
const handler = () => {
overlay.removeEventListener("animationend", handler);
overlay.classList.remove("fadeinout");
};
overlay.addEventListener("animationend", handler);
overlay.classList.add("fadeinout");
history.pushState(
{},
"",
buildUrl((params) => {
params.set("id", Math.floor(Math.random() * 1000000).toString());
params.delete("separator");
}),
);
}
</script>
</head>
<body>
<hr />
<div class="center">
<a href="#" id="generate" onclick="generate(); return false"
>New Separator</a
>
</div>
<div id="message-overlay">
<p id="message">Generated!</p>
</div>
<script>
(function () {
const params = new URL(location.href).searchParams;
const separator = params.get("separator");
if (separator) document.title = separator;
if (params.has("separator")) document.title = params.get("separator");
document.getElementById("generate").href = buildUrl((params) => {
params.set("id", "new");
if (separator) params.set("separator", separator);
});
if (params.get("id") === "new") generate();
})();
</script>
</body>
</html>