Blame doc/librpm/html/menu.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 initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
2ff057
  function makeTree(data,relPath) {
2ff057
    var result='';
2ff057
    if ('children' in data) {
2ff057
      result+='
    ';
2ff057
      for (var i in data.children) {
2ff057
        result+='
  • '+
  • 2ff057
                                    data.children[i].text+''+
    2ff057
                                    makeTree(data.children[i],relPath)+'';
    2ff057
          }
    2ff057
          result+='';
    2ff057
        }
    2ff057
        return result;
    2ff057
      }
    2ff057
    2ff057
      $('#main-nav').append(makeTree(menudata,relPath));
    2ff057
      $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
    2ff057
      if (searchEnabled) {
    2ff057
        if (serverSide) {
    2ff057
          $('#main-menu').append('
  • <form id="FSearchBox" action="'+searchPage+'" method="get"><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form>
  • ');
    2ff057
        } else {
    2ff057
          $('#main-menu').append('
  • <input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/>
  • ');
    2ff057
        }
    2ff057
      }
    2ff057
      $('#main-menu').smartmenus();
    2ff057
    }
    2ff057
    /* @license-end */