From 4a577e928a6c3b565a12939e03d2cee1fc083854 Mon Sep 17 00:00:00 2001 From: Alfie King Date: Fri, 20 Jun 2025 13:32:04 +0100 Subject: [PATCH] typer fix --- static/js/base.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/static/js/base.js b/static/js/base.js index 1c983a7..925c73e 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -20,12 +20,12 @@ const values = [ "Loud Music enjoyer", "part time femboy :<", ]; -var direction = 1; -var text = ""; -var speed = 100; -var selectedValue = 0; -var currentValueIndex = 0; -var pause = false; +let typing_direction = 1; +let text = ""; +let speed = 100; +let selectedValue = 0; +let currentValueIndex = 0; +let pause = false; function randomValue() { selectedValue = Math.floor(Math.random() * values.length); @@ -33,12 +33,12 @@ function randomValue() { } function type() { - if (direction == 1) { + if (typing_direction == 1) { if (currentValueIndex < values[selectedValue].length) { text += values[selectedValue][currentValueIndex]; currentValueIndex++; } else { - direction = -1; + typing_direction = -1; pause = true; } } else { @@ -46,7 +46,7 @@ function type() { text = text.slice(0, -1); currentValueIndex--; } else { - direction = 1; + typing_direction = 1; randomValue(); } } @@ -55,7 +55,7 @@ function type() { function typing() { type(); document.getElementById("typing").innerHTML = "$ " + text; - if (direction == 1) { + if (typing_direction == 1) { speed = 80 + Math.random() * 100; } else { speed = 60 + (Math.random() * 100) / 2; @@ -72,7 +72,7 @@ typing(); // HIDDEN STUFF (shh don't tell anyone >:3) -var last5Chars = ""; +let last5Chars = ""; document.addEventListener('keydown', function(event) { last5Chars += event.key;