Skip to content

Commit

Permalink
unbork cb76e3d: url filter in manager
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Sep 10, 2023
1 parent 7283df8 commit c43acb8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions manage/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ const fltModePref = 'manage.searchMode';
let elSearch, elSearchMode;

router.watch({search: [fltSearch, fltMode]}, ([search, mode]) => {
if (!elSearch) initFilters();
const firstRun = !elSearch;
if (firstRun) initFilters();
elSearch.value = search || '';
if (mode || elSearchMode.value === 'url') {
elSearchMode.value = mode || prefs.get(fltModePref);
}
searchStyles();
if (firstRun) filterOnChange({forceRefilter: true});
else searchStyles();
});

function initFilters() {
Expand Down Expand Up @@ -122,8 +124,6 @@ function initFilters() {
filterOnChange({forceRefilter: true});
router.updateSearch({[fltSearch]: '', [fltMode]: ''});
};

filterOnChange({forceRefilter: true});
}

function filterOnChange({target: el, forceRefilter, alreadySearched}) {
Expand Down
13 changes: 12 additions & 1 deletion manage/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,18 @@ async function initBadFavs() {
else el.append(opt);
}
el.value = value;
if (init) hideOpts.call(el);
if (init) {
const d = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), 'value');
Object.defineProperty(el, 'value', {
get: () => d.get.call(el),
set: val => {
showOpts.call(el, {});
d.set.call(el, val);
el.dispatchEvent(new Event('input', {bubbles: true}));
},
});
hideOpts.call(el);
}
};
}

Expand Down

0 comments on commit c43acb8

Please sign in to comment.