Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vertical Separator capability #2

Merged
merged 2 commits into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes
Binary file added favicon-vert.ico
Binary file not shown.
Binary file added favicon-vert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!doctype html>
<html>
<head>
<title>-----</title>
<link rel="shortcut icon" href="favicon.png" />
<title>⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯</title>
<link rel="shortcut icon" href="favicon-horiz.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
Expand Down Expand Up @@ -30,6 +30,7 @@
0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
padding: 8px;
margin-bottom: 10px;
}

.center {
Expand Down Expand Up @@ -105,14 +106,21 @@
</script>
</head>
<body>
<h1>Horizontal Separator</h1>

<hr />

<div class="center">
<a href="#" id="generate" onclick="generate(); return false"
>New Separator</a
>
<a href="#" id="generate" onclick="generate(); return false">
New Horizontal Separator</a>
</div>
<div class="center">
<a href="vertical.html?id=new">
New Vertical Separator
</a>
</div>


<div id="message-overlay">
<p id="message">Generated!</p>
</div>
Expand Down
142 changes: 142 additions & 0 deletions vertical.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<!doctype html>
<html>
<head>
<title></title>
<link rel="shortcut icon" href="favicon-vert.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;
margin-bottom: 10px;
}

.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>
<h1>Vertical Separator</h1>

<hr />

<div class="center">
<a href="#" id="generate" onclick="generate(); return false">
New Vertical Separator
</a>
</div>
<div class="center">
<a href="index.html?id=new">
New Horizontal 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>