-
Notifications
You must be signed in to change notification settings - Fork 2
/
index-01.html
159 lines (141 loc) · 3.79 KB
/
index-01.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
156
157
158
159
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>absence.github.com</title>
<style>
@font-face {
font-family: 'inconsolata';
src: url('inconsolata.woff') format('woff');
font-weight: normal;
font-style: normal;
}
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 100%;
color: #555;
font-family: 'inconsolata';
font-size: 15px;
line-height: 18px;
overflow: hidden;
}
a {
color: #2194CE;
}
#panel {
position: fixed;
width: 260px;
height: 100%;
overflow: auto;
}
#panel h1 {
margin-top: 20px;
margin-left: 20px;
font-size: 25px;
font-weight: normal;
}
#panel h1 a {
color: #444;
text-decoration: none;
}
#panel h2 {
color: #454545;
font-size: 18px;
font-weight: normal;
margin-top: 20px;
margin-left: 20px;
}
#panel h3 {
color: #666;
font-size: 16px;
font-weight: normal;
margin-top: 20px;
margin-left: 20px;
}
#panel ul {
list-style-type: none;
padding: 0px;
margin-left: 20px;
}
#viewer {
border: 0px;
margin-left: 260px;
width: -webkit-calc(100% - 260px);
width: -moz-calc(100% - 260px);
width: calc(100% - 260px);
height: 100%;
overflow: auto;
}
</style>
</head>
<body>
<div id="panel"></div>
<iframe id="viewer"></iframe>
<script src="list.js"></script>
<script>
var panel = document.getElementById( 'panel' );
var viewer = document.getElementById( 'viewer' );
var html = '<h1>Absence</h1><h3>Help with <i>Incomplete Nature</i></h3>';
var DELIMITER = '/';
var nameCategoryMap = {};
for ( var section in list ) {
html += '<h2>' + section + '</h2>';
html += '<ul>';
for ( var category in list[ section ] ) {
html += '<h3>' + category + '</h3>';
html += '<ul>';
for ( var i = 0; i < list[ section ][ category ].length; i ++ ) {
var page = list[ section ][ category ][ i ];
html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
nameCategoryMap[page[0]] = {
section: section,
category: category,
name: page[0]
};
}
html += '</ul>';
}
html += '</ul>';
}
panel.innerHTML += html;
// viewer.innerHTML = 'absence';
function encodeUrl( path ) {
return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
}
function decodeUrl( path ) {
return path.replace(/_/g, ' ').replace(/\./g, ' / ');
}
// Page loading
function goTo( section, category, name ) {
// Fully resolve links that only provide a name
if(arguments.length == 1) {
console.log(section, category, name);
var location = nameCategoryMap[section];
section = location.section;
category = location.category;
name = location.name;
}
var title = 'absence - ' + section + ' - ' + name;
var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
window.location.hash = url;
window.document.title = title;
viewer.src = pages[ section ][ category ][ name ] + '.html';
}
function goToHash() {
var hash = window.location.hash.substring( 1 ).split(DELIMITER);
goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
}
// goTo('jaanga.githb.com','Blode','DAT.GUI User Controls');
window.addEventListener( 'hashchange', goToHash, false );
if ( window.location.hash.length > 0 ) {
goToHash();
} else {
goTo('Summary','Overview','Home Page');
}
</script>
</body>
</html>