chore: fixes

This commit is contained in:
MattTheTekie 2026-04-23 17:49:25 -04:00
commit 6b4bdfc41f

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>About - Legacy Veltron</title>
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="css/legacy.css">
</head>
<body>
@ -32,20 +32,21 @@
<!-- JS LOADER -->
<script>
(function () {
(function () {
function extractSection(html, id) {
function extractAboutHTML(responseText) {
var startTag = '<section id="' + id + '">';
var endTag = '</section>';
var temp = document.createElement("div");
temp.innerHTML = responseText;
var start = html.indexOf(startTag);
if (start === -1) return null;
var section = temp.getElementById("aboutSection");
var end = html.indexOf(endTag, start);
if (end === -1) return null;
if (section) {
return section.innerHTML;
}
return html.substring(start, end + endTag.length);
return '<center><h2>About</h2></center>' +
'<center><p>Failed to load About content.</p></center>';
}
function loadAbout() {
@ -54,30 +55,22 @@
if (!target) return;
var xhr = new XMLHttpRequest();
xhr.open("GET", "about.html", true);
xhr.open("GET", "http://www.veltron.net/about.html", true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
var html = xhr.responseText || "";
if (xhr.status === 200 || xhr.status === 0) {
var section = extractSection(html, "aboutSection");
if (section) {
target.innerHTML = section;
} else {
target.innerHTML =
'<center><h2>About</h2></center>' +
'<center><p>Could not find aboutSection in file.</p></center>';
}
target.innerHTML = extractAboutHTML(xhr.responseText);
} else {
target.innerHTML =
'<center><h2>About</h2></center>' +
'<center><p>Failed to load about.html</p></center>';
'<center><p>Could not load about.html</p></center>';
}
}
};
@ -87,12 +80,14 @@
} catch (e) {
target.innerHTML =
'<center><h2>About</h2></center>' +
'<center><p>Request error</p></center>';
'<center><p>Error loading page</p></center>';
}
}
if (window.addEventListener) {
window.addEventListener("load", loadAbout, false);
} else if (window.attachEvent) {
window.attachEvent("onload", loadAbout);
} else {
window.onload = loadAbout;
}