-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
161 lines (143 loc) · 4.8 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
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Object-Oriented Design and Data Structures</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Cache-Control" content="public, max-age=600" /> <!-- cache for only 1 hour -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="styles/default.css" />
<style type="text/css">
div#unit-signature-links a { color: white }
.keyword {font-weight: bold}
@media screen {
.booktitle { font-weight: bold; font-size: 250% }
hr.endChapter { display: block; }
}
@media print {
.booktitle { font-weight: bold; font-size: 200%; font-family: Palatino, "Palatino Linotype"; }
}
div.toc {
background-color: #ddd;
border: 1px solid black;
padding: 0.5em 2em;
}
</style>
<script src="js/dirs.js"></script>
<script src="js/lectures.js"></script>
<script src="js/ajax.js"></script>
<script src="js/ezdom.js"></script>
<script src="js/constrain/numeric-1.2.6.js"></script>
<script src="js/constrain/constrain.js"></script>
<script src="js/constrain/constrain-graph.js"></script>
<script src="js/constrain/constrain-trees.js"></script>
<script src="js/constrain-notes.js"></script>
<script src="js/colorize.js"></script>
<script src="js/italmath.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.5/seedrandom.min.js"></script>
<script id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script>
var proper_names = [ "Java", "Dijkstra" ];
var proper_names_re = [];
for (let i = 0; i < proper_names.length; i++) {
proper_names_re[i] = new RegExp('\\b' + proper_names[i].toLowerCase() + '\\b');
}
// Return s in sentence case.
function sentence_case(s) {
s = s.substring(0,1) + s.substring(1).toLowerCase();
for (let i = 0; i < proper_names.length; i++) {
s = s.replace(proper_names_re[i], proper_names[i]);
}
return s;
}
// Add all h1 elements in a node to the table of contents, appropriately
// linked and converted to sentence case.
function add_to_toc(node, name) {
var headers = node.getElementsByTagName("h1")
for (let i = 0; i < headers.length; i++) {
const h = headers[i]
let link = name
if (i > 0) link = link + i
if (toc == undefined) {
toc = EZDom.ol()
var tocDiv = document.getElementById("toc")
tocDiv.appendChild(toc)
}
const tocline = sentence_case(h.childNodes[0].textContent),
href = EZDom.a({href: "lecture.html?id=" + link}, tocline)
toc.appendChild(EZDom.li(href))
}
}
// Append the content found at URL url into a new content div at the end of the
// children of HTML element id, and add it to the table of contents (toc) under
// the name 'name'. After all this is done, invoke cont(div) where div is the
// newly created div.
function append_content(id, url, name, cont) {
with (EZDom) {
let node = document.getElementById(id);
read_from_url(url,
responseText => {
var content = div({className: "content"});
content.innerHTML = responseText
redactContent(content)
add_to_toc(content, name);
if (cont != undefined) cont(content);
},
errmsg => {
node.appendChild(div(errmsg, a({href: url}, url)));
if (cont != undefined) cont();
}, "text/html");
}
}
// Load all lectures starting from index i
function load_from_i(i) {
var url = "lectures/" + lectures[i] + "/index.html";
console.log("loading " + url)
append_content("content", url, lectures[i],
div => {
i++
if (i < lectures.length) load_from_i(i);
});
}
// Load all lectures and construct the table of contents.
function load_all_lectures() {
load_from_i(0);
}
</script>
</head>
<body>
<div id="header">
<div id="identity">
<center>
<h1 class=booktitle>Object-Oriented Design and Data Structures<br>
<small>Andrew Myers and Dexter Kozen</small></h1>
</div>
</center>
</div>
<hr />
<div id="wrap">
<div id="content" lang="en">
<div id="toc" class="toc">
<h2>Table of Contents</h2>
</div>
</div>
</div>
<hr />
<p>
The <a href="fulltext.html">version of this text as a single printable web page</a> is available but
takes longer to load.
</p>
<div id="footer">
<div id="footer-content">
©2023 <a href="http://www.cornell.edu/">Cornell University</a>
</div>
</div>
<script>
var content_node = document.getElementById("content");
var toc; // table of contents
check_redaction_parameters();
load_all_lectures();
</script>
</body>
</html>