Files
hexstudios-co/index.html
2026-08-13 12:24:58 -05:00

75 lines
2.4 KiB
HTML

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hex Studios</title>
<script>
(function() {
var stored = localStorage.getItem('theme');
if (stored === 'light') document.documentElement.setAttribute('data-theme', 'light');
})();
function toggleTheme() {
var isLight = document.documentElement.getAttribute('data-theme') === 'light';
if (isLight) {
document.documentElement.removeAttribute('data-theme');
localStorage.setItem('theme', 'dark');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
}
}
</script>
<link rel="stylesheet" href="styles/main.css">
</head>
<body>
<button id="theme-toggle" onclick="toggleTheme()">toggle light/dark</button>
<h1>// Hex Studios</h1>
<i>Developer, biker, musician, engineer, and an unapologetic centrist in the deep red south. The real @hexstudios.</i>
<div id="sticky-posts-section">
<h2>Pinned posts</h2>
<ul>
<li><a href="posts/about.html">About</a></li>
</ul>
</div>
<div id="posts-section">
<h2>Posts</h2>
<ul id="posts-list"></ul>
</div>
<script>
async function loadPosts() {
const list = document.getElementById('posts-list');
try {
const res = await fetch('posts/list.php');
const posts = await res.json();
if (!posts.length) {
list.innerHTML = '<li>No posts yet.</li>';
return;
}
posts.forEach(post => {
const li = document.createElement('li');
const a = document.createElement('a');
a.textContent = post.title;
a.href = post.type === 'html'
? 'posts/' + post.file
: 'post.html?file=' + encodeURIComponent(post.file);
li.appendChild(a);
list.appendChild(li);
});
} catch (err) {
list.innerHTML = '<li>Couldn\u2019t load posts.</li>';
}
}
document.addEventListener('DOMContentLoaded', loadPosts);
</script>
</body>
</html>