chore: fixes

This commit is contained in:
MattTheTekie 2026-04-24 11:42:20 -04:00
commit 4500bcfc37

View file

@ -97,6 +97,20 @@
<!-- PAGE SYSTEM -->
<script>
/* -------------------------
SAFE HELPER (no querySelector)
-------------------------- */
function getElementByIdSafe(root, id) {
var all = root.getElementsByTagName("*");
for (var i = 0; i < all.length; i++) {
if (all[i].id === id) return all[i];
}
return null;
}
/* -------------------------
HOME
-------------------------- */
function showHome(event) {
if (event) event.preventDefault();
@ -112,6 +126,9 @@ function showHome(event) {
'</center>';
}
/* -------------------------
MEMBERS (XHR SAFE)
-------------------------- */
function showMembers(event) {
if (event) event.preventDefault();
@ -124,17 +141,19 @@ function showMembers(event) {
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var temp = document.createElement("div");
temp.innerHTML = xhr.responseText;
var section = temp.querySelector("#homeSection");
var section = getElementByIdSafe(temp, "homeSection");
if (!section) {
target.innerHTML = "<h2>Members</h2><p>Missing #homeSection</p>";
target.innerHTML = "<h2>Members</h2><p>Missing section</p>";
return;
}
target.innerHTML = section.innerHTML;
} else {
target.innerHTML = "<h2>Members</h2><p>Error loading page</p>";
}
@ -144,6 +163,9 @@ function showMembers(event) {
xhr.send(null);
}
/* -------------------------
ABOUT (XHR SAFE)
-------------------------- */
function showAbout(event) {
if (event) event.preventDefault();
@ -156,17 +178,20 @@ function showAbout(event) {
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var temp = document.createElement("div");
temp.innerHTML = xhr.responseText;
var section = temp.querySelector("#aboutSection");
var section = getElementByIdSafe(temp, "aboutSection");
if (!section) {
target.innerHTML = "<h2>About</h2><p>Missing #aboutSection</p>";
target.innerHTML = "<h2>About</h2><p>Missing section</p>";
return;
}
/* SAFE: no image filtering, just render */
target.innerHTML = section.innerHTML;
} else {
target.innerHTML = "<h2>About</h2><p>Error loading page</p>";
}
@ -176,6 +201,9 @@ function showAbout(event) {
xhr.send(null);
}
/* -------------------------
EASTER EGG
-------------------------- */
function showCode(event) {
if (event) event.preventDefault();