hexo-theme-stellar/layout/_partial/sidebar/header.ejs

60 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-02-21 03:13:21 +08:00
<%
2022-11-19 16:48:44 +08:00
var proj;
if (page.layout === 'wiki' && page.wiki) {
proj = theme.wiki.projects[page.wiki];
}
function layoutTitle(main, url, sub) {
var el = '';
el += '<a class="title" href="' + url_for(url || "/") + '">';
el += '<div class="main" ff="title">' + main + '</div>';
if (sub) {
let arr = sub.split('|');
if (arr.length > 1) {
el += '<div class="sub normal cap">' + arr[0].trim() + '</div>';
el += '<div class="sub hover cap" style="opacity:0">' + arr[1].trim() + '</div>';
} else if (arr.length > 0) {
el += '<div class="sub cap">' + arr[0] + '</div>';
}
}
el += '</a>';
return el;
}
2021-06-26 15:02:32 +08:00
function layoutDiv() {
var el = '';
2022-11-19 16:48:44 +08:00
if (page.layout == 'wiki' && page.menu_id == 'wiki') {
return el;
}
2021-06-26 15:02:32 +08:00
el += '<header class="header';
if (where == 'main') {
el += ' mobile-only';
}
el += '">';
2022-11-19 16:48:44 +08:00
el += '<div class="logo-wrap">';
if (md_text(theme.sidebar.logo.avatar)) {
el += '<a class="avatar" href="' + url_for(md_link(theme.sidebar.logo.avatar) || "/") + '">';
if (theme.style.animated_avatar.animate) {
el += '<div class="bg" style="opacity:0;background-image:url(' + theme.style.animated_avatar.background + ');"></div>';
2021-07-04 20:21:31 +08:00
}
2022-11-19 16:48:44 +08:00
el += '<img no-lazy class="avatar" src="' + md_text(theme.sidebar.logo.avatar) + '">';
el += '</a>';
}
let main = md_text(theme.sidebar.logo.title);
if (main) {
let url = md_link(theme.sidebar.logo.title);
let sub = config.subtitle;
el += layoutTitle(main, url, sub);
}
el += '</div>';
if (where != 'main') {
el += partial('menu', {where: where});
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() %>