blob: 0242aa3252a600cf6a494c9b9f3e98f1d3ed48b9 (
plain)
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
|
function set_highlight(line) {
var line = 'codeline-' + line
var codeline = document.getElementById(line);
if (codeline) {
codeline.className = 'selected';
}
}
function cleanup() {
var elements = document.getElementsByClassName('selected');
for (var i = 0; i < elements.length; i++) {
elements[i].className = '';
}
}
window.addEventListener('load', function(event) {
var line = document.location.hash.substr(6);
if (line) {
set_highlight(line);
}
var linenodivs = document.getElementsByClassName('linenodiv');
if (linenodivs.length === 0) {
return;
}
var as = linenodivs[0].getElementsByTagName('a');
for (var i = 0; i < as.length; i++) {
as[i].onclick = function(event) {
cleanup();
set_highlight(event.target.text.trim());
}
}
});
|