From 394aa18e6c473481c7f7cf0ae6a6a8fcde2ebe97 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 9 Jan 2022 16:24:45 +0000 Subject: [PATCH] Adds min and max limits to all numerical fields This adds min and max limits to all numerical fields; if they use the data-setting method. This doesn't cover the old MSP fields. --- js/settings.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/settings.js b/js/settings.js index 148eb0036..f9080299b 100644 --- a/js/settings.js +++ b/js/settings.js @@ -71,6 +71,14 @@ var Settings = (function () { var multiplier = parseFloat(input.data('setting-multiplier') || 1); input.attr('type', 'number'); input.val((s.value / multiplier).toFixed(Math.log10(multiplier))); + + if (s.setting.min) { + input.attr('min', (s.setting.min / multiplier).toFixed(Math.log10(multiplier))); + } + + if (s.setting.max) { + input.attr('max', (s.setting.max / multiplier).toFixed(Math.log10(multiplier))); + } } // If data is defined, We want to convert this value into