diff --git a/legacy.html b/legacy.html index 8e40ba6..dea5c23 100644 --- a/legacy.html +++ b/legacy.html @@ -152,26 +152,25 @@ function showAbout(event) { return; } - // Find the element that contains kirby19.gif - const startEl = section.querySelector('img[src*="kirby19.gif"]'); + const startImg = section.querySelector('img[src*="kirby19.gif"]'); - if (startEl) { - // Remove everything BEFORE the Kirby image - let current = section.firstChild; - - while (current && current !== startEl) { - const next = current.nextSibling; - current.remove(); - current = next; - } - - // Now render from Kirby onward - target.innerHTML = section.outerHTML; - - } else { - // fallback: if image not found, show full section + if (!startImg) { target.innerHTML = section.outerHTML; + return; } + + // Build a new container starting from Kirby + const newSection = document.createElement("div"); + newSection.id = "aboutSection"; + + let node = startImg; + + while (node) { + newSection.appendChild(node.cloneNode(true)); + node = node.nextSibling; + } + + target.innerHTML = newSection.outerHTML; }) .catch(err => { console.error(err);