1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-15 20:35:19 +03:00

Couple of improvements

- better handling of negative numbers
- improved regex pattern
- limits to min and max values
This commit is contained in:
Darren Lines 2022-10-17 19:45:19 +01:00
parent 43b69d434a
commit 30317ede79
2 changed files with 24 additions and 7 deletions

14
main.js
View file

@ -651,8 +651,18 @@ String.prototype.format = function () {
function padZeros(val, length) {
let str = val.toString();
return str.length < length ? padZeros("0" + str, length) : str;
};
if (str.length < length) {
if (str.charAt(0) === '-') {
str = "-0" + str.substring(1);
str = padZeros(str, length);
} else {
str = padZeros("0" + str, length);
}
}
return str;
}
function updateActivatedTab() {
var activeTab = $('#tabs > ul li.active');