From 6e820a255eac0451a6430487cf6cd71168c6d18d Mon Sep 17 00:00:00 2001 From: Tony Lea Date: Fri, 29 Sep 2023 13:33:45 -0400 Subject: [PATCH] Adding latest updates to static main --- assets/js/main.js | 15 +++++++++------ layouts/main.html | 12 ++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index b74db99..cc7e586 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -285,20 +285,23 @@ document.addEventListener('htmx:afterSwap', function(evt) { loadGsapAnimations(); createRadialBackgrounds(); window.dispatchEvent(new CustomEvent('set-route', { detail: { route: evt.detail.pathInfo.requestPath } })); +// updateTOC(); }, 10); }); -// document.addEventListener('htmx:afterSettle', function(evt) { -// setTimeout(function(){ -// updateTOC(); -// }, 10); -// }); +document.addEventListener('htmx:afterSettle', function(evt) { + setTimeout(function(){ + updateTOC(); + }, 500); +}); function updateTOC(){ if(document.getElementById('table-of-contents')){ - window.dispatchEvent(new CustomEvent('set-toc', { detail: { toc: JSON.parse(localStorage.getItem('toc')) } })); + setTimeout(function(){ + window.dispatchEvent(new CustomEvent('set-toc', { detail: { toc: window.toc } })); + }); } } diff --git a/layouts/main.html b/layouts/main.html index fd18137..1cb5633 100644 --- a/layouts/main.html +++ b/layouts/main.html @@ -154,12 +154,12 @@