This commit is contained in:
xaoxuu 2021-02-20 13:09:41 +08:00
parent 6ea7fc3683
commit c22599abbe
43 changed files with 208 additions and 204 deletions

View File

@ -1,4 +1,3 @@
.github/
publish.sh
node_modules
node_modules

View File

@ -137,6 +137,7 @@ plugins:
enable: true
css: https://unpkg.com/swiper/swiper-bundle.min.css
js: https://unpkg.com/swiper/swiper-bundle.min.js
## optional plugins ##
# preload
preload:

View File

@ -15,10 +15,9 @@ btn:
meta:
recent_update: Recent Update
toc: TOC
read_prev: PREV
read_next: NEXT
read_prev: or prev
read_next: READ NEXT
older: Older
newer: Newer
references: References
comment_title: Join the discussion
back_to_top: Back to top

View File

@ -15,10 +15,9 @@ btn:
meta:
recent_update: 最近更新
toc: 本文目录
read_prev: 回顾上一篇
read_prev: 上一篇
read_next: 接下来阅读
older: 较早文章
newer: 较新文章
older: 更早一篇
references: 参考资料
comment_title: 快来参与讨论吧
back_to_top: 回到顶部

View File

@ -15,10 +15,9 @@ btn:
meta:
recent_update: 最近更新
toc: 本文目錄
read_prev: 回顧上一篇
read_prev: 上一篇
read_next: 接下來閱讀
older: 較早文章
newer: 較新文章
older: 更早一篇
references: 參考資料
comment_title: 快來參與討論吧
back_to_top: 回到頂部

View File

@ -2,7 +2,7 @@
page.class = '404';
page.layout = '404';
page.comment_title = '';
page.comment_id = '1';
page.header = false;
%>
<article class='md error-page'>
<h1><img id='error' src="https://7.dusays.com/2021/02/14/f5b2af33b70c2.svg" alt=""></h1>

View File

