From ecb85e31f57cda98f867387c60bc5fe3fec9d115 Mon Sep 17 00:00:00 2001 From: MattTheTekie Date: Thu, 23 Apr 2026 18:23:07 -0400 Subject: [PATCH] chore: fixes --- legacy.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/legacy.html b/legacy.html index dea5c23..6fe259f 100644 --- a/legacy.html +++ b/legacy.html @@ -152,25 +152,25 @@ function showAbout(event) { return; } - const startImg = section.querySelector('img[src*="kirby19.gif"]'); + const img = section.querySelector('img[src*="kirby19.gif"]'); - if (!startImg) { + if (!img) { target.innerHTML = section.outerHTML; return; } - // Build a new container starting from Kirby - const newSection = document.createElement("div"); - newSection.id = "aboutSection"; + // Use Range to extract everything from Kirby onward properly + const range = document.createRange(); + range.setStartBefore(img); + range.setEndAfter(section.lastChild); - let node = startImg; + const fragment = range.cloneContents(); - while (node) { - newSection.appendChild(node.cloneNode(true)); - node = node.nextSibling; - } + const wrapper = document.createElement("div"); + wrapper.id = "aboutSection"; + wrapper.appendChild(fragment); - target.innerHTML = newSection.outerHTML; + target.innerHTML = wrapper.innerHTML; }) .catch(err => { console.error(err);