blynn / gitmagic

A guide to using Git

This URL has Read+Write access

blynn (author)
Sun Nov 15 15:22:51 -0800 2009
commit  0a005ab8b1ec0f965c2489d4797d75c0c91c9df4
tree    c18e454d650b9ba7a2e434c8b7761de79b070290
parent  30f9a1ad4716ce3dbd13e33d67dc54d99ab19a0c
gitmagic / find_selflink.js
100644 38 lines (34 sloc) 0.875 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
// From my own website(!)
//TODO: only do this for links in the table of contents menu
 
function find_selflink() {
    var a = document.links;
    var i = 0;
    while (i < a.length) {
if (a[i].href == document.URL) {
            var c;
            var j;
            var s_new = document.createElement("span");
            s_new.className = "currentlink";
            c = a[i].childNodes;
            for (j=0; j<c.length; j++) {
                s_new.appendChild(c[j]);
            }
            a[i].parentNode.replaceChild(s_new, a[i]);
        } else {
            i++;
        }
 
/*
if (a[i].href == document.URL) {
a[i].className = "currentlink";
if (0) {
var s_new = document.createElement("span");
s_new.className = "currentlink";
s_new.appendChild(a[i]);
a[i].parentNode.replaceChild(s_new, a[i]);
}
}
i++;
*/
    }
}
 
find_selflink();