-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (144 loc) · 4.4 KB
/
index.html
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Artikash's Blog</title>
<link
id="favicon"
rel="shortcut icon"
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACmSURBVDhPpZJREoMgDERDT1b/PEJv6BX8szejrFlksQPo+GaUoNkNidpTAldnju9033zTZLI1fBnToBZWCRXNvDlGvrwGcqHh5lM2N2DRVwqXdE37Q6BmfWNoNhjY0Yu2MWqJGjcoYED5NBo3cQOtpl8AcW7jf901gYFXU/EIN+IJYdIfWI3kn2fQpwiP+ZQW1pD/ytFJTq2qALEbXkaHCO4N8jlmP6PKWqMNImyYAAAAAElFTkSuQmCC"
/>
<style>
body {
background: #eeeeee;
line-height: 1.6;
font-size: 16px;
color: #444;
margin: 30px 0;
padding: 0;
}
h1,
h2,
h3 {
line-height: 1.2;
}
pre {
white-space: pre-wrap;
}
header {
text-align: center;
border-bottom: 3px solid black;
}
main {
display: flex;
justify-content: center;
max-width: 1200px;
margin: 10px auto;
}
@media (max-width: 600px) {
main {
flex-direction: column;
}
}
article {
max-width: 800px;
padding: 0 50px;
}
nav {
max-width: 200px;
padding: 0 50px;
}
</style>
</head>
<body>
<header>
<h1>Welcome to Artikash's blog.</h1>
<p>
Where I discuss code and whatever else I feel like.<br />
<strong><a href="/">Home</a></strong><br />
<a href="/?about_me">About</a> •
<a href="mailto:[email protected]">E-mail</a> •
<a href="https://twitter.com/Artikash_">Twitter</a> •
<a href="https://github.com/Artikash">GitHub</a> •
<a href="https://linkedin.com/in/akash-mozu">LinkedIn</a> •
<a href="https://youtube.com/Artikash">YouTube</a> •
<a href="https://reddit.com/u/Artikash">Reddit</a>
</p>
<h2></h2>
</header>
<main>
<article>
<noscript>
<h2>This page requires JavaScript to be enabled. Try removing the ? symbol from the URL.</h2>
</noscript>
<h2>Loading...</h2>
</article>
<nav>
<h2>Archive</h2>
</nav>
</main>
<script>
"use strict";
var posts = [
{
month: "January 2020",
links: ['<a href="?this_js_cxx"><code>this</code>: C++ vs JavaScript</a>']
},
{
month: "August 2019",
links: ['<a href="?iile">Immediately Invoked Lambda Expressions in C++</a>']
},
{
month: "March 2019",
links: ['<a href="?hello_world">Hello World!</a>']
},
{
month: "Apps",
links: [
'<a href="?random_kanji">Random 常用漢字</a>',
'<a href="?risk_simulator">Risk (board game) Simulator</a>',
'<a href="?clipboard_monitor">Clipboard Monitor</a>'
]
}
];
for (var archive = document.querySelector("nav"), i = 0; i < posts.length; ++i) {
var element = archive.appendChild(document.createElement("h3"));
element.innerText = posts[i].month + "▾";
(function(element, links) {
element.style.cursor = "pointer";
var list = null;
element.onclick = function() {
if (list) {
archive.removeChild(list);
list = null;
} else {
list = document.createElement("ul");
for (var i = 0; i < links.length; ++i)
list.appendChild(document.createElement("li")).innerHTML = links[i];
element.insertAdjacentElement("afterend", list);
}
};
})(element, posts[i].links);
}
var xhr = new XMLHttpRequest();
xhr.open("GET", (window.location.search || "doesnt_exist").slice(1));
xhr.send();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
document.querySelector("article").innerHTML =
xhr.responseText.slice(0, 15) === "<!DOCTYPE html>" ? defaultContent : xhr.responseText;
for (var scripts = document.querySelector("article").getElementsByTagName("script"), i = 0;
i < scripts.length; ++i) eval("'use strict';" + scripts[i].innerHTML);
for (var elements = document.querySelectorAll("code"), i = 0; i < elements.length; ++i)
elements[i].innerHTML = elements[i].innerHTML.replace(/\t/g, " ");
document.getElementById(window.location.hash.slice(1)).scrollIntoView();
}
};
var defaultContent = "<h2>Recent Posts</h2>";
for (var recentPostCount = 0, i = 0; i < posts.length; ++i)
for (var j = 0; recentPostCount < 10 && j < posts[i].links.length; ++recentPostCount, ++j)
defaultContent += "<h3>" + posts[i].links[j] + "</h3>";
</script>
</body>
</html>