mirror of
https://github.com/JonasunderscoreJones/wiki.jonasjones.dev.git
synced 2025-10-22 13:59:19 +02:00
commit
5b6eb52140
7 changed files with 164 additions and 103 deletions
|
@ -1,6 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="darkreader-lock">
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
|
|
|
@ -4,36 +4,41 @@
|
|||
|
||||
<!-- Footer.svelte -->
|
||||
<footer>
|
||||
<a href="/">Home</a>
|
||||
<div class="footer-flex">
|
||||
<a href="/">Home</a>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://jonasjones.dev/">Homepage</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/about">About</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<p>Website by Jonas_Jones 2021 - 2023</p>
|
||||
</div>
|
||||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://jonasjones.dev/">Homepage</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/about">About</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/contact">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</footer>
|
||||
|
||||
<style>
|
||||
footer {
|
||||
padding: 1rem;
|
||||
margin: 2rem;
|
||||
margin-bottom: 0;
|
||||
margin-bottom: 2rem;
|
||||
margin-top: 0;
|
||||
background: var(--container-background-color);
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.footer-flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
ul {
|
||||
|
@ -49,9 +54,14 @@
|
|||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 550px) {
|
||||
footer {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -9,7 +9,14 @@
|
|||
<nav>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://jonasjones.dev/"><img style="padding-top: 7px;" src="/homepage.png" height="30px" alt="Homepage"></a>
|
||||
<a href="https://jonasjones.dev/"
|
||||
><img
|
||||
style="padding-top: 7px;"
|
||||
src="/homepage.png"
|
||||
height="30px"
|
||||
alt="Homepage"
|
||||
/></a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -19,7 +26,7 @@
|
|||
header {
|
||||
padding: 1rem;
|
||||
margin: 2rem;
|
||||
margin-top: 0;
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0;
|
||||
background: rgb(0, 255, 0);
|
||||
display: flex;
|
||||
|
@ -61,4 +68,18 @@
|
|||
float: left;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 550px) {
|
||||
header h1 {
|
||||
font-size: 20px;
|
||||
float:none;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,80 +1,14 @@
|
|||
<script>
|
||||
// @ts-nocheck
|
||||
|
||||
let data = import.meta.glob("/src/routes/**/+page.md");
|
||||
let paths = data;
|
||||
|
||||
/**
|
||||
* @param {Record<string, () => Promise<unknown>>} paths
|
||||
*/
|
||||
function buildHierarchy(paths) {
|
||||
const nestedList = {};
|
||||
let fixedpaths = [];
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
let fixedpaths2 = [];
|
||||
fixedpaths = Object.keys(paths);
|
||||
fixedpaths.forEach((path) => {
|
||||
const fixedpath = path
|
||||
.replace("/+page.md", "")
|
||||
.replace("/src/routes", "");
|
||||
fixedpaths2.push(fixedpath);
|
||||
});
|
||||
fixedpaths2.forEach((folder) => {
|
||||
const parts = folder.split("/").filter(Boolean);
|
||||
let currentNode = nestedList;
|
||||
|
||||
parts.forEach((part) => {
|
||||
if (!currentNode[part]) {
|
||||
currentNode[part] = {};
|
||||
}
|
||||
currentNode = currentNode[part];
|
||||
});
|
||||
});
|
||||
|
||||
return nestedList;
|
||||
}
|
||||
|
||||
const nestedFolders = buildHierarchy(paths);
|
||||
|
||||
function createHtmlList(obj, parentPath = "", depth = 0) {
|
||||
let html = "";
|
||||
|
||||
for (const key in obj) {
|
||||
const currentPath = parentPath ? `${parentPath}/${key}` : key;
|
||||
|
||||
if (
|
||||
typeof obj[key] === "object" &&
|
||||
Object.keys(obj[key]).length > 0
|
||||
) {
|
||||
// If the value is an object and not empty, create a nested div
|
||||
html += `
|
||||
<li><h${depth + 3}><a href="/${currentPath}">${key}</a></h${
|
||||
depth + 3
|
||||
}></li>
|
||||
<ul>
|
||||
${createHtmlList(obj[key], currentPath, depth + 1)}
|
||||
</ul>
|
||||
`;
|
||||
} else {
|
||||
// If the value is not an object or empty, create a clickable list item
|
||||
html += `<li><a href="/${currentPath}">${key}</a></li>`;
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
//const renderedList = `<ul>${renderNestedList(nestedFolders)}</ul>`;
|
||||
let renderedList = createHtmlList(nestedFolders);
|
||||
import NavbarList from "./NavbarList.svelte";
|
||||
</script>
|
||||
|
||||
<div class="container navbar">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2>Pages</h2>
|
||||
{@html renderedList}
|
||||
<div class="navbar-links">
|
||||
<NavbarList />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
73
src/lib/components/NavbarList.svelte
Normal file
73
src/lib/components/NavbarList.svelte
Normal file
|
@ -0,0 +1,73 @@
|
|||
<script>
|
||||
// @ts-nocheck
|
||||
|
||||
let data = import.meta.glob("/src/routes/**/+page.md");
|
||||
let paths = data;
|
||||
|
||||
/**
|
||||
* @param {Record<string, () => Promise<unknown>>} paths
|
||||
*/
|
||||
function buildHierarchy(paths) {
|
||||
const nestedList = {};
|
||||
let fixedpaths = [];
|
||||
/**
|
||||
* @type {string[]}
|
||||
*/
|
||||
let fixedpaths2 = [];
|
||||
fixedpaths = Object.keys(paths);
|
||||
fixedpaths.forEach((path) => {
|
||||
const fixedpath = path
|
||||
.replace("/+page.md", "")
|
||||
.replace("/src/routes", "");
|
||||
fixedpaths2.push(fixedpath);
|
||||
});
|
||||
fixedpaths2.forEach((folder) => {
|
||||
const parts = folder.split("/").filter(Boolean);
|
||||
let currentNode = nestedList;
|
||||
|
||||
parts.forEach((part) => {
|
||||
if (!currentNode[part]) {
|
||||
currentNode[part] = {};
|
||||
}
|
||||
currentNode = currentNode[part];
|
||||
});
|
||||
});
|
||||
|
||||
return nestedList;
|
||||
}
|
||||
|
||||
const nestedFolders = buildHierarchy(paths);
|
||||
|
||||
function createHtmlList(obj, parentPath = "", depth = 0) {
|
||||
let html = "";
|
||||
|
||||
for (const key in obj) {
|
||||
const currentPath = parentPath ? `${parentPath}/${key}` : key;
|
||||
|
||||
if (
|
||||
typeof obj[key] === "object" &&
|
||||
Object.keys(obj[key]).length > 0
|
||||
) {
|
||||
// If the value is an object and not empty, create a nested div
|
||||
html += `
|
||||
<li><h${depth + 3} style='margin:0'><a href="/${currentPath}">${key}</a></h${
|
||||
depth + 3
|
||||
}></li>
|
||||
<ul>
|
||||
${createHtmlList(obj[key], currentPath, depth + 1)}
|
||||
</ul>
|
||||
`;
|
||||
} else {
|
||||
// If the value is not an object or empty, create a clickable list item
|
||||
html += `<li><a href="/${currentPath}">${key}</a></li>`;
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
//const renderedList = `<ul>${renderNestedList(nestedFolders)}</ul>`;
|
||||
let renderedList = createHtmlList(nestedFolders);
|
||||
</script>
|
||||
|
||||
{@html renderedList}
|
|
@ -73,7 +73,7 @@ main {
|
|||
.navbar {
|
||||
float: left;
|
||||
padding: 2rem;
|
||||
min-width: 300px;
|
||||
min-width: 200px;
|
||||
margin-right: 2rem;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
@ -124,4 +124,36 @@ details {
|
|||
|
||||
details a {
|
||||
padding-left: 0.5rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-left: 0;
|
||||
overflow: scroll;
|
||||
white-space: initial;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 900px) {
|
||||
.container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-left: 32px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 550px) {
|
||||
.column {
|
||||
margin: 0;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
|
@ -4,24 +4,14 @@
|
|||
import Navbar from "$lib/components/Navbar.svelte";
|
||||
</script>
|
||||
|
||||
<div style="height:2rem" />
|
||||
<Header />
|
||||
<div class="container">
|
||||
<div class="column"><Navbar /></div>
|
||||
<div class="column content flex_grow" style="margin-left: 0;">
|
||||
<div class="column content flex_grow">
|
||||
<main>
|
||||
<slot />
|
||||
<!-- Please god forgive me -->
|
||||
<h1
|
||||
style="color: var(--container-background-color);margin:0;padding:0"
|
||||
class="unselectable"
|
||||
>
|
||||
YOU CANT SEE THIS YOU CANT SEE THIS YOU CANT SEE THIS YOU CANT
|
||||
SEE THIS
|
||||
</h1>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Footer />
|
||||
<div style="height:2rem" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue