ObsidianJustSharePlease/server/public/index.html

68 lines
3.1 KiB
HTML
Raw Normal View History

2023-06-25 18:16:06 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Just Share Please</title>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>
2023-08-11 20:51:34 +02:00
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.5/dist/purify.js"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked@7.0.2/lib/marked.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-katex-extension@3.0.3/lib/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-highlight@2.0.4/lib/index.umd.js"></script>
2023-06-25 18:16:06 +02:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=JetBrains+Mono&display=swap">
2023-08-11 20:51:34 +02:00
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css">
2023-08-11 22:49:12 +02:00
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github-dark.min.css" media="(prefers-color-scheme:dark)">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github.min.css" media="(prefers-color-scheme:light),(prefers-color-scheme:no-preference)">
<link rel="stylesheet" href="style.css">
2023-06-25 18:16:06 +02:00
<link rel="icon" href="favicon.ico">
</head>
<body>
<div class="content">
<div id="main">
<script>
let main = $("#main");
2023-08-11 19:01:10 +02:00
// TODO display nice message when there is no hash
2023-08-11 20:51:34 +02:00
2023-06-25 18:16:06 +02:00
$(window).on("hashchange", display);
display();
function display() {
let hash = window.location.hash;
if (hash.startsWith("#"))
hash = hash.substring(1);
$.ajax({
2023-08-09 20:13:44 +02:00
method: "get",
2023-08-10 19:47:55 +02:00
url: `share.php?id=${hash}`,
2023-06-25 18:16:06 +02:00
success: t => {
2023-08-11 20:51:34 +02:00
marked.use(markedKatex());
marked.use(markedHighlight.markedHighlight({
langPrefix: "hljs language-",
highlight: (c, l) => {
const language = hljs.getLanguage(l) ? l : "plaintext";
return hljs.highlight(c, {language}).value;
}
}));
main.html(DOMPurify.sanitize(marked.parse(t)));
2023-06-25 18:16:06 +02:00
},
// TODO display this error more nicely
error: (r, s, e) => main.html(e)
});
}
</script>
</div>
<div id="footer">
Created using <a href="https://github.com/Ellpeck/ObsidianJustSharePlease">Just Share Please</a> for <a href="https://obsidian.md">Obsidian</a>
</div>
</div>
</body>
</html>