mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 00:35:26 +03:00
Language sort optionslist at power tab (#3177)
Sort 2 tabs using sortSelect
This commit is contained in:
parent
483dec9103
commit
6e88558744
2 changed files with 12 additions and 10 deletions
|
@ -172,7 +172,7 @@ power.initialize = function (callback) {
|
||||||
$("#calibrationmanagercontent").hide();
|
$("#calibrationmanagercontent").hide();
|
||||||
$("#calibrationmanagerconfirmcontent").hide();
|
$("#calibrationmanagerconfirmcontent").hide();
|
||||||
|
|
||||||
// battery
|
// battery
|
||||||
const templateBatteryState = $('#tab-power-templates .battery-state .battery-state');
|
const templateBatteryState = $('#tab-power-templates .battery-state .battery-state');
|
||||||
const destinationBatteryState = $('.tab-power .battery-state');
|
const destinationBatteryState = $('.tab-power .battery-state');
|
||||||
const elementBatteryState = templateBatteryState.clone();
|
const elementBatteryState = templateBatteryState.clone();
|
||||||
|
@ -199,6 +199,7 @@ power.initialize = function (callback) {
|
||||||
|
|
||||||
const haveFc = FC.CONFIG.boardType === 0 || FC.CONFIG.boardType === 2;
|
const haveFc = FC.CONFIG.boardType === 0 || FC.CONFIG.boardType === 2;
|
||||||
|
|
||||||
|
// fill voltage
|
||||||
const batteryMeterTypes = [
|
const batteryMeterTypes = [
|
||||||
i18n.getMessage('powerBatteryVoltageMeterTypeNone'),
|
i18n.getMessage('powerBatteryVoltageMeterTypeNone'),
|
||||||
i18n.getMessage('powerBatteryVoltageMeterTypeAdc'),
|
i18n.getMessage('powerBatteryVoltageMeterTypeAdc'),
|
||||||
|
@ -208,11 +209,11 @@ power.initialize = function (callback) {
|
||||||
batteryMeterTypes.push(i18n.getMessage('powerBatteryVoltageMeterTypeEsc'));
|
batteryMeterTypes.push(i18n.getMessage('powerBatteryVoltageMeterTypeEsc'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let batteryMeterType_e = $('select.batterymetersource');
|
let batteryMeterType_e = $('#batterymetersourceSelect');
|
||||||
|
|
||||||
for (let i = 0; i < batteryMeterTypes.length; i++) {
|
for (let i = 0; i < batteryMeterTypes.length; i++) {
|
||||||
batteryMeterType_e.append(`<option value="${i}">${batteryMeterTypes[i]}</option>`);
|
batteryMeterType_e.append(new Option(batteryMeterTypes[i], i));
|
||||||
}
|
}
|
||||||
|
batteryMeterType_e.sortSelect(batteryMeterTypes[0]);
|
||||||
|
|
||||||
// fill current
|
// fill current
|
||||||
const currentMeterTypes = [
|
const currentMeterTypes = [
|
||||||
|
@ -226,11 +227,11 @@ power.initialize = function (callback) {
|
||||||
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
|
currentMeterTypes.push(i18n.getMessage('powerBatteryCurrentMeterTypeMsp'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentMeterType_e = $('select.currentmetersource');
|
let currentMeterType_e = $('#currentmetersourceSelect');
|
||||||
|
|
||||||
for (let i = 0; i < currentMeterTypes.length; i++) {
|
for (let i = 0; i < currentMeterTypes.length; i++) {
|
||||||
currentMeterType_e.append(`<option value="${i}">${currentMeterTypes[i]}</option>`);
|
currentMeterType_e.append(new Option(currentMeterTypes[i], i));
|
||||||
}
|
}
|
||||||
|
currentMeterType_e.sortSelect(currentMeterTypes[0]);
|
||||||
|
|
||||||
updateDisplay(FC.VOLTAGE_METER_CONFIGS, FC.CURRENT_METER_CONFIGS);
|
updateDisplay(FC.VOLTAGE_METER_CONFIGS, FC.CURRENT_METER_CONFIGS);
|
||||||
|
|
||||||
|
@ -462,10 +463,11 @@ power.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_html() {
|
function process_html() {
|
||||||
initDisplay();
|
|
||||||
// translate to user-selected language
|
// translate to user-selected language
|
||||||
i18n.localizePage();
|
i18n.localizePage();
|
||||||
|
|
||||||
|
initDisplay();
|
||||||
|
|
||||||
GUI.content_ready(callback);
|
GUI.content_ready(callback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -139,13 +139,13 @@
|
||||||
<div class="battery-configuration">
|
<div class="battery-configuration">
|
||||||
<div class="select vbatmonitoring">
|
<div class="select vbatmonitoring">
|
||||||
<label>
|
<label>
|
||||||
<select class="batterymetersource"><!-- list generated here --></select>
|
<select id="batterymetersourceSelect" class="batterymetersource"><!-- list generated here --></select>
|
||||||
<span i18n="powerBatteryVoltageMeterSource"></span>
|
<span i18n="powerBatteryVoltageMeterSource"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="select currentMonitoring">
|
<div class="select currentMonitoring">
|
||||||
<label>
|
<label>
|
||||||
<select class="currentmetersource"><!-- list generated here --></select>
|
<select id="currentmetersourceSelect" class="currentmetersource"><!-- list generated here --></select>
|
||||||
<span i18n="powerBatteryCurrentMeterSource"></span>
|
<span i18n="powerBatteryCurrentMeterSource"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue