chore: fixes
This commit is contained in:
parent
2c09dbd6cd
commit
ecb85e31f5
1 changed files with 11 additions and 11 deletions
22
legacy.html
22
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue