-
Notifications
You must be signed in to change notification settings - Fork 0
/
uuid.html
91 lines (75 loc) · 2.31 KB
/
uuid.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>UUIDs</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script src="copy.js"></script>
<style>
code {
margin: 0.25em 0;
vertical-align: middle;
font-size: 1.3em;
}
code:first-of-type {
margin-top: 1em;
}
section {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
#v4::before { content: "v4" }
#v6::before { content: "v6" }
#v4::before, #v6::before {
font-family: sans-serif;
font-size: 0.9em;
background: light-dark(#f1f1f1, #2b2b33);
border-radius: 7px;
vertical-align: middle;
padding: 7px;
margin-right: 0.25em;
}
</style>
</head>
<body>
<header>
<h1><a href="index.html">Tools</a></h1>
</header>
<main>
<header class="bar">
<h2>UUIDs</h2>
<button onclick="regenerate()">Regenerate</button>
</header>
<noscript>
<p class="placeholder-text">This tool requires Javascript to work.</p>
</noscript>
<section>
<code onclick="copy(event)" id="v4" hidden></code>
<code onclick="copy(event)" id="v6" hidden></code>
</section>
</main>
<script type="module">
import { v4, v6 } from 'https://unpkg.com/[email protected]/dist/esm-browser/index.js';
document.getElementById("v4").style.display = "block";
document.getElementById("v6").style.display = "block";
function generate() {
try {
document.getElementById("v4").innerText = self.crypto.randomUUID();
document.getElementById("v6").innerText = v6();
} catch {
document.getElementById("v4").innerText = v4();
document.getElementById("v6").innerText = v6();
}
}
// Expose on the window
window.regenerate = generate;
// Run first time :)
generate();
</script>
<script src="//instant.page/5.2.0" type="module" integrity="sha384-jnZyxPjiipYXnSU0ygqeac2q7CVYMbh84q0uHVRRxEtvFPiQYbXWUorga2aqZJ0z"></script>
</body>
</html>