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