PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/Source/Sandcastle/Presentation/hana/Scripts/MemberFilter.js

#
JavaScript | 110 lines | 63 code | 33 blank | 14 comment | 40 complexity | 4fc2397ad3e6ee66ce9c35e5c25a4525 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  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		this.compact = true;
 21		
 22		this.xna = true;
 23	}
 24
 25	MemberFilter.prototype.filterElement = function(element) {
 26
 27		// get the data for the element
 28		if (element == null) return;
 29		var data = element.getAttribute("data");
 30		if (data == null) return;
 31		var datum = data.split("; ");
 32		if (datum.length != 6) return;
 33        
 34		// extract the relevent member attributes
 35		var subgroup = datum[0];
 36		var visibility = datum[1];
 37		var binding = datum[2];
 38		var origin = datum[3];
 39		var compactFramework = datum[4];
 40		var xnaFramework = datum[5];
 41
 42		
 43		// determine whether to show the member
 44		var show = true;
 45		if (this[visibility] == false) show = false;
 46		if (this[binding] == false) show = false;
 47		if (this[origin] == false) show = false;
 48		if (this[compactFramework] == false) show = false;
 49		if(this[xnaFramework] == false) show = false;
 50				
 51		if ((this.subgroup != null) && (this.subgroup != 'all')) {
 52			if (subgroup != this.subgroup) show = false;
 53		}
 54
 55
 56		// show or hide the element
 57		if (show) {
 58			// either block or table-row, depending on browswer, so use default
 59			element.style["display"] = "";
 60		} else {
 61			element.style["display"] = "none";
 62		}
 63
 64	}
 65
 66	// a type filter
 67
 68	function TypeFilter () {
 69
 70		// set up defaults
 71
 72
 73		this.subgroup = "all";
 74
 75		this.public = true;
 76		this.internal = true;
 77
 78	}
 79
 80	TypeFilter.prototype.filterElement = function(element) {
 81
 82		// get the data for the element
 83		if (element == null) return;
 84		var data = element.getAttribute("data");
 85		if (data == null) return;
 86		var datum = data.split("; ");
 87		if (datum.length != 2) return;
 88        
 89		// extract the relevent member attributes
 90		var subgroup = datum[0];
 91		var visibility = datum[1];
 92
 93		// determine whether to show the member
 94		var show = true;
 95		if (this[visibility] == false) show = false;
 96		if ((this.subgroup != null) && (this.subgroup != 'all')) {
 97			if (subgroup != this.subgroup) show = false;
 98		}
 99
100		// show or hide the element
101		if (show) {
102			// either block or table-row, depending on browser, so use default
103			element.style["display"] = "";
104		} else {
105			element.style["display"] = "none";
106		}
107
108	}
109
110