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