From 928b21beb768bca2bab93a0d0f896f027b45de25 Mon Sep 17 00:00:00 2001 From: Mango0x45 Date: Fri, 5 Feb 2021 23:56:46 +0100 Subject: Less ugly if statement --- main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index d1d5ed1..88704e8 100644 --- a/main.js +++ b/main.js @@ -60,18 +60,18 @@ function copy_mod_message() * frame fields */ function check_fps(event) { - if (event.target.value === "" || parseInt(event.target.value) <= 0 - || isNaN(parseInt(event.target.value))) { + fps = event.target.value; + if (fps > 0 && fps % 1 == fps) { + document.getElementById("startobj").disabled = false; + document.getElementById("endobj").disabled = false; + document.getElementById("compute_button").disabled = false; + } else { document.getElementById("framerate") .setCustomValidity("Please enter a valid framerate."); document.getElementById("framerate").reportValidity(); document.getElementById("startobj").disabled = true; document.getElementById("endobj").disabled = true; document.getElementById("compute_button").disabled = true; - } else { - document.getElementById("startobj").disabled = false; - document.getElementById("endobj").disabled = false; - document.getElementById("compute_button").disabled = false; } } -- cgit v1.2.3