@ -1,89 +0,0 @@
<%
function layoutDiv() {
var prev,next;
var title = '';
var title_prev = '';
var title_next = '';
if (page.layout == 'post') {
prev = page.prev;
next = page.next;
title = __('meta.read_next');
title_prev = __('meta.newer');
title_next = __('meta.older');
} else if (page.layout == 'wiki' && page.wiki && page.wiki.length > 0) {
title = page.wiki;
title_prev = __('meta.read_prev');
title_next = __('meta.read_next');
var wikis = [];
wikis = site.pages.filter(function (p) {
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki) {
if (p.order == undefined) {
p.order = 0;
}
return true;
} else {
return false;
}
}).sort('order');
wikis.forEach((p, i) => {
if (p.order < page.order) {
if (prev == undefined || p.order > prev.order) {
prev = p;
}
} else if (p.order > page.order) {
if (next == undefined || p.order < next.order) {
next = p;
}
}
});
}
let wrapper = '';
if (prev || next) {
wrapper += '<div class="read-next-wrap">';
wrapper += '<section class="header cap cyan">';
wrapper += '<span>' + title + '</span>';
wrapper += '</section>';
wrapper += '<section class="body">';
if (page.layout == 'wiki') {
if (next) {
wrapper += '<div class="post-title unread">';
wrapper += '<a href="' + url_for(next.path) + '">';
wrapper += title_next + __('symbol.colon');
wrapper += next.title || next.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
if (prev) {
wrapper += '<div class="post-title read">';
wrapper += '<a href="' + url_for(prev.path) + '">';
wrapper += title_prev + __('symbol.colon');
wrapper += prev.title || prev.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
} else {
if (prev) {
wrapper += '<div class="post-title">';
wrapper += '<a href="' + url_for(prev.path) + '">';
wrapper += title_prev + __('symbol.colon');
wrapper += prev.title || prev.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
if (next) {
wrapper += '<div class="post-title">';
wrapper += '<a href="' + url_for(next.path) + '">';
wrapper += title_next + __('symbol.colon');
wrapper += next.title || next.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
}
wrapper += '</section>';
wrapper += '</div>';
}
return wrapper;
}
%>
<%- layoutDiv(); %>

View File

@ -0,0 +1,63 @@
<%
function layoutDiv() {
var prev,next;
var title = __('meta.read_next');
var title_prev = __('meta.read_prev');
if (page.layout == 'post') {
prev = page.next;
next = page.prev;
title_prev = __('meta.older');
} else if (page.layout == 'wiki' && page.wiki && page.wiki.length > 0) {
title_prev = __('meta.read_prev');
var wikis = [];
wikis = site.pages.filter(function (p) {
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki) {
if (p.order == undefined) {
p.order = 0;
}
return true;
} else {
return false;
}
}).sort('order');
wikis.forEach((p, i) => {
if (p.order < page.order) {
if (prev == undefined || p.order > prev.order) {
prev = p;
}
} else if (p.order > page.order) {
if (next == undefined || p.order < next.order) {
next = p;
}
}
});
}
let wrapper = '';
if (prev || next) {
wrapper += '<div class="read-next-wrap">';
wrapper += '<section class="header cap cyan">';
wrapper += '<span>' + title + '</span>';
wrapper += '</section>';
wrapper += '<section class="body">';
if (next) {
wrapper += '<div class="post-title unread">';
wrapper += '<a href="' + url_for(next.path) + '">';
wrapper += next.title || next.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
if (prev) {
wrapper += '<div class="post-title read">';
wrapper += '<a href="' + url_for(prev.path) + '">';
wrapper += title_prev + __('symbol.colon');
wrapper += prev.title || prev.seo_title;
wrapper += '</a>';
wrapper += '</div>';
}
wrapper += '</section>';
wrapper += '</div>';
}
return wrapper;
}
%>
<%- layoutDiv(); %>

View File

@ -0,0 +1,6 @@
<%
console.log(page.path, page.header);
%>
<% if (page.header != false) { %>
<%- partial('../../sidebar/header') %>
<% } %>

View File

@ -0,0 +1,28 @@
<div class='nav-wrap'>
<nav class='sub post cap green'>
<% if (is_home()) { %>
<a class='active' href='/'><%- __('btn.recent_publish') %></a>
<% } else { %>
<a href='/'><%- __('btn.recent_publish') %></a>
<% } %>
<% if (page.category) { %>
<a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.category') + __('symbol.colon') + page.category %></a>
<% } else if (page.layout == 'categories') { %>
<a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
<% } else { %>
<a href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
<% } %>
<% if (page.tag) { %>
<a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tag') + __('symbol.colon') + page.tag %></a>
<% } else if (page.layout == 'tags') { %>
<a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
<% } else { %>
<a href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
<% } %>
<% if (is_archive()) { %>
<a class='active' href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
<% } else { %>
<a href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
<% } %>
</nav>
</div>

View File

@ -0,0 +1,28 @@
<div class='nav-wrap'>
<nav class='sub wiki cap green'>
<% if (page.layout == 'index' && page.title && page.wiki) { %>
<a href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } else { %>
<a class='active' href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } %>
<%
var groups = [];
var paths = [];
site.pages.filter(function (p) {
return p.layout == 'index' && p.title && p.wiki;
}).sort('order').each(function(p) {
if (groups.includes(p.wiki) == false) {
groups.push(p.title);
paths.push(p.path);
}
});
%>
<% groups.forEach((group, i) => { %>
<% if (page.title == group) { %>
<a class='active' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } else { %>
<a class='' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } %>
<% }); %>
</nav>
</div>

View File

@ -1,27 +0,0 @@
<nav class='cap green'>
<% if (is_home()) { %>
<a class='active' href='/'><%- __('btn.recent_publish') %></a>
<% } else { %>
<a href='/'><%- __('btn.recent_publish') %></a>
<% } %>
<% if (page.category) { %>
<a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.category') + __('symbol.colon') + page.category %></a>
<% } else if (page.layout == 'categories') { %>
<a class='active' href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
<% } else { %>
<a href='<%- url_for(config.category_dir) %>'><%- __('btn.categories') %></a>
<% } %>
<% if (page.tag) { %>
<a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tag') + __('symbol.colon') + page.tag %></a>
<% } else if (page.layout == 'tags') { %>
<a class='active' href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
<% } else { %>
<a href='<%- url_for(config.tag_dir) %>'><%- __('btn.tags') %></a>
<% } %>
<% if (is_archive()) { %>
<a class='active' href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
<% } else { %>
<a href='<%- url_for(config.archive_dir) %>'><%- __('btn.archives') %></a>
<% } %>
</nav>

View File

@ -1,26 +0,0 @@
<nav class='cap green'>
<% if (page.layout == 'index' && page.title && page.wiki) { %>
<a href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } else { %>
<a class='active' href='/wiki/'><%- __('btn.all_wiki') %></a>
<% } %>
<%
var groups = [];
var paths = [];
site.pages.filter(function (p) {
return p.layout == 'index' && p.title && p.wiki;
}).sort('order').each(function(p) {
if (groups.includes(p.wiki) == false) {
groups.push(p.title);
paths.push(p.path);
}
});
%>
<% groups.forEach((group, i) => { %>
<% if (page.title == group) { %>
<a class='active' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } else { %>
<a class='' href='<%- url_for(paths[i]) %>'><%- group %></a>
<% } %>
<% }); %>
</nav>

View File

@ -1,11 +1,12 @@
<!-- required -->
<%- partial('global') %>
<%- js({src: theme.plugins.jquery || 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js'}) %>
<% if (theme.stellar.cdn_js) { %>
<%- js({src: theme.stellar.cdn_js, async: true}) %>
<% } else { %>
<%- js({src: 'js/main.js', async: true}) %>
<% } %>
<%- js({src: theme.plugins.jquery || 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js'}) %>
<!-- optional -->

View File

@ -12,6 +12,5 @@
</a>
<% } %>
<% }); %>
</nav>
</header>
</header>

View File

@ -1,6 +1,8 @@
<a class='logo-wrap' href='/'>
<% if (theme.sidebar.logo.avatar != false) { %>
<div class='img'><img no-lazy src='<%- theme.sidebar.logo.avatar || config.avatar %>'/></div>
<% } %>
<div class='title'><%- theme.sidebar.logo.title || config.title %></div>
</a>
<div class='logo-wrap'>
<a href='/'>
<% if (theme.sidebar.logo.avatar != false) { %>
<div class='img'><img no-lazy src='<%- theme.sidebar.logo.avatar || config.avatar %>'/></div>
<% } %>
<span class='title'><%- theme.sidebar.logo.title || config.title %></span>
</a>
</div>

View File

@ -7,7 +7,7 @@ if (page.class == undefined) {
<%- partial('index') %>
<% } else { %>
<% page.title = __('btn.archives'); %>
<%- partial('_partial/navbar/list_post') %>
<%- partial('_partial/main/navbar/list_post') %>
<div class='post-list'>
<% var years = []; %>
<% site.posts.sort('date', -1).each(function(post) { %>

View File

@ -6,7 +6,7 @@ if (page.class == undefined) {
<% if (site.categories.length) { %>
<% page.title = __('btn.categories'); %>
<% page.layout = 'categories'; %>
<%- partial('_partial/navbar/list_post') %>
<%- partial('_partial/main/navbar/list_post') %>
<div class='post-list'>
<div class='list-title'><%- __('page.categories', site.categories.length) %></div>
<article class='post-card reveal' id='cats'>

View File

@ -8,28 +8,28 @@ if (page.class == undefined) {
}
%>
<% if (page.class == 'post') { %>
<%- partial('_partial/navbar/list_post') %>
<%- partial('_partial/main/navbar/list_post') %>
<% if (page.posts) { %>
<div class='post-list post'>
<% page.posts.each(function(post){ %>
<a class='post-card post reveal' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'>
<%- partial('_partial/post_list/post_card', {post: post}) %>
<%- partial('_partial/main/post_list/post_card', {post: post}) %>
</article>
</a>
<% }) %>
<%- partial('_partial/post_list/paginator') %>
<%- partial('_partial/main/post_list/paginator') %>
</div>
<% } %>
<% } else if (page.class == 'wiki') { %>
<% function outputExcerpt(post) { %>
<a class='post-card wiki reveal' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'>
<%- partial('_partial/post_list/wiki_card', {post: post}) %>
<%- partial('_partial/main/post_list/wiki_card', {post: post}) %>
</article>
</a>
<% } %>
<%- partial('_partial/navbar/list_wiki') %>
<%- partial('_partial/main/navbar/list_wiki') %>
<% if (page.title && page.wiki) { %>
<div class='post-list wiki filter'>
<% page.wiki.forEach((wiki, i) => { %>

View File

@ -2,13 +2,13 @@
<html lang='<%- page.lang %>'>
<%- partial('_partial/head') %>
<body theme='<%- page.dark ? "dark" : "light" %>'>
<%- partial('_partial/article/wiki_cover') %>
<%- partial('_partial/main/article/wiki_cover') %>
<div class='l_body' id='start'>
<aside class='l_left'>
<%- partial('_partial/sidebar/index') %>
</aside>
<div class='l_main<%- page.content ? "" : " list" %>'>
<%- partial('_partial/sidebar/header') %>
<%- partial('_partial/main/header/index') %>
<%- body %>
<footer class='page-footer'>
<%- partial('_partial/footer') %>

View File

@ -1,5 +1,5 @@
<% if ((page.h1 && page.h1.length > 0) || (page.content && page.content.length > 0)) { %>
<%- partial('_partial/navbar/breadcrumb') %>
<%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- page.layout %> reveal'>
<% if (page.h1 && page.h1.length > 0) { %>
<h1 class='article-title'><span><%- page.h1 %></span></h1>

View File

@ -2,14 +2,18 @@
if (page.class == undefined) {
page.class = 'post';
}
if (page.header == undefined) {
page.header = false;
console.log('header = false');
}
%>
<% let post = page; %>
<%- partial('_partial/navbar/breadcrumb') %>
<%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- post.layout %> reveal'>
<h1 class='article-title'><span><%- post.h1 || post.title %></span></h1>
<%- post.content %>
</article>
<%- partial('_partial/article/references') %>
<%- partial('_partial/article/read_next') %>
<%- partial('_partial/article/related_posts') %>
<%- partial('_partial/main/article/references') %>
<%- partial('_partial/main/article/read_next') %>
<%- partial('_partial/main/article/related_posts') %>
<%- partial('_partial/plugins/comments/layout') %>

View File

@ -6,7 +6,7 @@ if (page.class == undefined) {
<% if (site.tags.length) { %>
<% page.title = __('btn.tags'); %>
<% page.layout = 'tags'; %>
<%- partial('_partial/navbar/list_post') %>
<%- partial('_partial/main/navbar/list_post') %>
<div class='post-list'>
<div class='list-title'><%- __('page.tags', site.tags.length) %></div>
<article class='post-card reveal' id='tags'>

View File

@ -12,11 +12,16 @@ if (page.title == undefined) {
<% if (page.layout == 'index') { %>
<%- partial('index') %>
<% } else { %>
<%- partial('_partial/navbar/breadcrumb') %>
<%
if (page.header == undefined) {
page.header = false;
}
%>
<%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- page.layout %>'>
<h1 class='article-title'><span><%- page.h1 || page.title %></span></h1>
<%- page.content %>
</article>
<%- partial('_partial/article/read_next') %>
<%- partial('_partial/main/article/read_next') %>
<%- partial('_partial/plugins/comments/layout') %>
<% } %>

View File

@ -46,6 +46,8 @@ $fs-h3 = 1.375rem // 22px
$fs-h4 = 1.125rem // 18px
$fs-h5 = 1rem // 16px
$fs-h6 = 1rem // 16px
$fsh2 = 1.5rem // 24px
$fs15 = .9375rem // 15px
$fs14 = .875rem // 14px
$fs13 = .8125rem // 13px

View File

@ -16,8 +16,6 @@
.l_body .l_main
flex-shrink: 1
flex-grow: 1
// margin: var(--gap) var(--gap) var(--gap) var(--gap_2)
// width: "calc(100% - %s)" % ($sidebar + 18 * $gap)
width: 320px
max-width: $layout-max-body-width
footer

View File

@ -5,15 +5,16 @@
margin: $gap * 2 $gap $gap
padding: 0.25rem
background: var(--block)
border-radius: 8px
border-radius: 6px
.logo-wrap
margin: 0.5rem 1rem
margin: 0.5rem 0.75rem
.img
width: 32px
height: 32px
display: none
.title
font-size: 1.5rem
nav.menu
margin: -2px
// pc
@media screen and (min-width: $device-tablet)
@ -22,5 +23,5 @@
//
@media screen and (max-width: $device-tablet)
.l_main.list header
.l_main header
display: block

View File

@ -29,6 +29,9 @@ article.md
margin-top: 3rem
border-bottom: 1px solid var(--block-border)
font-weight: 400
font-size: $fsh2
&:first-child
margin-top: 1rem
h3
margin-top: 3rem
margin-bottom: 0
@ -55,7 +58,6 @@ article.md
article.md code
color: $color-inlinecode
font-family: $ff-code
font-size: $fs14
word-break: break-all

View File

@ -1,12 +1,13 @@
nav.cap
.nav-wrap
position: sticky
position: -webkit-sticky
margin-top: 1.75rem
top: -2px
display: flex
background: var(--site-bg)
padding: 0.5rem 1.25rem 0.38rem
z-index: 1
nav.cap
display: flex
overflow: scroll
scrollbar(0, 0)
>p
@ -38,6 +39,7 @@ nav.cap
background: #fff
color: var(--text-p1)
//
.breadcrumb-navigation
padding: $gap $gap 0
@ -49,3 +51,8 @@ nav.cap
color: $color-cat-hover
div+div
margin-top: 2px
@media screen and (max-width: $device-tablet)
.nav-wrap
margin-top: 0

View File

@ -4,7 +4,6 @@
.post-title
margin: 0.5rem 0
line-height: 1.2
font-size: $fs14
color: var(--text-p2)
font-weight: 500
a
@ -15,4 +14,4 @@
color: var(--text-p3)
font-size: $fs12
&.unread
font-size: 1rem
font-size: $fsh2

View File

@ -10,7 +10,7 @@ div.related-posts-wrap
disable-select()
align-items: flex-start
scrollbar(8px, 4px)
padding-bottom: 4px
padding-bottom: 8px
a
flex-grow: 0
flex-shrink: 0

View File

@ -13,22 +13,25 @@
display: flex
align-items: center
color: var(--text-p0)
&:hover
color: var(--text-p0)
a
color: inherit
display: flex
align-items: center
.img
width: 40px
height: 40px
flex-shrink: 0
border-radius: 20px
border-radius: 40px
border: 2px solid transparent
overflow: hidden
margin-right: 1rem
img
object-fit: cover
.title
padding-top: 2px
font-size: 1.75rem
font-weight: 900
color: inherit
line-height: 1;
font-family: $ff-logo
nav.menu
@ -52,13 +55,10 @@ nav.menu
border-radius: 4px
font-size: $fs14
font-weight: 500
trans2: color background
overflow: hidden
span
color: var(--text-p3)
display: block
padding: 6px 12px
&.active span, &:hover span
padding: 0.375rem 0.75rem
color: var(--text-p3)
&.active, &:hover
color: var(--text-p1)
background: var(--card)
@ -67,6 +67,7 @@ nav.menu
overflow: scroll
flex-grow: 1
scrollbar(0, 0)
z-index: 1
.widget-wrap
margin: 1rem 0 2rem 0
.widget-header

View File

@ -24,7 +24,6 @@
.avatar
display: inline-flex
margin: 0 1rem
// flex-shrink: 0
.about-body
>p
font-size: $fs14
@ -49,9 +48,9 @@
@media screen and (max-width: $device-mobile)
.tag-plugin.about
background: none
padding: 1rem
.about-header
flex-direction: column
.avatar
margin: 1rem auto
p

View File

@ -1,3 +1,5 @@
//
if hexo-config('plugins.swiper.enable')
@import 'swiper'
if hexo-config('plugins.scrollreveal.enable')
@import 'scrollreveal'

View File

@ -0,0 +1,2 @@
.reveal
visibility: hidden

View File

@ -45,7 +45,7 @@ function setSedebar() {
$("#toc a.toc-link").click(function(e) {
l_body.classList.remove("sidebar");
});
$(".social-wrap a.comment").click(function(e) {
$("#toc a#s-top").click(function(e) {
l_body.classList.remove("sidebar");
});
}