Merge branch 'feature/FixShowSelectFilter' into dev

This commit is contained in:
JackDandy 2023-09-18 11:50:06 +01:00
commit 2170b1cc79
2 changed files with 27 additions and 1 deletions

View file

@ -10,6 +10,7 @@
* Fix regex that was not using py312 notation * Fix regex that was not using py312 notation
* Change sort backlog and manual segment search results episode number * Change sort backlog and manual segment search results episode number
* Change sort episodes when set to wanted on display show page * Change sort episodes when set to wanted on display show page
* Add search of grouped options in shows drop down at view-show
### 3.29.8 (2023-09-12 08:10:00 UTC) ### 3.29.8 (2023-09-12 08:10:00 UTC)

View file

@ -59,8 +59,33 @@ $(document).ready(function() {
} }
// `params.term` should be the term that is used for searching // `params.term` should be the term that is used for searching
// `data.text` is the text that is displayed for the data object
var param_term = params.term.toLowerCase().trim().replace(white_space_regex, ''); var param_term = params.term.toLowerCase().trim().replace(white_space_regex, '');
if ('undefined' !== typeof data.children) {
// `data.children` contains options to match against
var filteredChildren = [];
$.each(data.children, function (idx, child) {
// `child.text` is the text that is displayed for the data object
var param_data = child.text.toLowerCase().trim().replace(white_space_regex, '');
if (fuzzysearch(param_term, param_data)) {
filteredChildren.push(child);
}
});
// If any of the group's children match,
// then set the matched children on the group and return the group object
if (filteredChildren.length) {
var modifiedData = $.extend({}, data, true);
modifiedData.children = filteredChildren;
// You can return modified objects from here
// This includes matching the `children` how you want in nested data sets
return modifiedData;
}
}
// `data.text` is the text that is displayed for the data object
var param_data = data.text.toLowerCase().trim().replace(white_space_regex, ''); var param_data = data.text.toLowerCase().trim().replace(white_space_regex, '');
if (fuzzysearch(param_term, param_data)) { if (fuzzysearch(param_term, param_data)) {
var modifiedData = $.extend({}, data, true); var modifiedData = $.extend({}, data, true);