|
1 |
| -<!DOCTYPE html> |
| 1 | +<!doctype html> |
2 | 2 | <html>
|
3 | 3 | <head>
|
4 |
| - <title>------</title> |
| 4 | + <title>-----</title> |
5 | 5 | <link rel="shortcut icon" href="favicon.png" />
|
6 |
| - <style> |
7 |
| - hr { |
8 |
| - margin-top: 50vh; |
9 |
| - } |
10 |
| - </style> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + font-family: Roboto, sans-serif; |
| 10 | + font-weight: 500; |
| 11 | + } |
| 12 | + |
| 13 | + hr { |
| 14 | + margin-top: 33vh; |
| 15 | + margin-top: 33dvh; |
| 16 | + margin-bottom: calc(33vh - 20px); |
| 17 | + margin-bottom: calc(33dvh - 20px); |
| 18 | + } |
| 19 | + |
| 20 | + a { |
| 21 | + color: #fff; |
| 22 | + background-color: #1976d2; |
| 23 | + text-decoration: none; |
| 24 | + cursor: pointer; |
| 25 | + |
| 26 | + border-color: #1976d2; |
| 27 | + border-radius: 4px; |
| 28 | + box-shadow: |
| 29 | + 0 3px 1px -2px rgba(0, 0, 0, 0.2), |
| 30 | + 0 2px 2px 0 rgba(0, 0, 0, 0.14), |
| 31 | + 0 1px 5px 0 rgba(0, 0, 0, 0.12); |
| 32 | + padding: 8px; |
| 33 | + } |
| 34 | + |
| 35 | + .center { |
| 36 | + display: flex; |
| 37 | + justify-content: center; |
| 38 | + align-items: center; |
| 39 | + } |
| 40 | + |
| 41 | + #message-overlay { |
| 42 | + position: fixed; |
| 43 | + top: 0; |
| 44 | + left: 0; |
| 45 | + width: 100vw; |
| 46 | + width: 100dvw; |
| 47 | + height: 100vh; |
| 48 | + height: 100dvh; |
| 49 | + background-color: #fff; |
| 50 | + display: flex; |
| 51 | + justify-content: center; |
| 52 | + align-items: center; |
| 53 | + opacity: 0; |
| 54 | + visibility: hidden; |
| 55 | + } |
| 56 | + |
| 57 | + #message-overlay.fadeinout { |
| 58 | + animation: fadeinout 1.2s; |
| 59 | + } |
| 60 | + |
| 61 | + @keyframes fadeinout { |
| 62 | + 0, |
| 63 | + 100% { |
| 64 | + visibility: hidden; |
| 65 | + opacity: 0; |
| 66 | + } |
| 67 | + 33%, |
| 68 | + 66% { |
| 69 | + visibility: visible; |
| 70 | + opacity: 1; |
| 71 | + } |
| 72 | + } |
| 73 | + |
| 74 | + #message { |
| 75 | + font-size: 48px; |
| 76 | + color: #333; |
| 77 | + } |
| 78 | + </style> |
| 79 | + <script> |
| 80 | + function buildUrl(func) { |
| 81 | + const url = new URL(location.href); |
| 82 | + const params = url.searchParams; |
| 83 | + func(params); |
| 84 | + return url.toString(); |
| 85 | + } |
| 86 | + |
| 87 | + function generate() { |
| 88 | + const overlay = document.getElementById("message-overlay"); |
| 89 | + const handler = () => { |
| 90 | + overlay.removeEventListener("animationend", handler); |
| 91 | + overlay.classList.remove("fadeinout"); |
| 92 | + }; |
| 93 | + overlay.addEventListener("animationend", handler); |
| 94 | + overlay.classList.add("fadeinout"); |
| 95 | + |
| 96 | + history.pushState( |
| 97 | + {}, |
| 98 | + "", |
| 99 | + buildUrl((params) => { |
| 100 | + params.set("id", Math.floor(Math.random() * 1000000).toString()); |
| 101 | + params.delete("separator"); |
| 102 | + }), |
| 103 | + ); |
| 104 | + } |
| 105 | + </script> |
11 | 106 | </head>
|
12 | 107 | <body>
|
13 |
| - <hr> |
| 108 | + <hr /> |
| 109 | + |
| 110 | + <div class="center"> |
| 111 | + <a href="#" id="generate" onclick="generate(); return false" |
| 112 | + >New Separator</a |
| 113 | + > |
| 114 | + </div> |
| 115 | + |
| 116 | + <div id="message-overlay"> |
| 117 | + <p id="message">Generated!</p> |
| 118 | + </div> |
| 119 | + |
| 120 | + <script> |
| 121 | + (function () { |
| 122 | + const params = new URL(location.href).searchParams; |
| 123 | + const separator = params.get("separator"); |
| 124 | + if (separator) document.title = separator; |
| 125 | + if (params.has("separator")) document.title = params.get("separator"); |
| 126 | + document.getElementById("generate").href = buildUrl((params) => { |
| 127 | + params.set("id", "new"); |
| 128 | + if (separator) params.set("separator", separator); |
| 129 | + }); |
| 130 | + if (params.get("id") === "new") generate(); |
| 131 | + })(); |
| 132 | + </script> |
14 | 133 | </body>
|
15 | 134 | </html>
|
0 commit comments