From 73b4ce5f664582d9b7b974c7b9287b5725836dd1 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Tue, 18 Oct 2022 03:47:49 +0000 Subject: [PATCH] Finish implementation of custom disable buttons --- client/src/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/client/src/index.ts b/client/src/index.ts index 836bede..0fe7faf 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -95,7 +95,15 @@ function setUnit(unit: string) { } function disableCustom() { - showEnable(false, false) + const durationString = (document.getElementById('disable-duration') as HTMLInputElement).value + const unitInput = document.getElementById('unit') as HTMLInputElement + let modifier = 0 + if (unitInput.value === 'minutes') { + modifier = 1 + } else if (unitInput.value === 'hours') { + modifier = 2 + } + disable(Math.pow(60, modifier) * Number.parseInt(durationString)) } function animateLogo(animate: boolean) { @@ -128,6 +136,8 @@ function showEnable(show: boolean, showCustom?: boolean) { disableCustom.classList.add('visible') disableCustom.classList.remove('hidden') }, 250) + } else { + disableCustom.classList.replace('visible', 'hidden') } } }