dynsections.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. @licstart The following is the entire license notice for the
  3. JavaScript code in this file.
  4. Copyright (C) 1997-2017 by Dimitri van Heesch
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License along
  14. with this program; if not, write to the Free Software Foundation, Inc.,
  15. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. @licend The above is the entire license notice
  17. for the JavaScript code in this file
  18. */
  19. function toggleVisibility(linkObj)
  20. {
  21. var base = $(linkObj).attr('id');
  22. var summary = $('#'+base+'-summary');
  23. var content = $('#'+base+'-content');
  24. var trigger = $('#'+base+'-trigger');
  25. var src=$(trigger).attr('src');
  26. if (content.is(':visible')===true) {
  27. content.hide();
  28. summary.show();
  29. $(linkObj).addClass('closed').removeClass('opened');
  30. $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
  31. } else {
  32. content.show();
  33. summary.hide();
  34. $(linkObj).removeClass('closed').addClass('opened');
  35. $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
  36. }
  37. return false;
  38. }
  39. function updateStripes()
  40. {
  41. $('table.directory tr').
  42. removeClass('even').filter(':visible:even').addClass('even');
  43. }
  44. function toggleLevel(level)
  45. {
  46. $('table.directory tr').each(function() {
  47. var l = this.id.split('_').length-1;
  48. var i = $('#img'+this.id.substring(3));
  49. var a = $('#arr'+this.id.substring(3));
  50. if (l<level+1) {
  51. i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
  52. a.html('&#9660;');
  53. $(this).show();
  54. } else if (l==level+1) {
  55. i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
  56. a.html('&#9658;');
  57. $(this).show();
  58. } else {
  59. $(this).hide();
  60. }
  61. });
  62. updateStripes();
  63. }
  64. function toggleFolder(id)
  65. {
  66. // the clicked row
  67. var currentRow = $('#row_'+id);
  68. // all rows after the clicked row
  69. var rows = currentRow.nextAll("tr");
  70. var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
  71. // only match elements AFTER this one (can't hide elements before)
  72. var childRows = rows.filter(function() { return this.id.match(re); });
  73. // first row is visible we are HIDING
  74. if (childRows.filter(':first').is(':visible')===true) {
  75. // replace down arrow by right arrow for current row
  76. var currentRowSpans = currentRow.find("span");
  77. currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
  78. currentRowSpans.filter(".arrow").html('&#9658;');
  79. rows.filter("[id^=row_"+id+"]").hide(); // hide all children
  80. } else { // we are SHOWING
  81. // replace right arrow by down arrow for current row
  82. var currentRowSpans = currentRow.find("span");
  83. currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
  84. currentRowSpans.filter(".arrow").html('&#9660;');
  85. // replace down arrows by right arrows for child rows
  86. var childRowsSpans = childRows.find("span");
  87. childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
  88. childRowsSpans.filter(".arrow").html('&#9658;');
  89. childRows.show(); //show all children
  90. }
  91. updateStripes();
  92. }
  93. function toggleInherit(id)
  94. {
  95. var rows = $('tr.inherit.'+id);
  96. var img = $('tr.inherit_header.'+id+' img');
  97. var src = $(img).attr('src');
  98. if (rows.filter(':first').is(':visible')===true) {
  99. rows.css('display','none');
  100. $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
  101. } else {
  102. rows.css('display','table-row'); // using show() causes jump in firefox
  103. $(img).attr('src',src.substring(0,src.length-10)+'open.png');
  104. }
  105. }
  106. /* @license-end */