PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/Documentation/Help/scripts/StyleUtilities.js

#
JavaScript | 50 lines | 31 code | 14 blank | 5 comment | 15 complexity | 809b31e1158176a8b7866501273ea7c2 MD5 | raw file
 1
 2	function getStyleDictionary() {
 3	
 4		var dictionary = new Array();
 5
 6		// iterate through stylesheets
 7		var sheets = document.styleSheets;
 8		for(var i=0; i<sheets.length;i++) {
 9			var sheet = sheets[i];
10
11            // ignore sheets at ms-help Urls
12            if (sheet.href.substr(0,8) == 'ms-help:') continue;
13
14			// get sheet rules
15			var rules = sheet.cssRules;
16			if (rules == null) rules = sheet.rules;
17			
18			// iterate through rules
19			for(j=0; j<rules.length; j++) {
20				var rule = rules[j];
21				
22				// add rule to dictionary
23				dictionary[rule.selectorText.toLowerCase()] = rule.style;
24
25			}
26		}
27
28		return(dictionary);
29
30	}
31
32	function toggleVisibleLanguage(id) {
33
34        if (id == 'cs') {
35			sd['span.cs'].display = 'inline';
36			sd['span.vb'].display = 'none';
37			sd['span.cpp'].display = 'none';
38        } else if (id == 'vb') {
39			sd['span.cs'].display = 'none';
40			sd['span.vb'].display = 'inline';
41			sd['span.cpp'].display = 'none';
42		} else if (id == 'cpp') {
43			sd['span.cs'].display = 'none';
44			sd['span.vb'].display = 'none';
45			sd['span.cpp'].display = 'inline';
46		} else {
47		}
48
49	}
50