blob: df70180ae7f0ebb89dfd55a3e9081548f62c7c17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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='/'>🏡 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 = [
];
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>
|