From 069a65ab716aa302dff6cc7cd487e63eb02549bd Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Sun, 16 Aug 2020 11:29:56 +0200 Subject: [PATCH] always open filters when popping state --- script/gallery.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/gallery.js b/script/gallery.js index 72cf12e..8399a75 100644 --- a/script/gallery.js +++ b/script/gallery.js @@ -80,7 +80,7 @@ function makeFragment() { } } -function useFragment(firstLoad) { +function useFragment() { let frag = location.hash.replace(/^#/, ''); if (frag == 'all') { @@ -88,7 +88,7 @@ function useFragment(firstLoad) { } else if (frag) { let set = new Set(frag.split(';')); allBoxes.forEach(b => b.checked = set.has(b.id)); - if (firstLoad) document.getElementById('filters-details').open = true; + document.getElementById('filters-details').open = true; } else { resetForm(); } @@ -112,9 +112,9 @@ function setup() { document.getElementById('clear').addEventListener('click', clear); document.getElementById('reset').addEventListener('click', reset); - window.addEventListener('popstate', () => useFragment(false)); + window.addEventListener('popstate', useFragment); - useFragment(true); + useFragment(); } window.addEventListener('DOMContentLoaded', setup);