mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-24 08:45:28 +03:00
Add search to osd elements list (#4416)
This commit is contained in:
parent
5adb12a8c8
commit
4a6ee1a3d9
3 changed files with 21 additions and 0 deletions
|
@ -31,6 +31,9 @@
|
|||
"noticeTitle": {
|
||||
"message": "Notice"
|
||||
},
|
||||
"search": {
|
||||
"message": "Search"
|
||||
},
|
||||
"dontShowAgain": {
|
||||
"message": "Don't show again"
|
||||
},
|
||||
|
|
|
@ -307,6 +307,9 @@
|
|||
margin-top: 5px;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
.elements-search-field {
|
||||
margin: 0 0 5px 0.5rem;
|
||||
}
|
||||
}
|
||||
.switchable-field-flex {
|
||||
display: flex;
|
||||
|
|
|
@ -3265,6 +3265,21 @@ osd.initialize = function (callback) {
|
|||
insertOrdered($displayFields, $field);
|
||||
}
|
||||
|
||||
// Add the search field and its functionality
|
||||
$("#element-fields").prepend(
|
||||
$(
|
||||
`<em class="fas fa-search" style="margin-left:3px"></em>
|
||||
<input type="text" class="elements-search-field" placeholder="${i18n.getMessage("search")}" />`,
|
||||
),
|
||||
);
|
||||
$(".elements-search-field").on("input", function () {
|
||||
const searchTerm = $(this).val().toLowerCase();
|
||||
$(".switchable-field").each(function () {
|
||||
const fieldName = $(this).find("label").text().toLowerCase();
|
||||
$(this).toggle(fieldName.includes(searchTerm));
|
||||
});
|
||||
});
|
||||
|
||||
GUI.switchery();
|
||||
// buffer the preview
|
||||
OSD.data.preview = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue