diff --git a/src/components/FastNav.astro b/src/components/FastNav.astro index c3ebcecc..40b2d613 100644 --- a/src/components/FastNav.astro +++ b/src/components/FastNav.astro @@ -118,29 +118,6 @@ oldToc.innerHTML = newToc.innerHTML; } - // Swap API right panel (for API pages with two-column layout) - var newRight = doc.getElementById('api-right-panel'); - var oldRight = document.getElementById('api-right-panel'); - if (newRight && oldRight) { - oldRight.innerHTML = newRight.innerHTML; - } - // Also move any new .apg-right-panel into the aside - var newApgRight = document.querySelector('article .apg-right-panel'); - if (newApgRight && oldRight) { - oldRight.innerHTML = ''; - oldRight.appendChild(newApgRight); - newApgRight.style.display = 'block'; - } - - // Re-run inline scripts from the new content (ApiPlayground JS) - var newScripts = doc.querySelectorAll('article script, .apg-right-panel script'); - newScripts.forEach(function(oldScript) { - var newScript = document.createElement('script'); - newScript.textContent = oldScript.textContent; - document.body.appendChild(newScript); - document.body.removeChild(newScript); - }); - // Update document title var newTitle = doc.querySelector('title'); if (newTitle) document.title = newTitle.textContent; @@ -152,6 +129,31 @@ oldSidebar.innerHTML = newSidebar.innerHTML; } + // Re-execute inline scripts in swapped article + // (innerHTML doesn't execute