index.htm (view raw)
1<!doctype html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>Startpage</title>
6 <meta name="description" content="BiRabittoh's plain startpage">
7 <meta name="author" content="BiRabittoh">
8 <base target="_blank">
9 </head>
10 <body style="background-color: black; color: white;">
11 <h1>Welcome back.</h1>
12 <div id="links"></div>
13 <script src="config.js"></script>
14 <script>
15if (theme) {
16 let head = document.getElementsByTagName("head")[0];
17 let css = document.createElement("link");
18 css.type = "text/css";
19 css.rel = "stylesheet";
20 css.href = `themes/${theme}.css`;
21 head.appendChild(css);
22}
23if (categories) {
24 let main = document.getElementById("links");
25 let str = "";
26 let info;
27 categories.forEach(cat => {
28 str += `<h2>${cat.name}</h2>`;
29 cat.links.forEach(link => {
30 info = link.split(/(?<=^\S+)\s/);
31 if(info[0]){
32 str += `<div><a href="${info[0]}">${info[1] ? info[1] : info[0]}</a></div>`
33 }
34 });
35 });
36 main.innerHTML = str;
37}
38 </script>
39 </body>
40</html>