dynsections.js 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. function toggleVisibility(linkObj)
  2. {
  3. var base = $(linkObj).attr('id');
  4. var summary = $('#'+base+'-summary');
  5. var content = $('#'+base+'-content');
  6. var trigger = $('#'+base+'-trigger');
  7. var src=$(trigger).attr('src');
  8. if (content.is(':visible')===true) {
  9. content.hide();
  10. summary.show();
  11. $(linkObj).addClass('closed').removeClass('opened');
  12. $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
  13. } else {
  14. content.show();
  15. summary.hide();
  16. $(linkObj).removeClass('closed').addClass('opened');
  17. $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
  18. }
  19. return false;
  20. }
  21. function updateStripes()
  22. {
  23. $('table.directory tr').
  24. removeClass('even').filter(':visible:even').addClass('even');
  25. }
  26. function toggleLevel(level)
  27. {
  28. $('table.directory tr').each(function() {
  29. var l = this.id.split('_').length-1;
  30. var i = $('#img'+this.id.substring(3));
  31. var a = $('#arr'+this.id.substring(3));
  32. if (l<level+1) {
  33. i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
  34. a.html('&#9660;');
  35. $(this).show();
  36. } else if (l==level+1) {
  37. i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
  38. a.html('&#9658;');
  39. $(this).show();
  40. } else {
  41. $(this).hide();
  42. }
  43. });
  44. updateStripes();
  45. }
  46. function toggleFolder(id)
  47. {
  48. // the clicked row
  49. var currentRow = $('#row_'+id);
  50. // all rows after the clicked row
  51. var rows = currentRow.nextAll("tr");
  52. var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
  53. // only match elements AFTER this one (can't hide elements before)
  54. var childRows = rows.filter(function() { return this.id.match(re); });
  55. // first row is visible we are HIDING
  56. if (childRows.filter(':first').is(':visible')===true) {
  57. // replace down arrow by right arrow for current row
  58. var currentRowSpans = currentRow.find("span");
  59. currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
  60. currentRowSpans.filter(".arrow").html('&#9658;');
  61. rows.filter("[id^=row_"+id+"]").hide(); // hide all children
  62. } else { // we are SHOWING
  63. // replace right arrow by down arrow for current row
  64. var currentRowSpans = currentRow.find("span");
  65. currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
  66. currentRowSpans.filter(".arrow").html('&#9660;');
  67. // replace down arrows by right arrows for child rows
  68. var childRowsSpans = childRows.find("span");
  69. childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
  70. childRowsSpans.filter(".arrow").html('&#9658;');
  71. childRows.show(); //show all children
  72. }
  73. updateStripes();
  74. }
  75. function toggleInherit(id)
  76. {
  77. var rows = $('tr.inherit.'+id);
  78. var img = $('tr.inherit_header.'+id+' img');
  79. var src = $(img).attr('src');
  80. if (rows.filter(':first').is(':visible')===true) {
  81. rows.css('display','none');
  82. $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
  83. } else {
  84. rows.css('display','table-row'); // using show() causes jump in firefox
  85. $(img).attr('src',src.substring(0,src.length-10)+'open.png');
  86. }
  87. }