From 5582c0909c595320a0b52b422be6f7d64025cbc4 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Mon, 3 Mar 2025 18:42:37 +0000 Subject: [PATCH] Added binary decoding. --- index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fc2838f..9606abc 100644 --- a/index.html +++ b/index.html @@ -310,7 +310,15 @@ } function getName() { - const decoded = base32.decode(codeInput.value); + const input = codeInput.value.trim(); + + if (/^([01]{8}(\s|$))+/.test(input)) { + // decode binary + nameOutput.value = new TextDecoder().decode(new Int8Array(input.split(/\s+/).map((binaryLetter) => parseInt(binaryLetter, 2)))); + return; + } + + const decoded = base32.decode(input); const capitalized = decoded.split(' ').map((word) => `${word.slice(0, 1).toUpperCase()}${word.slice(1)}`).join(' '); nameOutput.value = capitalized.replace(/#+$/, '');