summaryrefslogtreecommitdiff
path: root/DAnCE/docs/Error_Documentation/outliner.js
blob: 6437e316d4a3ee3c1b570e31506eda42a80f7a34 (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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
var IMG_EXPANDED  = 'Expanded.png';
var IMG_COLLAPSED = 'Collapsed.png';
var IMG_BLANK = 'blank.png';
var IMG_LEAF = 'LeafRowHandle.png';

new Image(9,9),src = IMG_EXPANDED; // caching
new Image(9,9),src = IMG_COLLAPSED; // caching
new Image(9,9),src = IMG_BLANK; // caching
new Image(9,9),src = IMG_LEAF; // caching

function hover(iNode, over) {

    if (over) {
        t = document.getElementById(iNode).alt;
        
        if (t == '*') {
            document.getElementById(iNode).src=IMG_LEAF;
        } else if (t == 'V') {
            document.getElementById(iNode).src=IMG_EXPANDED;
        } else {
            document.getElementById(iNode).src=IMG_COLLAPSED;
        }
    
    } else {
        document.getElementById(iNode).src=IMG_BLANK;
    }
}

function expand(ioNode) {
    ioWedge = "i" + ioNode.substr(1);

    if (document.getElementById && document.getElementById(ioNode) !=  null) {

        document.getElementById(ioNode).className='expanded';

        if (document.getElementById(ioWedge) !=  null) {
            document.getElementById(ioWedge).src=IMG_EXPANDED;
            document.getElementById(ioWedge).title='collapse';
            document.getElementById(ioWedge).alt='V';
        }
    }
}

function collapse(ioNode) {
    ioWedge = "i" + ioNode.substr(1);

    if (document.getElementById && document.getElementById(ioNode) != null) {

        document.getElementById(ioNode).className='collapsed';

        if (document.getElementById(ioWedge) !=  null) {
            document.getElementById(ioWedge).src=IMG_COLLAPSED;
            document.getElementById(ioWedge).title='expand';
            document.getElementById(ioWedge).alt='>';
        }
    }
}

function ioSwitch(ioNode,fully) {

    if (document.getElementById && document.getElementById(ioNode) !=  null) {
        nodeState = document.getElementById(ioNode).className;
    }

    if (nodeState == 'collapsed') {
        if (fully) {
            expandAll();
        } else {
            expand(ioNode);
        }
    }

    else {
        if (fully) {
            collapseAll();
        } else {
            collapse(ioNode);
        }
    }
    updateRowBackgroundColors();
}

function expandAll() {

    if (document.getElementsByTagName) {
        nodeList = document.getElementsByTagName('div');

        for (var i = 0; i < nodeList.length; i++) {
    
            if (nodeList.item(i).className == 'expanded' || nodeList.item(i).className == 'collapsed') {
                expand(nodeList.item(i).id);
            }
        }
    }

    else {
        alert ("Sorry, don't know how to make this run in your browser.");
    }
}

function collapseAll() {

    if (document.getElementsByTagName) {
        nodeList = document.getElementsByTagName('div');

        for (var i = 0; i < nodeList.length; i++) {
    
            if (nodeList.item(i).className == 'expanded' || nodeList.item(i).className == 'collapsed') {
                collapse(nodeList.item(i).id);  
            }
        }
    }

    else {
        alert ("Sorry, don't know how to make this run in your browser.");
    }
}

//
// alternate background color support
//
function hasClass(ele,cls) {
    return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
    if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
    if (hasClass(ele,cls)) {
        var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
        ele.className=ele.className.replace(reg,' ');
    }
}

function isVisible(obj)
{
    if (obj == document)
        return true;

    if (!obj)
        return false;
    if (!obj.parentNode)
        return false;
    if (obj.style) {
        if (obj.style.display == 'none')
            return false;
        if (obj.style.visibility == 'hidden')
            return false;
    }

    //Try the computed style in a standard way
    if (window.getComputedStyle) {
        var style = window.getComputedStyle(obj, "");
        if (style.display == 'none')
            return false;
        if (style.visibility == 'hidden')
            return false;
    }

    //Or get the computed style using IE's silly proprietary way
    var style = obj.currentStyle
    if (style) {
        if (style['display'] == 'none')
            return false;
        if (style['visibility'] == 'hidden')
            return false;
    }
    return isVisible(obj.parentNode);
}

function updateRowBackgroundColors() {
    // do not update row colors unless alternate row colors has been specified.
    if (!hasClass(document.body, 'altRowColors'))
        return;
    var possibleRows = document.getElementsByClassName("row");
    var rowCount = 0;
    for(var i = 0; i < possibleRows.length; i++) {
        var element = possibleRows[i];
        if (isVisible(element)) {
            rowCount++;
            if (rowCount % 2 == 0) {
                addClass(element, 'altRow');
            } else {
                removeClass(element, 'altRow');
            }
        }
    }
}

window.onload = updateRowBackgroundColors;