PageRenderTime 25ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/Documentation/Help/scripts/MemberFilter.js

#
JavaScript | 99 lines | 57 code | 28 blank | 14 comment | 36 complexity | c726ced66a76938cdcf4145e406132ae MD5 | raw file
 1
 2	// a member filter
 3
 4	function MemberFilter () {
 5
 6		// set up defaults
 7
 8		this.subgroup = "all";
 9
10		this.public = true;
11		this.protected = true;
12		this.private = true;
13
14		this.instance = true;
15		this.static = true;
16
17		this.declared = true;
18		this.inherited = true;
19
20	}
21
22	MemberFilter.prototype.filterElement = function(element) {
23
24		// get the data for the element
25		if (element == null) return;
26		var data = element.getAttribute("data");
27		if (data == null) return;
28		var datum = data.split("; ");
29		if (datum.length != 4) return;
30        
31		// extract the relevent member attributes
32		var subgroup = datum[0];
33		var visibility = datum[1];
34		var binding = datum[2];
35		var origin = datum[3];
36
37		// determine whether to show the member
38		var show = true;
39		if (this[visibility] == false) show = false;
40		if (this[binding] == false) show = false;
41		if (this[origin] == false) show = false;
42		if ((this.subgroup != null) && (this.subgroup != 'all')) {
43			if (subgroup != this.subgroup) show = false;
44		}
45
46		// show or hide the element
47		if (show) {
48			// either block or table-row, depending on browswer, so use default
49			element.style["display"] = "";
50		} else {
51			element.style["display"] = "none";
52		}
53
54	}
55
56	// a type filter
57
58	function TypeFilter () {
59
60		// set up defaults
61
62		this.subgroup = "all";
63
64		this.public = true;
65		this.internal = true;
66
67	}
68
69	TypeFilter.prototype.filterElement = function(element) {
70
71		// get the data for the element
72		if (element == null) return;
73		var data = element.getAttribute("data");
74		if (data == null) return;
75		var datum = data.split("; ");
76		if (datum.length != 2) return;
77        
78		// extract the relevent member attributes
79		var subgroup = datum[0];
80		var visibility = datum[1];
81
82		// determine whether to show the member
83		var show = true;
84		if (this[visibility] == false) show = false;
85		if ((this.subgroup != null) && (this.subgroup != 'all')) {
86			if (subgroup != this.subgroup) show = false;
87		}
88
89		// show or hide the element
90		if (show) {
91			// either block or table-row, depending on browser, so use default
92			element.style["display"] = "";
93		} else {
94			element.style["display"] = "none";
95		}
96
97	}
98
99