summaryrefslogtreecommitdiff
path: root/posts.html
diff options
context:
space:
mode:
Diffstat (limited to 'posts.html')
-rw-r--r--posts.html86
1 files changed, 86 insertions, 0 deletions
diff --git a/posts.html b/posts.html
new file mode 100644
index 0000000..df70180
--- /dev/null
+++ b/posts.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta charset="utf-8">
+ <link rel="stylesheet" href="/index.css">
+ <link rel="stylesheet" href="/posts.css">
+ <title>Matthew Kosarek</title>
+ <link rel="shortcut icon" href="/favicon/favicon.ico" type="image/x-icon">
+ </head>
+ <body>
+ <header>
+ <h1>Matthew Kosarek</h1>
+ <nav>
+ <ul>
+ <li><a href='/'>&#127969; Home</a></li>
+ <li><a href='/resume.html'>&#128216; CV</a></li>
+ <li><a href='/posts.html'>&#128221; Posts</a></li>
+ </ul>
+ </nav>
+ </header>
+
+ <section id='post_section'>
+ </section>
+
+ <script>
+ function fetchHtml(fileName) {
+ return fetch(fileName).then((response) => {
+ return response.text();
+ });
+ }
+
+ function nodeScriptReplace(node) {
+ if ( nodeScriptIs(node) === true ) {
+ node.parentNode.replaceChild( nodeScriptClone(node) , node );
+ }
+ else {
+ var i = -1, children = node.childNodes;
+ while ( ++i < children.length ) {
+ nodeScriptReplace( children[i] );
+ }
+ }
+
+ return node;
+ }
+ function nodeScriptClone(node){
+ var script = document.createElement("script");
+ script.text = node.innerHTML;
+
+ var i = -1, attrs = node.attributes, attr;
+ while ( ++i < attrs.length ) {
+ script.setAttribute( (attr = attrs[i]).name, attr.value );
+ }
+ return script;
+ }
+
+ function nodeScriptIs(node) {
+ return node.tagName === 'SCRIPT';
+ }
+
+ (function() {
+ var postList = [
+ ];
+
+ var postContainer = document.getElementById('post_section');
+ if (!postContainer) {
+ console.error('Could not find post container.');
+ return;
+ }
+
+ postList.forEach(function(postName) {
+ fetchHtml(postName).then(function(text) {
+ var newSection = document.createElement('article');
+ newSection.innerHTML = text;
+ nodeScriptReplace(newSection);
+ postContainer.appendChild(newSection);
+ });
+ });
+ })();
+ </script>
+
+ </body>
+
+ <script src='/index.js'></script>
+ <script src='/mini-jquery.js' type='module'></script>
+</html>