about summary refs log tree commit diff
path: root/script.js
diff options
context:
space:
mode:
authorgennyble <gen@nyble.dev>2023-06-18 18:22:20 -0500
committergennyble <gen@nyble.dev>2023-06-18 18:22:20 -0500
commitddb2ac6339cec6deb46ab5613717859f4909e772 (patch)
treee05382a4dfdc6e2394239568e8b8e6ddcde3ff06 /script.js
parent2600d94694c326fa450cb6d753401e70f18fb0e9 (diff)
downloadwednesdayle-ddb2ac6339cec6deb46ab5613717859f4909e772.tar.gz
wednesdayle-ddb2ac6339cec6deb46ab5613717859f4909e772.zip
it worksish
Diffstat (limited to 'script.js')
-rw-r--r--script.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/script.js b/script.js
index ea4bd12..54a5151 100644
--- a/script.js
+++ b/script.js
@@ -22,6 +22,9 @@ class Wednesdayle {
 		this.enter = document.getElementById('enter');
 		this.enter.addEventListener('click', this.submit.bind(this));
 
+		this.resetBtn = document.getElementById('reset');
+		this.resetBtn.addEventListener('click', this.reset.bind(this));
+
 		this.dropdown = document.getElementById('dropdown');
 		document.getElementById('close-dropdown').addEventListener('click', this.closeDropdown.bind(this));
 
@@ -66,15 +69,30 @@ class Wednesdayle {
 		for (let i = 0; i < this.boxes.length; ++i) {
 			if (word[i].toUpperCase() != this.boxes[i].innerText.toUpperCase()) {
 				this.notword.style.display = "block";
+				this.resetBtn.style.display = "block";
 				this.active = false;
 				return;
 			}
 		}
 
 		this.theword.style.display = "block";
+		this.resetBtn.style.display = "block";
 		this.active = false;
 	}
 
+	reset() {
+		console.log("sfa");
+		this.active = true;
+		for (let i = 0; i < this.boxes.length; ++i) {
+			this.boxes[i].innerText = '';
+		}
+		this.nextBox = 0;
+
+		this.theword.style.display = "none";
+		this.notword.style.display = "none";
+		this.resetBtn.style.display = "none";
+	}
+
 	buttonPush(event) {
 		if (!this.active) {
 			return;