mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Move unknown OSD elements to the end of the list
This commit is contained in:
parent
095c98e838
commit
c9793132ef
1 changed files with 16 additions and 12 deletions
|
@ -1065,7 +1065,7 @@ OSD.constants = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
UNKNOWN_DISPLAY_FIELD: {
|
UNKNOWN_DISPLAY_FIELD: {
|
||||||
name: 'UNKNOWN_',
|
name: 'UNKNOWN',
|
||||||
text: 'osdTextElementUnknown',
|
text: 'osdTextElementUnknown',
|
||||||
desc: 'osdDescElementUnknown',
|
desc: 'osdDescElementUnknown',
|
||||||
default_position: -1,
|
default_position: -1,
|
||||||
|
@ -1813,7 +1813,7 @@ OSD.msp = {
|
||||||
ignoreSize = true;
|
ignoreSize = true;
|
||||||
}
|
}
|
||||||
d.display_items.push($.extend({
|
d.display_items.push($.extend({
|
||||||
name: suffix ? c.name + suffix : c.name,
|
name: c.name,
|
||||||
text: suffix ? [c.text, suffix] : c.text,
|
text: suffix ? [c.text, suffix] : c.text,
|
||||||
desc: c.desc,
|
desc: c.desc,
|
||||||
index: j,
|
index: j,
|
||||||
|
@ -2354,17 +2354,21 @@ TABS.osd.initialize = function (callback) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert in alphabetical order
|
// Insert in alphabetical order, with unknown fields at the end
|
||||||
let added = false;
|
if (field.name == OSD.constants.UNKNOWN_DISPLAY_FIELD.name) {
|
||||||
$displayFields.children().each(function() {
|
|
||||||
if ($(this).text().localeCompare($field.text(), i18n.getCurrentLocale(), { sensitivity: 'base' }) > 0) {
|
|
||||||
$(this).before($field);
|
|
||||||
added = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(!added) {
|
|
||||||
$displayFields.append($field);
|
$displayFields.append($field);
|
||||||
|
} else {
|
||||||
|
let added = false;
|
||||||
|
$displayFields.children().each(function() {
|
||||||
|
if ($(this).text().localeCompare($field.text(), i18n.getCurrentLocale(), { sensitivity: 'base' }) > 0) {
|
||||||
|
$(this).before($field);
|
||||||
|
added = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(!added) {
|
||||||
|
$displayFields.append($field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue