Change color of clearfilters button when filters are applied to give better feedback to user.

This commit is contained in:
Sj-Si 2024-05-24 09:25:26 -04:00
parent 4a2c806448
commit ecfa65f12a

View File

@ -461,11 +461,21 @@ class ExtraNetworksTab {
recurse = recurse === true || recurse === false ? recurse : false; recurse = recurse === true || recurse === false ? recurse : false;
this.card_list.addDirectoryFilter(div_id, filter_str, recurse); this.card_list.addDirectoryFilter(div_id, filter_str, recurse);
this.directory_filters[div_id] = {filter_str: filter_str, recurse: recurse}; this.directory_filters[div_id] = {filter_str: filter_str, recurse: recurse};
const btn = this.controls_elem.querySelector(".extra-network-control--clear-filters");
isElementThrowError(btn);
btn.dataset.selected = "";
} }
removeDirectoryFilter(div_id) { removeDirectoryFilter(div_id) {
this.card_list.removeDirectoryFilter(div_id); this.card_list.removeDirectoryFilter(div_id);
delete this.directory_filters[div_id]; delete this.directory_filters[div_id];
if (Object.keys(this.directory_filters).length === 0) {
const btn = this.controls_elem.querySelector(".extra-network-control--clear-filters");
isElementThrowError(btn);
delete btn.dataset.selected;
}
} }
clearDirectoryFilters({excluded_div_ids} = {}) { clearDirectoryFilters({excluded_div_ids} = {}) {
@ -1157,6 +1167,8 @@ function extraNetworksControlClearFiltersOnClick(event) {
tab.clearSelectedButtons(); tab.clearSelectedButtons();
tab.clearDirectoryFilters(); tab.clearDirectoryFilters();
tab.applyDirectoryFilters(); tab.applyDirectoryFilters();
delete btn.dataset.selected;
} }
function extraNetworksControlSortModeOnClick(event) { function extraNetworksControlSortModeOnClick(event) {