NBash
121 строка · 4.3 Кб
1/*
2@licstart The following is the entire license notice for the JavaScript code in this file.
3
4The MIT License (MIT)
5
6Copyright (C) 1997-2020 by Dimitri van Heesch
7
8Permission is hereby granted, free of charge, to any person obtaining a copy of this software
9and associated documentation files (the "Software"), to deal in the Software without restriction,
10including without limitation the rights to use, copy, modify, merge, publish, distribute,
11sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all copies or
15substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
18BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23@licend The above is the entire license notice for the JavaScript code in this file
24*/
25function toggleVisibility(linkObj)26{
27var base = $(linkObj).attr('id');28var summary = $('#'+base+'-summary');29var content = $('#'+base+'-content');30var trigger = $('#'+base+'-trigger');31var src=$(trigger).attr('src');32if (content.is(':visible')===true) {33content.hide();34summary.show();35$(linkObj).addClass('closed').removeClass('opened');36$(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');37} else {38content.show();39summary.hide();40$(linkObj).removeClass('closed').addClass('opened');41$(trigger).attr('src',src.substring(0,src.length-10)+'open.png');42}43return false;44}
45
46function updateStripes()47{
48$('table.directory tr').49removeClass('even').filter(':visible:even').addClass('even');50}
51
52function toggleLevel(level)53{
54$('table.directory tr').each(function() {55var l = this.id.split('_').length-1;56var i = $('#img'+this.id.substring(3));57var a = $('#arr'+this.id.substring(3));58if (l<level+1) {59i.removeClass('iconfopen iconfclosed').addClass('iconfopen');60a.html('▼');61$(this).show();62} else if (l==level+1) {63i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');64a.html('►');65$(this).show();66} else {67$(this).hide();68}69});70updateStripes();71}
72
73function toggleFolder(id)74{
75// the clicked row76var currentRow = $('#row_'+id);77
78// all rows after the clicked row79var rows = currentRow.nextAll("tr");80
81var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub82
83// only match elements AFTER this one (can't hide elements before)84var childRows = rows.filter(function() { return this.id.match(re); });85
86// first row is visible we are HIDING87if (childRows.filter(':first').is(':visible')===true) {88// replace down arrow by right arrow for current row89var currentRowSpans = currentRow.find("span");90currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");91currentRowSpans.filter(".arrow").html('►');92rows.filter("[id^=row_"+id+"]").hide(); // hide all children93} else { // we are SHOWING94// replace right arrow by down arrow for current row95var currentRowSpans = currentRow.find("span");96currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");97currentRowSpans.filter(".arrow").html('▼');98// replace down arrows by right arrows for child rows99var childRowsSpans = childRows.find("span");100childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");101childRowsSpans.filter(".arrow").html('►');102childRows.show(); //show all children103}104updateStripes();105}
106
107
108function toggleInherit(id)109{
110var rows = $('tr.inherit.'+id);111var img = $('tr.inherit_header.'+id+' img');112var src = $(img).attr('src');113if (rows.filter(':first').is(':visible')===true) {114rows.css('display','none');115$(img).attr('src',src.substring(0,src.length-8)+'closed.png');116} else {117rows.css('display','table-row'); // using show() causes jump in firefox118$(img).attr('src',src.substring(0,src.length-10)+'open.png');119}120}
121/* @license-end */
122