diff options
Diffstat (limited to 'posts.html~')
-rw-r--r-- | posts.html~ | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/posts.html~ b/posts.html~ new file mode 100644 index 0000000..2d9ea0e --- /dev/null +++ b/posts.html~ @@ -0,0 +1,87 @@ +<!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='/'>🏡 Home</a></li> + <li><a href='/resume.html'>📘 CV</a></li> + <li><a href='/posts.html'>📝 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 = [ + 'posts/linear_system_solver.html' + ]; + + 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> |