mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 06:24:01 -06:00
Make printer model search more flexible (#9050)
The printer model search can be hard to use, depending on how profiles are named. This makes it a little easier by matching on both the vendor and model name, and tokenizing the query and matching all of the tokens, instead of trying to find the whole query substring in the model name.
This commit is contained in:
parent
41450b3a64
commit
108eeaed0a
2 changed files with 8 additions and 4 deletions
|
@ -216,14 +216,16 @@ function FilterModelList(keyword) {
|
|||
|
||||
let nTotal = pModel.length;
|
||||
let ModelHtml = {};
|
||||
let kwSplit = keyword.toLowerCase().match(/\S+/g) || [];
|
||||
|
||||
$('#Content').empty();
|
||||
for (let n = 0; n < nTotal; n++) {
|
||||
let OneModel = pModel[n];
|
||||
|
||||
let strVendor = OneModel['vendor'];
|
||||
let ModelName = OneModel['model'];
|
||||
if (ModelName.toLowerCase().indexOf(keyword.toLowerCase()) == -1)
|
||||
let search = (OneModel['model'] + '\0' + strVendor).toLowerCase();
|
||||
|
||||
if (!kwSplit.every(s => search.includes(s)))
|
||||
continue;
|
||||
|
||||
//Add Vendor Html Node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue