From 145e7e05f3aa6adbc71a0db5e7da160e626bacd3 Mon Sep 17 00:00:00 2001 From: SayaAndy Date: Sun, 31 Aug 2025 18:12:51 +0700 Subject: feat: seamless single page application --- views/pages/blog-catalogue.html | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'views/pages/blog-catalogue.html') diff --git a/views/pages/blog-catalogue.html b/views/pages/blog-catalogue.html index ac2fb7d..a5f5256 100644 --- a/views/pages/blog-catalogue.html +++ b/views/pages/blog-catalogue.html @@ -98,6 +98,7 @@ function cleanHrefParams() { const url = new URL(window.location.href); url.search = ''; + window.history.pushState({}, '', url.toString()); } @@ -137,22 +138,27 @@ window.history.pushState({}, '', url.toString()); } - document.addEventListener('DOMContentLoaded', contextAll); - + document.addEventListener('htmx:afterRequest', (e) => { + if (e.detail.xhr.status == 404 || e.detail.successful != true) { + return console.error(e); + } + if (e.detail.target.id == 'general-page-body') { + contextAll(); - {{ end }} -- cgit v1.3.1+13