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:
enable: true
js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js
distance: 16px
duration: 800 # ms
interval: 80 # ms
distance: 8px
duration: 500 # ms
interval: 50 # ms
scale: 1 # 0.1~1

View File

@ -1,6 +1,8 @@
<%
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;
} else if (page.category) {
return __('btn.category') + __('symbol.colon') + page.category + ' - ' + config.title;

View File

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

View File

@ -39,7 +39,7 @@ function layout_toc() {
<%
var wikis = [];
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) {
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>
<% years.forEach((year, i) => { %>
<article class='post-card reveal' id='archive'>
<article class='post-card<%- scrollreveal() %>' id='archive'>
<div class='card-title'><%= year %></div>
<% site.posts.sort('date', -1).filter(function (post) { %>
<% post.year = date(post.date, 'YYYY'); %>

View File

@ -10,7 +10,7 @@ if (page.menu_id == undefined) {
<%- 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'>
<article class='post-card<%- scrollreveal() %>' id='cats'>
<% site.categories.sort('path').each(function(category){ %>
<div>
<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) { %>
<div class='post-list 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'>
<%- partial('_partial/main/post_list/post_card', {post: post}) %>
</article>
@ -26,7 +26,7 @@ if (page.title && page.wiki) {
<% } %>
<% } else if (page.menu_id == 'wiki') { %>
<% 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'>
<%- partial('_partial/main/post_list/wiki_card', {post: post}) %>
</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') %>
<article class='content md <%- page.layout %> reveal'>
<% if (page.h1 && page.h1.length > 0) { %>
<h1 class='article-title'><span><%- page.h1 %></span></h1>
<% } %>
<article class='content md <%- page.layout %><%- scrollreveal() %>'>
<%- layoutTitle() %>
<% if (page.content && page.content.length > 0) { %>
<%- page.content %>
<% } %>

View File

@ -5,11 +5,19 @@ if (page.menu_id == undefined) {
if (page.header == undefined) {
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; %>
<%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- post.layout %> reveal'>
<h1 class='article-title'><span><%- post.h1 || post.title %></span></h1>
<article class='content md <%- post.layout %><%- scrollreveal() %>'>
<%- layoutTitle() %>
<%- post.content %>
</article>
<%- partial('_partial/main/article/references') %>

View File

@ -10,7 +10,7 @@ if (page.menu_id == undefined) {
<%- 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'>
<article class='post-card<%- scrollreveal() %>' id='tags'>
<% site.tags.sort('length', -1).each(function(tag){ %>
<a class='tag' href="<%= url_for(tag.path) %>">
<span class='name'><%= tag.name %></span>

View File

@ -8,6 +8,14 @@ if (page.layout == undefined) {
if (page.title == undefined) {
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') { %>
<%- partial('index') %>
@ -18,10 +26,11 @@ if (page.title == undefined) {
}
%>
<%- partial('_partial/main/navbar/breadcrumb') %>
<article class='content md <%- page.layout %>'>
<h1 class='article-title'><span><%- page.h1 || page.title %></span></h1>
<article class='content md <%- page.layout %><%- scrollreveal() %>'>
<%- layoutTitle() %>
<%- page.content %>
</article>
<%- partial('_partial/main/article/references') %>
<%- partial('_partial/main/article/read_next') %>
<%- 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) {
style += 'height:' + args.height + ';';
}
if (args.padding) {
style += 'padding:' + args.padding + ';';
}
function img(src, alt, style) {
let img = '';
img += '<img class="img" src="' + src + '"';
@ -39,8 +36,15 @@ hexo.extend.tag.register('image', function(args) {
el += '<div class="tag-plugin img-wrap">';
// bg
el += '<div class="img-bg"';
if (args.bg && args.bg.length > 0) {
el += ' style="background:' + args.bg + '"';
if (args.bg || args.padding) {
el += ' style="';
if (args.bg && args.bg.length > 0) {
el += 'background:' + args.bg + ';';
}
if (args.padding) {
el += 'padding:' + args.padding + ';';
}
el += '"';
}
el += '>';
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%
vertical-align: text-top
th
background: var(--hover-block)
background: var(--block)
td,th
padding: 8px 16px
border: 2px solid var(--hover-block)
padding: 0.5em 1em
border: 1px solid var(--hover-block)
line-height: 1.5
font-size: 90%
tr
word-break: keep-all
background: var(--block)
white-space:nowrap
trans()
&:hover
background: var(--hover-block)
background: var(--block)

View File

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

View File

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