Blame doc/librpm/html/dynsections.js

2ff057
/*
2ff057
 @licstart  The following is the entire license notice for the
2ff057
 JavaScript code in this file.
2ff057
2ff057
 Copyright (C) 1997-2017 by Dimitri van Heesch
2ff057
2ff057
 This program is free software; you can redistribute it and/or modify
2ff057
 it under the terms of the GNU General Public License as published by
2ff057
 the Free Software Foundation; either version 2 of the License, or
2ff057
 (at your option) any later version.
2ff057
2ff057
 This program is distributed in the hope that it will be useful,
2ff057
 but WITHOUT ANY WARRANTY; without even the implied warranty of
2ff057
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2ff057
 GNU General Public License for more details.
2ff057
2ff057
 You should have received a copy of the GNU General Public License along
2ff057
 with this program; if not, write to the Free Software Foundation, Inc.,
2ff057
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2ff057
2ff057
 @licend  The above is the entire license notice
2ff057
 for the JavaScript code in this file
2ff057
 */
2ff057
function toggleVisibility(linkObj)
2ff057
{
2ff057
 var base = $(linkObj).attr('id');
2ff057
 var summary = $('#'+base+'-summary');
2ff057
 var content = $('#'+base+'-content');
2ff057
 var trigger = $('#'+base+'-trigger');
2ff057
 var src=$(trigger).attr('src');
2ff057
 if (content.is(':visible')===true) {
2ff057
   content.hide();
2ff057
   summary.show();
2ff057
   $(linkObj).addClass('closed').removeClass('opened');
2ff057
   $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
2ff057
 } else {
2ff057
   content.show();
2ff057
   summary.hide();
2ff057
   $(linkObj).removeClass('closed').addClass('opened');
2ff057
   $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
2ff057
 }
2ff057
 return false;
2ff057
}
2ff057
2ff057
function updateStripes()
2ff057
{
2ff057
  $('table.directory tr').
2ff057
       removeClass('even').filter(':visible:even').addClass('even');
2ff057
}
2ff057
2ff057
function toggleLevel(level)
2ff057
{
2ff057
  $('table.directory tr').each(function() {
2ff057
    var l = this.id.split('_').length-1;
2ff057
    var i = $('#img'+this.id.substring(3));
2ff057
    var a = $('#arr'+this.id.substring(3));
2ff057
    if (l
2ff057
      i.removeClass('iconfopen iconfclosed').addClass('iconfopen');
2ff057
      a.html('▼');
2ff057
      $(this).show();
2ff057
    } else if (l==level+1) {
2ff057
      i.removeClass('iconfclosed iconfopen').addClass('iconfclosed');
2ff057
      a.html('▶');
2ff057
      $(this).show();
2ff057
    } else {
2ff057
      $(this).hide();
2ff057
    }
2ff057
  });
2ff057
  updateStripes();
2ff057
}
2ff057
2ff057
function toggleFolder(id)
2ff057
{
2ff057
  // the clicked row
2ff057
  var currentRow = $('#row_'+id);
2ff057
2ff057
  // all rows after the clicked row
2ff057
  var rows = currentRow.nextAll("tr");
2ff057
2ff057
  var re = new RegExp('^row_'+id+'\\d+_$', "i"); //only one sub
2ff057
2ff057
  // only match elements AFTER this one (can't hide elements before)
2ff057
  var childRows = rows.filter(function() { return this.id.match(re); });
2ff057
2ff057
  // first row is visible we are HIDING
2ff057
  if (childRows.filter(':first').is(':visible')===true) {
2ff057
    // replace down arrow by right arrow for current row
2ff057
    var currentRowSpans = currentRow.find("span");
2ff057
    currentRowSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
2ff057
    currentRowSpans.filter(".arrow").html('▶');
2ff057
    rows.filter("[id^=row_"+id+"]").hide(); // hide all children
2ff057
  } else { // we are SHOWING
2ff057
    // replace right arrow by down arrow for current row
2ff057
    var currentRowSpans = currentRow.find("span");
2ff057
    currentRowSpans.filter(".iconfclosed").removeClass("iconfclosed").addClass("iconfopen");
2ff057
    currentRowSpans.filter(".arrow").html('▼');
2ff057
    // replace down arrows by right arrows for child rows
2ff057
    var childRowsSpans = childRows.find("span");
2ff057
    childRowsSpans.filter(".iconfopen").removeClass("iconfopen").addClass("iconfclosed");
2ff057
    childRowsSpans.filter(".arrow").html('▶');
2ff057
    childRows.show(); //show all children
2ff057
  }
2ff057
  updateStripes();
2ff057
}
2ff057
2ff057
2ff057
function toggleInherit(id)
2ff057
{
2ff057
  var rows = $('tr.inherit.'+id);
2ff057
  var img = $('tr.inherit_header.'+id+' img');
2ff057
  var src = $(img).attr('src');
2ff057
  if (rows.filter(':first').is(':visible')===true) {
2ff057
    rows.css('display','none');
2ff057
    $(img).attr('src',src.substring(0,src.length-8)+'closed.png');
2ff057
  } else {
2ff057
    rows.css('display','table-row'); // using show() causes jump in firefox
2ff057
    $(img).attr('src',src.substring(0,src.length-10)+'open.png');
2ff057
  }
2ff057
}
2ff057
/* @license-end */
2ff057
2ff057
$(document).ready(function() {
2ff057
  $('.code,.codeRef').each(function() {
2ff057
    $(this).data('powertip',$('#'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html());
2ff057
    $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true });
2ff057
  });
2ff057
});