File: expandable-outlines.js

package info (click to toggle)
openldap2 2.0.23-6.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,816 kB
  • ctags: 6,366
  • sloc: ansic: 86,391; sh: 9,816; makefile: 1,270; cpp: 1,107; sql: 838; php: 700; perl: 134; tcl: 40
file content (133 lines) | stat: -rw-r--r-- 3,221 bytes parent folder | download
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
	var bV=parseInt(navigator.appVersion);
	NS4=(document.layers) ? true : false;
	IE4=((document.all)&&(bV>=4))?true:false;
	ver4 = (NS4 || IE4) ? true : false;
	function expandIt(){return}
	function expandAll(){return}
	isExpanded = false;

	function getIndex(el) {
		ind = null;
		for (i=0; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id == el) {
				ind = i;
				break;
			}
		}
		return ind;
	}

	function arrange() {
		nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
		for (i=firstInd+1; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.visibility != "hide") {
				whichEl.pageY = nextY;
				nextY += whichEl.document.height;
			}
		}
	}

	function initIt(){
		if (NS4) {
			for (i=0; i<document.layers.length; i++) {
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
			}
			arrange();
		}
		else {
			tempColl = document.all.tags("div");
			for (i=0; i<tempColl.length; i++) {
				if (tempColl(i).className == "child") tempColl(i).style.display = "none";
			}
		}
	}

	function expandIt(el) {
		if (!ver4) return;
		if (IE4) {expandIE(el)} else {expandNS(el)}
	}

	function expandIE(el) { 
		whichEl = eval(el + "Child");
		whichIm = event.srcElement;
		if (whichEl.style.display == "none") {
			whichEl.style.display = "block";
			whichIm.src = "true.gif";		
		}
		else {
			whichEl.style.display = "none";
			whichIm.src = "false.gif";
		}
	}

	function expandNS(el) {
		whichEl = eval("document." + el + "Child");
		whichIm = eval("document." + el + "Parent.document.images['imEx']");
		if (whichEl.visibility == "hide") {
			whichEl.visibility = "show";
			whichIm.src = "true.gif";
		}
		else {
			whichEl.visibility = "hide";
			whichIm.src = "false.gif";
		}
		arrange();
	}

	function showAll() {
		for (i=firstInd; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			whichEl.visibility = "show";
		}
	}

	function expandAll(isBot) {
		newSrc = (isExpanded) ? "false.gif" : "true.gif";
	
		if (NS4) {
	        document.images["imEx"].src = newSrc;
			for (i=firstInd; i<document.layers.length; i++) {
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Parent") != -1) {
					whichEl.document.images["imEx"].src = newSrc;
				}
				if (whichEl.id.indexOf("Child") != -1) {
					whichEl.visibility = (isExpanded) ? "hide" : "show";
				}
			}
	
			arrange();
			if (isBot && isExpanded) scrollTo(0,document.layers[firstInd].pageY);
		}
		else {
			divColl = document.all.tags("div");
			for (i=0; i<divColl.length; i++) {
				if (divColl(i).className == "child") {
					divColl(i).style.display = (isExpanded) ? "none" : "block";
				}
			}
			imColl = document.images.item("imEx");
			for (i=0; i<imColl.length; i++) {
				imColl(i).src = newSrc;
			}
		}
	
		isExpanded = !isExpanded;
	}

with (document) {
	write("<style type='text/css'>");
	if (NS4) {
		write(".parent {position:absolute; visibility:hidden}");
		write(".child {position:absolute; visibility:hidden}");
		write(".regular {position:absolute; visibility:hidden}")
	}
	else {
		write(".child {display:none}")
	}
	write("</style>\n");
}
onload = initIt;