108 lines
2.4 KiB
HTML
108 lines
2.4 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<!-- meta name="color-scheme" content="dark light" /-->
|
||
|
<title>
|
||
|
Blog | Criminally Cute
|
||
|
</title>
|
||
|
<link rel="icon" type="image/png" href="/favicon.png">
|
||
|
<link rel="stylesheet" href="/css/site.css">
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<header>
|
||
|
<nav>
|
||
|
<ul>
|
||
|
<li><a href="/">Home</a></li>
|
||
|
<li><a href="/about">About</a></li>
|
||
|
<li><a href="/blog">Blog</a></li>
|
||
|
<li><a href="/projects">Projects</a></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
<div>
|
||
|
<h1>Blog</h1>
|
||
|
</div>
|
||
|
</header>
|
||
|
|
||
|
<main>
|
||
|
<article>
|
||
|
<section>
|
||
|
<article class="mt-8">
|
||
|
Blog description goes here
|
||
|
<a class="underline text-base flex items-center justify-between" href="blog/test-post">
|
||
|
<h3>
|
||
|
<time>08.Nov.2024</time>
|
||
|
Test Post
|
||
|
</h3>
|
||
|
</a>
|
||
|
</article>
|
||
|
</section>
|
||
|
</article>
|
||
|
</main>
|
||
|
|
||
|
<footer>
|
||
|
<ul>
|
||
|
<li>some link</li>
|
||
|
<li>some link 2</li>
|
||
|
</ul>
|
||
|
<div>
|
||
|
<p>© 2024 Criminally Cute</p>
|
||
|
<p><a class="underline" href="/feed.xml">RSS</a></p>
|
||
|
</div>
|
||
|
</footer>
|
||
|
</body>
|
||
|
</html>
|
||
|
|
||
|
|
||
|
<script>
|
||
|
function log(message) {
|
||
|
if (true) {
|
||
|
console.log(`[web_dev_utils] ${message}`)
|
||
|
}
|
||
|
}
|
||
|
function connect() {
|
||
|
try {
|
||
|
window.socket = new WebSocket('ws://' + location.host + '/ws');
|
||
|
|
||
|
window.socket.onmessage = function(e) {
|
||
|
if (e.data === "reload") {
|
||
|
log("reloading!");
|
||
|
location.reload();
|
||
|
} else if (e.data === "subscribed") {
|
||
|
log("connected and subscribed!");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.socket.onopen = () => {
|
||
|
waitForConnection(() => {
|
||
|
log("sending 'subscribe' message");
|
||
|
window.socket.send("subscribe")
|
||
|
}
|
||
|
, 300);
|
||
|
};
|
||
|
|
||
|
window.socket.onclose = () => {
|
||
|
setTimeout(() => connect(), 500);
|
||
|
};
|
||
|
|
||
|
function waitForConnection(callback, interval) {
|
||
|
log("waiting for connection!")
|
||
|
if (window.socket.readyState === 1) {
|
||
|
callback();
|
||
|
} else {
|
||
|
log("setting a timeout")
|
||
|
setTimeout(() => waitForConnection(callback, interval), interval);
|
||
|
}
|
||
|
}
|
||
|
} catch (e) {
|
||
|
log(e);
|
||
|
setTimeout(() => connect(), 500);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
log("about to connect");
|
||
|
connect();
|
||
|
</script>
|
||
|
|