add shortcut for certain filters

This commit is contained in:
rhiannon morris 2024-07-07 22:05:08 +02:00
parent d93e38b618
commit f2aeb8e187

View file

@ -116,11 +116,19 @@ function useFragment() {
allBoxes.forEach(b => b.checked = false);
details.open = false;
} else {
const set = new Set(frag.split(';'));
const pieces =
frag == 'summary' ? ['require_artsummary', 'hide_filters'] :
frag == 'colourexamples' ? ['require_colourexample', 'hide_filters'] :
frag == 'flatexamples' ? ['require_flatexample', 'hide_filters'] :
frag == 'sketchexamples' ? ['require_sketchexample', 'hide_filters'] :
frag == 'iconexamples' ? ['require_iconexample', 'hide_filters'] :
frag == 'curated' ? ['require_curated', 'hide_filters'] :
frag.split(';');
const set = new Set(pieces);
const re = /^(require|exclude)_|hide_filters/;
if (Array.from(set).every(x => re.test(x))) {
if (pieces.every(x => re.test(x))) {
allBoxes.forEach(b => b.checked = set.has(b.id));
details.open = !frag.match(/hide_filters|example\b/);
// details.open = !set.has('hide_filters');
}
}