waifuism.life
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
waifuism/home/library/index.html

49 lines
1.7 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library | waifuism.life</title>
<link rel="stylesheet" href="styles.css">
<script src="/libs/marked.min.js"></script>
</head>
<body>
<div class="window">
<div class="nav">
<button onclick="loadContent('home.md')">Home</button>
<button onclick="loadContent('about.md')">About</button>
<button onclick="loadContent('contact.md')">Contact</button>
<button>Grimoire</button>
</div>
<div class="content" id="mainContent">
</div>
</div>
<script>
function loadContent(file) {
fetch(`markdown/${file}`)
.then(response => {
if (!response.ok) {
throw new Error(`Network response was not ok: ${response.statusText}`);
}
return response.text();
})
.then(text => {
const mainContent = document.getElementById('mainContent');
mainContent.innerHTML = marked.parse(text); // Changed to marked.parse
})
.catch(error => {
console.error('Error loading content:', error);
const mainContent = document.getElementById('mainContent');
mainContent.innerHTML = `<p>Error loading content. Please try again later.</p>`;
});
}
// Load the default home content on page load
window.onload = function() {
loadContent('home.md');
};
</script>
</body>
</html>