-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.html
41 lines (30 loc) · 1.11 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
<!doctype html>
<html lang=en >
<head>
<title>OpenDesk on GitHub</title>
<meta charset=utf-8 />
</head>
<body>
<script>
var script = document.body.appendChild( document.createElement( 'script' ) );
script.onload = init;
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js';
function init() {
var css = document.head.appendChild( document.createElement('style') );
css.innerHTML ='body { font: bold 12pt monospace; left: 0; margin: 0 auto; max-width:900px; position: absolute; right: 0; }' +
'h3 {margin: 0; padding: 0; }' +
'p { margin: 0; padding: 0 0 15px 0; }' +
'';
var info = document.body.appendChild( document.createElement( 'div' ) );
var fileName = location.hash ? location.hash.split( '#' )[1] : 'readme.md';
document.title = document.title ? document.title : fileName;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( 'GET', fileName, true );
xmlHttp.onreadystatechange = function() {
info.innerHTML = xmlHttp.readyState === 4 ? new Showdown.converter().makeHtml( xmlHttp.responseText ) : '';
};
xmlHttp.send( null );
}
</script>
</body>
</html>