Skip to content

Commit

Permalink
#217 Create a website
Browse files Browse the repository at this point in the history
  • Loading branch information
braxtonhall committed Dec 30, 2022
1 parent 11b9adf commit e3112b9
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
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>
76 changes: 76 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!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");
$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>

0 comments on commit e3112b9

Please sign in to comment.