From ff7873313b3eb72becaf8135d49abe010cc8ea75 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:59:40 -0500 Subject: [PATCH] [+] Check while typing --- AquaNet/src/app.sass | 6 +++++ AquaNet/src/components/BindCard.svelte | 33 ++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/AquaNet/src/app.sass b/AquaNet/src/app.sass index 9e7178d7..94e7cb7e 100644 --- a/AquaNet/src/app.sass +++ b/AquaNet/src/app.sass @@ -112,6 +112,12 @@ input.error justify-content: center align-items: center + +.inline-flex-center + display: inline-flex + justify-content: center + align-items: center + .clickable cursor: pointer user-select: none diff --git a/AquaNet/src/components/BindCard.svelte b/AquaNet/src/components/BindCard.svelte index f2af48a2..72985c99 100644 --- a/AquaNet/src/components/BindCard.svelte +++ b/AquaNet/src/components/BindCard.svelte @@ -16,8 +16,15 @@ inputAC = inputAC.slice(0, 24) } + function bindAC() { + if (inputACRegexFull.test(inputAC)) { + console.log("Binding access code", inputAC) + inputAC = "" + } + } + const inputSNRegex = /^([0-9A-Fa-f]{0,2}:){0,7}[0-9A-Fa-f]{0,2}$/ - const inputSNRegexFull = /^([0-9A-Fa-f]{2}:){7}[0-9A-Fa-f]{2}$/ + const inputSNRegexFull = /^([0-9A-Fa-f]{2}:){4,7}[0-9A-Fa-f]{2}$/ let inputSN = "" function inputSNChange(e: any) { @@ -27,6 +34,13 @@ inputSN += ":" inputSN = inputSN.toUpperCase().slice(0, 23) } + + function bindSN() { + if (inputSNRegexFull.test(inputSN)) { + console.log("Binding serial number", inputSN) + inputSN = "" + } + }
@@ -36,24 +50,35 @@

2. Download the NFC Tools app on your phone (Android / - Apple) and scan your card. Then, enter the Serial Number. + Apple) and scan your card. + Then, enter the Serial Number.