2021-02-21 03:13:21 +08:00
|
|
|
<%
|
2021-07-04 20:21:31 +08:00
|
|
|
function layoutMenu() {
|
|
|
|
var el = '';
|
|
|
|
el += '<nav class="menu dis-select">'
|
|
|
|
for (let id of Object.keys(theme.sidebar.menu)) {
|
|
|
|
let item = theme.sidebar.menu[id];
|
|
|
|
if (item == undefined || item.length == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
el += '<a class="nav-item';
|
|
|
|
if (id == page.menu_id) {
|
|
|
|
el += ' active';
|
|
|
|
}
|
|
|
|
el += '" href="' + url_for(md_link(item)) + '">';
|
|
|
|
el += __(md_text(item));
|
|
|
|
el += '</a>';
|
|
|
|
}
|
|
|
|
el += '</nav>';
|
|
|
|
return el;
|
|
|
|
}
|
2021-02-21 03:13:21 +08:00
|
|
|
function layoutMainMenu() {
|
|
|
|
var el = '';
|
2021-06-26 15:02:32 +08:00
|
|
|
el += partial('logo');
|
2021-03-05 21:37:28 +08:00
|
|
|
el += '<nav class="menu dis-select">'
|
2021-02-21 03:13:21 +08:00
|
|
|
for (let id of Object.keys(theme.sidebar.menu)) {
|
|
|
|
let item = theme.sidebar.menu[id];
|
2021-02-24 21:27:31 +08:00
|
|
|
if (item == undefined || item.length == 0) {
|
2021-02-22 13:37:58 +08:00
|
|
|
continue;
|
|
|
|
}
|
2021-02-21 03:13:21 +08:00
|
|
|
el += '<a class="nav-item';
|
|
|
|
if (id == page.menu_id) {
|
|
|
|
el += ' active';
|
|
|
|
}
|
2021-02-24 21:27:31 +08:00
|
|
|
el += '" href="' + url_for(md_link(item)) + '">';
|
|
|
|
el += __(md_text(item));
|
2021-02-21 03:13:21 +08:00
|
|
|
el += '</a>';
|
|
|
|
}
|
|
|
|
el += '</nav>';
|
|
|
|
return el;
|
|
|
|
}
|
2021-06-26 15:02:32 +08:00
|
|
|
function layoutWikiMenu() {
|
|
|
|
var el = '';
|
|
|
|
el += partial('logo');
|
|
|
|
return el;
|
|
|
|
}
|
|
|
|
function layoutDiv() {
|
|
|
|
var el = '';
|
|
|
|
el += '<header class="header';
|
|
|
|
if (where == 'main') {
|
|
|
|
el += ' mobile-only';
|
|
|
|
}
|
|
|
|
el += '">';
|
2021-07-04 20:21:31 +08:00
|
|
|
el += partial('logo');
|
|
|
|
if (page.layout === 'wiki' && page.wiki) {
|
|
|
|
if (page.menu_id !== 'wiki') {
|
|
|
|
el += layoutMenu();
|
|
|
|
}
|
2021-06-26 15:02:32 +08:00
|
|
|
} else {
|
2021-07-04 20:21:31 +08:00
|
|
|
el += layoutMenu();
|
2021-06-26 15:02:32 +08:00
|
|
|
}
|
|
|
|
el += '</header>';
|
|
|
|
return el;
|
|
|
|
}
|
2021-02-21 03:13:21 +08:00
|
|
|
%>
|
2021-06-26 15:02:32 +08:00
|
|
|
|
2021-07-04 20:21:31 +08:00
|
|
|
<%- layoutDiv() %>
|