docs/api-2.1/menu.js

Tue, 22 Oct 2024 12:17:48 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Tue, 22 Oct 2024 12:17:48 +0200
changeset 942
8a5bbdb7f87f
parent 390
d345541018fa
permissions
-rw-r--r--

use json reader state macros everywhere

390
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 function initMenu(relPath,searchEnabled,serverSide,searchPage,search) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 function makeTree(data,relPath) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 var result='';
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 if ('children' in data) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 result+='<ul>';
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 for (var i in data.children) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 result+='<li><a href="'+relPath+data.children[i].url+'">'+
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 data.children[i].text+'</a>'+
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 makeTree(data.children[i],relPath)+'</li>';
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 }
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 result+='</ul>';
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 }
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 return result;
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 }
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 $('#main-nav').append(makeTree(menudata,relPath));
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu');
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 if (searchEnabled) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 if (serverSide) {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><div class="left"><form id="FSearchBox" action="'+searchPage+'" method="get"><img id="MSearchSelect" src="'+relPath+'search/mag.png" alt=""/><input type="text" id="MSearchField" name="query" value="'+search+'" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"></form></div><div class="right"></div></div></li>');
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 } else {
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 $('#main-menu').append('<li style="float:right"><div id="MSearchBox" class="MSearchBoxInactive"><span class="left"><img id="MSearchSelect" src="'+relPath+'search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/><input type="text" id="MSearchField" value="'+search+'" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/></span><span class="right"><a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="'+relPath+'search/close.png" alt=""/></a></span></div></li>');
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 }
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 }
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 $('#main-menu').smartmenus();
d345541018fa starts ucx 3.0 development
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 }

mercurial