fix: reset terminal prompt on back arrow
This commit is contained in:
parent
23e10d1d54
commit
6297fbfb91
4 changed files with 30 additions and 26 deletions
|
|
@ -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
27
scripts/index.js
Normal 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:~$ ";
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue