aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2024-10-25 00:00:00 +0000
committertdro <tdro@noreply.example.com>2024-10-25 00:00:00 +0000
commit2552497d91b01be75de080d7b3321566cfb6a619 (patch)
treedc1f0d978b54742edbf6c1446b82ea5aefa8b48a
parent3e556a06cde9ba1844fb67e153d2dccf5df65458 (diff)
downloadcanory-2552497d91b01be75de080d7b3321566cfb6a619.tar.gz
canory-2552497d91b01be75de080d7b3321566cfb6a619.tar.bz2
canory-2552497d91b01be75de080d7b3321566cfb6a619.zip
static/js/domfilter: Always persist
-rw-r--r--assets/js/index.js5
-rw-r--r--static/js/domfilter.ts5
2 files changed, 6 insertions, 4 deletions
diff --git a/assets/js/index.js b/assets/js/index.js
index b415a23..d82870e 100644
--- a/assets/js/index.js
+++ b/assets/js/index.js
@@ -788,11 +788,12 @@
document.head.appendChild(persist);
}
self.addEventListener("DOMContentLoaded", function() {
- if (localStorage[key] !== state) return;
+ if (!localStorage[key] || localStorage[key] === state) return;
persist();
});
self.addEventListener("popstate", function(event) {
- if (!localStorage[key] || localStorage[key] === state || !document.querySelector('link[rel="location"]')) return;
+ if (!localStorage[key] || localStorage[key] === state) return;
+ persist();
const link = JSON.parse(document.querySelector('link[rel="location"]').target);
const url = event.target.location;
const hashed = link.pathname === url.pathname;
diff --git a/static/js/domfilter.ts b/static/js/domfilter.ts
index e0b6cdc..71d583e 100644
--- a/static/js/domfilter.ts
+++ b/static/js/domfilter.ts
@@ -92,12 +92,13 @@
}
self.addEventListener("DOMContentLoaded", function () {
- if (localStorage[key] !== state) return;
+ if (!localStorage[key] || localStorage[key] === state) return;
persist();
});
self.addEventListener("popstate", function (event) {
- if (!localStorage[key] || localStorage[key] === state || !document.querySelector('link[rel="location"]')) return;
+ if (!localStorage[key] || localStorage[key] === state) return;
+ persist();
const link = JSON.parse(document.querySelector('link[rel="location"]').target);
const url = event.target.location;
const hashed = link.pathname === url.pathname;