Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a website #218

Merged
merged 5 commits into from
Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/betterlibrarything.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions 404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!--From https://github.com/mktcode/dynamic-nuxt-gh-pages/blob/main/static/404.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
</head>
<body></body>
<script>
window.location.href = `/library-thing/#${window.location.pathname.replace("library-thing/", "")}`;
</script>
</html>
78 changes: 78 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Better LibraryThing"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Better LibraryThing</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js" integrity="sha512-SYfDUYPg5xspsG6OOpXU366G8SZsdHOhqk/icdrYJ2E/WKZxPxze7d2HD3AyXpT7U22PZ5y74xRpqZ6A2bJ+kQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
body {
font-family: "proxima-nova","Helvetica Neue",Helvetica,Arial,sans-serif;
}
h1 {
font: 40px 'Montserrat', sans-serif;
font-weight: bolder;
}
h2 {
font: 40px 'Montserrat', sans-serif;
}
h3 {
font: 30px 'Montserrat', sans-serif;
}
h4 {
font: 20px 'Montserrat', sans-serif;
}
img {
max-width: 90vw;
display: block;
margin-left: auto;
margin-right: auto;
filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.60))
}
</style>
</head>
<body>
<script>
let md = "README.md";
if (window.location.hash.length > 1) {
const path = window.location.hash.replace('#', '').replace(/^\//, '');
history.pushState({ page: 1 }, "Redirecting", `/library-thing/${path}`);
md = path.replace(/\.pretty/, '');
}

const path = `https://raw.githubusercontent.com/braxtonhall/library-thing/main/${md}`;

const fixLinks = () =>
$("a").each((_, element) => {
const $element = $(element);
const href = $element.attr("href");
if (href.endsWith(".md")) {
$element.attr("href", `/library-thing/${href}.pretty`);
}
});

fetch(path)
.then((response) => response.text())
.then((text) => window.markdownit({html: true}).render(text))
.then((render) => $("#main").html(render))
.finally(fixLinks);

</script>

<div id="main"></div>

</body>
</html>