fix: inline script

This commit is contained in:
Barrett Ruth 2024-06-07 22:31:28 -05:00
parent 4339ebe265
commit 653c4869ac
2 changed files with 23 additions and 22 deletions

View file

@ -48,6 +48,28 @@
<a target="_blank" href="mailto:br.barrettruth@gmail.com">Email</a>
</div>
</footer>
<script src="scripts/index.js"></script>
<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>
</body>
</html>

View file

@ -1,21 +0,0 @@
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();
}