Blame templates/html/menu.js

Packit 1c1d7e
/*
Packit 1c1d7e
 @licstart  The following is the entire license notice for the
Packit 1c1d7e
 JavaScript code in this file.
Packit 1c1d7e
Packit 1c1d7e
 Copyright (C) 1997-2017 by Dimitri van Heesch
Packit 1c1d7e
Packit 1c1d7e
 This program is free software; you can redistribute it and/or modify
Packit 1c1d7e
 it under the terms of the GNU General Public License as published by
Packit 1c1d7e
 the Free Software Foundation; either version 2 of the License, or
Packit 1c1d7e
 (at your option) any later version.
Packit 1c1d7e
Packit 1c1d7e
 This program is distributed in the hope that it will be useful,
Packit 1c1d7e
 but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 1c1d7e
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 1c1d7e
 GNU General Public License for more details.
Packit 1c1d7e
Packit 1c1d7e
 You should have received a copy of the GNU General Public License along
Packit 1c1d7e
 with this program; if not, write to the Free Software Foundation, Inc.,
Packit 1c1d7e
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Packit 1c1d7e
Packit 1c1d7e
 @licend  The above is the entire license notice
Packit 1c1d7e
 for the JavaScript code in this file
Packit 1c1d7e
 */
Packit 1c1d7e
function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
Packit 1c1d7e
  function makeTree(data,relPath) {
Packit 1c1d7e
    var result='';
Packit 1c1d7e
    if ('children' in data) {
Packit 1c1d7e
      result+='
    ';
Packit 1c1d7e
      for (var i in data.children) {
Packit 1c1d7e
        result+='
  • '+
  • Packit 1c1d7e
                                    data.children[i].text+''+
    Packit 1c1d7e
                                    makeTree(data.children[i],relPath)+'';
    Packit 1c1d7e
          }
    Packit 1c1d7e
          result+='';
    Packit 1c1d7e
        }
    Packit 1c1d7e
        return result;
    Packit 1c1d7e
      }
    Packit 1c1d7e
    Packit 1c1d7e
      $('#main-nav').append(makeTree(menudata,relPath));
    Packit 1c1d7e
      $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
    Packit 1c1d7e
      if (searchEnabled) {
    Packit 1c1d7e
        if (serverSide) {
    Packit 1c1d7e
          $('#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>
  • ');
    Packit 1c1d7e
        } else {
    Packit 1c1d7e
          $('#main-menu').append('
  • <input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/>
  • ');
    Packit 1c1d7e
        }
    Packit 1c1d7e
      }
    Packit 1c1d7e
      $('#main-menu').smartmenus();
    Packit 1c1d7e
    }
    Packit 1c1d7e
    /* @license-end */