2
0

dynsections.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. @licstart The following is the entire license notice for the JavaScript code in this file.
  3. The MIT License (MIT)
  4. Copyright (C) 1997-2020 by Dimitri van Heesch
  5. Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  6. and associated documentation files (the "Software"), to deal in the Software without restriction,
  7. including without limitation the rights to use, copy, modify, merge, publish, distribute,
  8. sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
  9. furnished to do so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all copies or
  11. substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  13. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  14. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  17. @licend The above is the entire license notice 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 */