fix: reset terminal prompt on back arrow

This commit is contained in:
Barrett Ruth 2024-06-08 13:56:32 -05:00
parent 23e10d1d54
commit 6297fbfb91
4 changed files with 30 additions and 26 deletions

View file

@ -101,7 +101,7 @@ a {
}
.topics {
font-size: 2.5em;
font-size: 3em;
}
.software a:hover {

View file

@ -46,28 +46,6 @@
<a target="_blank" href="mailto:br.barrettruth@gmail.com">Email</a>
</div>
</footer>
<script>
function typechars(e, url = "wip.html") {
e.preventDefault();
const text = ` ${e.target.textContent.toLowerCase()}/`;
const terminalPrompt = document.querySelector(".prompt");
let i = 0;
function typechar() {
if (i < text.length) {
terminalPrompt.innerHTML += text.charAt(i);
i++;
setTimeout(typechar, 1000 / text.length);
} else {
setTimeout(() => {
window.location.href = url;
}, 500);
}
}
typechar();
}
</script>
<script src="index.js"></script>
</body>
</html>

View file

@ -5,5 +5,4 @@ aws s3 sync . s3://barrettruth.com --delete \
--exclude ".github/*" \
--exclude "readme.md" \
--exclude ".DS_Store" \
--exclude ".gitignore" \
--exclude "scripts/*"
--exclude ".gitignore"

27
scripts/index.js Normal file
View file

@ -0,0 +1,27 @@
function typechars(e, url = "wip.html") {
e.preventDefault();
const text = ` ${e.target.textContent.toLowerCase()}/`;
const terminalPrompt = document.querySelector(".prompt");
let i = 0;
function typechar() {
if (i < text.length) {
terminalPrompt.innerHTML += text.charAt(i);
i++;
setTimeout(typechar, 1000 / text.length);
} else {
setTimeout(() => {
window.location.href = url;
}, 500);
}
}
typechar();
}
window.addEventListener("beforeunload", () => {
const terminalPrompt = document.querySelector(".prompt");
terminalPrompt.innerHTML = "barrett@ruth:~$ ";
});