Skip to content

Commit

Permalink
Adds min and max limits to all numerical fields
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MrD-RC committed Jan 9, 2022
1 parent 02ea424 commit 394aa18
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 394aa18

Please sign in to comment.