-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-md.html
More file actions
107 lines (84 loc) · 2.7 KB
/
index-md.html
File metadata and controls
107 lines (84 loc) · 2.7 KB
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
<!DOCTYPE html>
<HTML>
<HEAD>
<title>Alexandr Poltavsky</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="Cache-Control" content="no-store" />
<script type="text/javascript" src="markdown/markdown.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<script type="text/javascript">
function loadFile( href ) {
var req1 = new XMLHttpRequest();
req1.overrideMimeType("text/plain");
req1.open( "GET", href );
req1.onreadystatechange = function( state ) {
if( req1.readyState === 4 ) {
if( req1.status != 200 ) {
alert( req1.statusText );
return;
}
var text = req1.responseText;
document.getElementById("content").innerHTML = markdown.toHTML( text );
processLinks();
}
};
req1.send();
}
function processLinks() {
var as = document.getElementById("content").getElementsByTagName("a");
for( var el of as ) {
if( el.href.endsWith( ".html" ) ) {
el.addEventListener("click", function(e) {
e.preventDefault();
var hash = this.getAttribute( "href" );
hash = hash.replace(".html", ".md");
if( hash.length ) {
if( ! location.hash.length ) hash = "#" + hash;
else hash = "," + hash;
location.assign( location.href + hash );
}
});
}
}
}
function getLink() {
var dir = "src/";
var link = "index.md";
var hash = location.hash;
if( hash.length ) {
var idx = hash.lastIndexOf( "," );
if( idx > 0 ) link = hash.substr( idx + 1 );
else link = hash.substr( 1 );
}
link = dir + link;
var el = document.createElement("a");
el.setAttribute( "href", link );
return el.href;
}
document.addEventListener( "DOMContentLoaded", function() {
loadFile( getLink() );
} );
window.addEventListener( "hashchange", function() {
loadFile( getLink() );
} );
</script>
</HEAD>
<BODY>
<div id="wrap">
<!-- header part -->
<div id="header">
<a href="/" title="Back home">
<img width="160" src="images/alexandr-poltavsky-avatar.jpeg" title="Energia-Buran Military Space System" align="left"/>
</a>
<strong>
Personal blog of Alexandr Poltavsky. <br/>
Software developer. <em>alexpolt@yandex.ru</em><br/>
</strong>
<ul id="menu">
<li><a href="/">Contents</a></li>
<li><a href="https://github.com/alexpolt/">Github</a></li>
</ul>
</div>
<div id="content" style="clear: left"></div>
</div> <!-- end wrap -->
</BODY>