PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Documentation/Help/scripts/StyleUtilities.js

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