This commit is contained in:
xaoxuu 2021-02-22 13:19:21 +08:00
parent 89d93923fe
commit 2b87beef57
17 changed files with 98 additions and 32 deletions

View File

@ -148,7 +148,7 @@ plugins:
scrollreveal: scrollreveal:
enable: true enable: true
js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js
distance: 16px distance: 8px
duration: 800 # ms duration: 500 # ms
interval: 80 # ms interval: 50 # ms
scale: 1 # 0.1~1 scale: 1 # 0.1~1

View File

@ -1,6 +1,8 @@
<% <%
function generate_title() { function generate_title() {
if (page.seo_title || page.title || page.wiki || page.layout) { if (page.layout == 'wiki' && page.wiki && (page.title || page.seo_title)) {
return page.wiki + __('symbol.colon') + (page.seo_title || page.title) + ' - ' + config.title;
} else if (page.seo_title || page.title || page.wiki || page.layout) {
return (page.seo_title || page.title || page.wiki || page.layout) + ' - ' + config.title; return (page.seo_title || page.title || page.wiki || page.layout) + ' - ' + config.title;
} else if (page.category) { } else if (page.category) {
return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title; return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title;

View File

@ -11,7 +11,7 @@ function layoutWikiCover() {
cover = ['logo', 'title', 'description']; cover = ['logo', 'title', 'description'];
} }
var el = ''; var el = '';
el += '<div class="l_cover reveal">'; el += '<div class="l_cover' + scrollreveal() + '">';
el += '<article class="cover-wrap md">'; el += '<article class="cover-wrap md">';
if (page.logo && cover.includes('logo')) { if (page.logo && cover.includes('logo')) {
el += '<div class="logo">'; el += '<div class="logo">';

View File

@ -39,7 +39,7 @@ function layout_toc() {
<% <%
var wikis = []; var wikis = [];
wikis = site.pages.filter(function (p) { wikis = site.pages.filter(function (p) {
if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki) { if (p.layout == 'wiki' && p.wiki && p.wiki == page.wiki && (p.title || p.seo_title)) {
if (p.order == undefined) { if (p.order == undefined) {
p.order = 0; p.order = 0;
} }

View File

@ -19,7 +19,7 @@ if (page.menu_id == undefined) {
<% }); %> <% }); %>
<div class='list-title'><%- __('page.archives', years.length, site.posts.length) %></div> <div class='list-title'><%- __('page.archives', years.length, site.posts.length) %></div>
<% years.forEach((year, i) => { %> <% years.forEach((year, i) => { %>
<article class='post-card reveal' id='archive'> <article class='post-card<%- scrollreveal() %>' id='archive'>
<div class='card-title'><%= year %></div> <div class='card-title'><%= year %></div>
<% site.posts.sort('date', -1).filter(function (post) { %> <% site.posts.sort('date', -1).filter(function (post) { %>
<% post.year = date(post.date, 'YYYY'); %> <% post.year = date(post.date, 'YYYY'); %>

View File

@ -10,7 +10,7 @@ if (page.menu_id == undefined) {
<%- partial('_partial/main/navbar/list_post') %> <%- partial('_partial/main/navbar/list_post') %>
<div class='post-list'> <div class='post-list'>
<div class='list-title'><%- __('page.categories', site.categories.length) %></div> <div class='list-title'><%- __('page.categories', site.categories.length) %></div>
<article class='post-card reveal' id='cats'> <article class='post-card<%- scrollreveal() %>' id='cats'>
<% site.categories.sort('path').each(function(category){ %> <% site.categories.sort('path').each(function(category){ %>
<div> <div>
<a class="<%= category.parent ? 'cat child' : 'cat'%>" href="<%= url_for(category.path) %>"> <a class="<%= category.parent ? 'cat child' : 'cat'%>" href="<%= url_for(category.path) %>">

View File

@ -15,7 +15,7 @@ if (page.title && page.wiki) {
<% if (page.posts) { %> <% if (page.posts) { %>
<div class='post-list post'> <div class='post-list post'>
<% page.posts.each(function(post){ %> <% page.posts.each(function(post){ %>
<a class='post-card post reveal' href='<%- url_for(post.link || post.path) %>'> <a class='post-card post<%- scrollreveal() %>' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'> <article class='excerpt md'>
<%- partial('_partial/main/post_list/post_card', {post: post}) %> <%- partial('_partial/main/post_list/post_card', {post: post}) %>
</article> </article>
@ -26,7 +26,7 @@ if (page.title && page.wiki) {
<% } %> <% } %>
<% } else if (page.menu_id == 'wiki') { %> <% } else if (page.menu_id == 'wiki') { %>
<% function outputExcerpt(post) { %> <% function outputExcerpt(post) { %>
<a class='post-card wiki reveal' href='<%- url_for(post.link || post.path) %>'> <a class='post-card wiki<%- scrollreveal() %>' href='<%- url_for(post.link || post.path) %>'>
<article class='excerpt md'> <article class='excerpt md'>
<%- partial('_partial/main/post_list/wiki_card', {post: post}) %> <%- partial('_partial/main/post_list/wiki_card', {post: post}) %>
</article> </article>

View File

@ -1,9 +1,17 @@
<% if ((page.h1 && page.h1.length > 0) || (page.content && page.content.length > 0)) { %> <%
function layoutTitle() {
const title = page.h1 || page.title;
if (title && title.length > 0) {
return '<h1 class="article-title"><span>' + title + '</span></h1>';
} else {
return '';
}
}
%>
<% if (page.h1 || page.title || (page.content && page.content.length > 0)) { %>
<%- partial('_partial/main/navbar/breadcrumb') %> <%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- page.layout %> reveal'> <article class='content md <%- page.layout %><%- scrollreveal() %>'>
<% if (page.h1 && page.h1.length > 0) { %> <%- layoutTitle() %>
<h1 class='article-title'><span><%- page.h1 %></span></h1>
<% } %>
<% if (page.content && page.content.length > 0) { %> <% if (page.content && page.content.length > 0) { %>
<%- page.content %> <%- page.content %>
<% } %> <% } %>

View File

@ -5,11 +5,19 @@ if (page.menu_id == undefined) {
if (page.header == undefined) { if (page.header == undefined) {
page.header = false; page.header = false;
} }
function layoutTitle() {
const title = page.h1 || page.title;
if (title && title.length > 0) {
return '<h1 class="article-title"><span>' + title + '</span></h1>';
} else {
return '';
}
}
%> %>
<% let post = page; %> <% let post = page; %>
<%- partial('_partial/main/navbar/breadcrumb') %> <%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- post.layout %> reveal'> <article class='content md <%- post.layout %><%- scrollreveal() %>'>
<h1 class='article-title'><span><%- post.h1 || post.title %></span></h1> <%- layoutTitle() %>
<%- post.content %> <%- post.content %>
</article> </article>
<%- partial('_partial/main/article/references') %> <%- partial('_partial/main/article/references') %>

View File

@ -10,7 +10,7 @@ if (page.menu_id == undefined) {
<%- partial('_partial/main/navbar/list_post') %> <%- partial('_partial/main/navbar/list_post') %>
<div class='post-list'> <div class='post-list'>
<div class='list-title'><%- __('page.tags', site.tags.length) %></div> <div class='list-title'><%- __('page.tags', site.tags.length) %></div>
<article class='post-card reveal' id='tags'> <article class='post-card<%- scrollreveal() %>' id='tags'>
<% site.tags.sort('length', -1).each(function(tag){ %> <% site.tags.sort('length', -1).each(function(tag){ %>
<a class='tag' href="<%= url_for(tag.path) %>"> <a class='tag' href="<%= url_for(tag.path) %>">
<span class='name'><%= tag.name %></span> <span class='name'><%= tag.name %></span>

View File

@ -8,6 +8,14 @@ if (page.layout == undefined) {
if (page.title == undefined) { if (page.title == undefined) {
page.title = 'Wiki'; page.title = 'Wiki';
} }
function layoutTitle() {
const title = page.h1 || page.title;
if (title && title.length > 0) {
return '<h1 class="article-title"><span>' + title + '</span></h1>';
} else {
return '';
}
}
%> %>
<% if (page.layout == 'index') { %> <% if (page.layout == 'index') { %>
<%- partial('index') %> <%- partial('index') %>
@ -18,10 +26,11 @@ if (page.title == undefined) {
} }
%> %>
<%- partial('_partial/main/navbar/breadcrumb') %> <%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- page.layout %>'> <article class='content md <%- page.layout %><%- scrollreveal() %>'>
<h1 class='article-title'><span><%- page.h1 || page.title %></span></h1> <%- layoutTitle() %>
<%- page.content %> <%- page.content %>
</article> </article>
<%- partial('_partial/main/article/references') %>
<%- partial('_partial/main/article/read_next') %> <%- partial('_partial/main/article/read_next') %>
<%- partial('_partial/plugins/comments/layout') %> <%- partial('_partial/plugins/comments/layout') %>
<% } %> <% } %>

View File

@ -0,0 +1,9 @@
'use strict';
hexo.extend.helper.register('scrollreveal', function(args){
const cfg = hexo.theme.config;
if (cfg.plugins.scrollreveal && cfg.plugins.scrollreveal.enable) {
return ' reveal';
}
return '';
});

View File

@ -18,9 +18,6 @@ hexo.extend.tag.register('image', function(args) {
if (args.height) { if (args.height) {
style += 'height:' + args.height + ';'; style += 'height:' + args.height + ';';
} }
if (args.padding) {
style += 'padding:' + args.padding + ';';
}
function img(src, alt, style) { function img(src, alt, style) {
let img = ''; let img = '';
img += '<img class="img" src="' + src + '"'; img += '<img class="img" src="' + src + '"';
@ -39,8 +36,15 @@ hexo.extend.tag.register('image', function(args) {
el += '<div class="tag-plugin img-wrap">'; el += '<div class="tag-plugin img-wrap">';
// bg // bg
el += '<div class="img-bg"'; el += '<div class="img-bg"';
if (args.bg || args.padding) {
el += ' style="';
if (args.bg && args.bg.length > 0) { if (args.bg && args.bg.length > 0) {
el += ' style="background:' + args.bg + '"'; el += 'background:' + args.bg + ';';
}
if (args.padding) {
el += 'padding:' + args.padding + ';';
}
el += '"';
} }
el += '>'; el += '>';
el += img(args.src, args.alt, style); el += img(args.src, args.alt, style);

View File

@ -0,0 +1,21 @@
'use strict';
hexo.extend.tag.register('u', function(args) {
return `<u>${args.join(' ')}</u>`;
});
hexo.extend.tag.register('emp', function(args) {
return `<emp>${args.join(' ')}</emp>`;
});
hexo.extend.tag.register('wavy', function(args) {
return `<wavy>${args.join(' ')}</wavy>`;
});
hexo.extend.tag.register('del', function(args) {
return `<del>${args.join(' ')}</del>`;
});
hexo.extend.tag.register('kbd', function(args) {
return `<kbd>${args.join(' ')}</kbd>`;
});
hexo.extend.tag.register('psw', function(args) {
return `<psw>${args.join(' ')}</psw>`;
});

View File

@ -117,15 +117,15 @@ table:not([class])
max-width: 100% max-width: 100%
vertical-align: text-top vertical-align: text-top
th th
background: var(--hover-block) background: var(--block)
td,th td,th
padding: 8px 16px padding: 0.5em 1em
border: 2px solid var(--hover-block) border: 1px solid var(--hover-block)
line-height: 1.5 line-height: 1.5
font-size: 90% font-size: 90%
tr tr
word-break: keep-all word-break: keep-all
background: var(--block) white-space:nowrap
trans() trans()
&:hover &:hover
background: var(--hover-block) background: var(--block)

View File

@ -15,6 +15,10 @@ article.md.error-page
a#back a#back
margin: 2rem 0 margin: 2rem 0
display: inline-block display: inline-block
background: #FDB62F
color: black
border-radius: 4px
border: 2px solid black
@media screen and (max-width: $device-tablet) @media screen and (max-width: $device-tablet)
article.md.error-page article.md.error-page

View File

@ -1,8 +1,9 @@
.md .checkbox .md .checkbox
display: flex display: flex
align-items: center align-items: center
margin: 0 margin: 0.25em 0
font-size: $fs15 font-size: $fs15
line-height: 1.2
input input
-webkit-appearance: none -webkit-appearance: none
-moz-appearance: none -moz-appearance: none