This commit is contained in:
Rhiannon Morris 2022-01-05 16:10:19 +01:00
parent e1718bb861
commit df0190c950

View file

@ -95,15 +95,18 @@ function makeFragment() {
function useFragment() { function useFragment() {
let frag = decodeURIComponent(location.hash).replace(/^#/, ''); let frag = decodeURIComponent(location.hash).replace(/^#/, '');
let details = document.getElementById('filters-details');
if (frag == 'all' || !frag) { if (!frag) {
clearForm(); clearForm();
} else if (frag == 'all') {
allBoxes.forEach(b => b.checked = false);
details.open = false;
} else { } else {
let set = new Set(frag.split(';')); let set = new Set(frag.split(';'));
let re = /^(require|exclude)_|hide_filters/; let re = /^(require|exclude)_|hide_filters/;
if (new Array(...set).every(x => re.test(x))) { if (Array.from(set).every(x => re.test(x))) {
allBoxes.forEach(b => b.checked = set.has(b.id)); allBoxes.forEach(b => b.checked = set.has(b.id));
let details = document.getElementById('filters-details');
details.open = !set.has('hide_filters'); details.open = !set.has('hide_filters');
} }
} }