spfn-website/js/guides.js

26 lines
782 B
JavaScript
Raw Permalink Normal View History

2025-06-06 00:16:40 +01:00
const guideContents = document.querySelectorAll(".guide-content");
const guideButtons = document.querySelectorAll(".guide");
2025-06-06 00:16:40 +01:00
2025-07-04 22:56:23 +01:00
const params = new URLSearchParams(window.location.search);
const guideParam = params.get("guide");
let guide = "install-wiiu";
let guidePath = '/md/install-wiiu.md';
if (guideParam) {
guide = guideParam;
guidePath = `/md/${guide}.md`;
}
fetch(guidePath)
.then(res => {
if (!res.ok) throw new Error(`Guide "${guide} was not found`);
const guideButton = document.getElementById(guide);
if (guideButton) guideButton.classList.add("active");
2025-07-04 22:56:23 +01:00
return res.text();
})
2025-07-04 22:56:23 +01:00
.then(text => {
const html = marked.parse(text);
document.getElementById("guide-contents").innerHTML = html;
})