dynsections.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.attr('src','ftv2folderopen.png');
  34. a.attr('src','ftv2mnode.png');
  35. $(this).show();
  36. } else if (l==level+1) {
  37. i.attr('src','ftv2folderclosed.png');
  38. a.attr('src','ftv2pnode.png');
  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. var currentRowImages = currentRow.find("img");
  51. //All rows after the clicked row
  52. var rows = currentRow.nextAll("tr");
  53. //Only match elements AFTER this one (can't hide elements before)
  54. var childRows = rows.filter(function() {
  55. var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
  56. return this.id.match(re);
  57. });
  58. //First row is visible we are HIDING
  59. if (childRows.filter(':first').is(':visible')===true) {
  60. currentRowImages.filter("[id^=arr]").attr('src', 'ftv2pnode.png');
  61. currentRowImages.filter("[id^=img]").attr('src', 'ftv2folderclosed.png');
  62. rows.filter("[id^=row_"+id+"]").hide();
  63. } else { //We are SHOWING
  64. //All sub images
  65. var childImages = childRows.find("img");
  66. var childImg = childImages.filter("[id^=img]");
  67. var childArr = childImages.filter("[id^=arr]");
  68. currentRow.find("[id^=arr]").attr('src', 'ftv2mnode.png'); //open row
  69. currentRow.find("[id^=img]").attr('src', 'ftv2folderopen.png'); //open row
  70. childImg.attr('src','ftv2folderclosed.png'); //children closed
  71. childArr.attr('src','ftv2pnode.png'); //children closed
  72. childRows.show(); //show all children
  73. }
  74. updateStripes();
  75. }
  76. function toggleInherit(id)
  77. {
  78. var rows = $('tr.inherit.'+id);
  79. var img = $('tr.inherit_header.'+id+' img');
  80. var src = $(img).attr('src');
  81. if (rows.filter(':first').is(':visible')===true) {
  82. rows.css('display','none');
  83. $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
  84. } else {
  85. rows.css('display','table-row'); // using show() causes jump in firefox
  86. $(img).attr('src',src.substring(0,src.length-10)+'open.png');
  87. }
  88. }