fix: handle multiple clicks on typing animations;
This commit is contained in:
parent
1cb8e8ab2c
commit
2571771f70
4 changed files with 32 additions and 2 deletions
|
|
@ -8,7 +8,7 @@
|
||||||
<link rel="icon" type="image/webp" href="/public/logo.webp" />
|
<link rel="icon" type="image/webp" href="/public/logo.webp" />
|
||||||
<title>Barrett Ruth</title>
|
<title>Barrett Ruth</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="graph">
|
||||||
<header>
|
<header>
|
||||||
<a href="/" onclick="refresh(event)">
|
<a href="/" onclick="refresh(event)">
|
||||||
<div class="terminal-prompt">
|
<div class="terminal-prompt">
|
||||||
|
|
|
||||||
16
posts/from-github-pages-to-aws.html
Normal file
16
posts/from-github-pages-to-aws.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<link rel="stylesheet" href="../styles/index.css" />
|
||||||
|
<link rel="icon" type="image/webp" href="../public/logo.webp" />
|
||||||
|
<title>Barrett Ruth</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main class="main">main</main>
|
||||||
|
<footer>foot</footer>
|
||||||
|
<script src="../scripts/index.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -62,14 +62,25 @@ function renderPosts(topic) {
|
||||||
postMapping.get(topic).forEach((postName) => {
|
postMapping.get(topic).forEach((postName) => {
|
||||||
const post = document.createElement("div");
|
const post = document.createElement("div");
|
||||||
post.classList.add("post");
|
post.classList.add("post");
|
||||||
post.textContent = postName;
|
|
||||||
|
const link = document.createElement("a");
|
||||||
|
post.classList.add("post");
|
||||||
|
link.href = `/posts/${postName.replace(/\s+/g, "-").toLowerCase()}.html`;
|
||||||
|
link.textContent = postName;
|
||||||
|
|
||||||
|
post.appendChild(link);
|
||||||
posts.appendChild(post);
|
posts.appendChild(post);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let typing = false;
|
||||||
|
|
||||||
function typechars(e) {
|
function typechars(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
if (typing) return;
|
||||||
|
typing = true;
|
||||||
|
|
||||||
const topic = e.target.textContent;
|
const topic = e.target.textContent;
|
||||||
const terminalText = ` ${topic.toLowerCase()}/`;
|
const terminalText = ` ${topic.toLowerCase()}/`;
|
||||||
const terminalPrompt = document.querySelector(".prompt");
|
const terminalPrompt = document.querySelector(".prompt");
|
||||||
|
|
@ -84,6 +95,7 @@ function typechars(e) {
|
||||||
setTimeout(typechar, delay / terminalText.length);
|
setTimeout(typechar, delay / terminalText.length);
|
||||||
} else {
|
} else {
|
||||||
renderPosts(topic);
|
renderPosts(topic);
|
||||||
|
typing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.graph {
|
||||||
background-image: linear-gradient(
|
background-image: linear-gradient(
|
||||||
to right,
|
to right,
|
||||||
rgba(200, 200, 200, 0.4) 1px,
|
rgba(200, 200, 200, 0.4) 1px,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue