-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
mod.ts
37 lines (28 loc) · 876 Bytes
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { html } from "./mod_deps.ts";
export interface BuildSiteConfig {
title?: string | null;
time?: number | null;
}
export function buildSite(url: string, config: BuildSiteConfig = {}) {
const { time = 1000, title = "Redirecting..." } = config;
return html`<!DOCTYPE html>
<html>
<head>
<title>${title}</title>
<link rel="icon" type="image/jpg" href="/favicon.jpg" />
<script type="module" defer>
const seconds = document.getElementById("seconds");
let counter = 3;
setInterval(() => {
seconds.innerText = counter;
if (--counter === 0) {
window.location.assign("${url}");
}
}, ${time});
</script>
</head>
<body>
Redirecting you to "${url}" in <span id="seconds"> 3 </span>
</body>
</html>`;
}