This commit is contained in:
xaoxuu 2021-02-24 21:27:31 +08:00
parent 917bf99170
commit cbac326975
12 changed files with 88 additions and 48 deletions

View File

@ -16,23 +16,13 @@ open_graph:
######## Sidebar ########
sidebar:
logo:
avatar:
src: # default is config.avatar
href: # set your user center page like: '/about/'
title: # default is config.title, you can set html tag like: '<img no-lazy height="32px" src="xxx"/>'
avatar: '[config.avatar](/about/)' # you can set avatar link in _config.yml or '[https://xxx.png](/about/)'
title: '[config.title](/)' # you can set html tag like: '[<img no-lazy height="32px" src="xxx"/>](/)'
menu:
post:
title: btn.blog
url: /
wiki:
title: btn.wiki
url: /wiki/
friends:
title: 友链
url: /friends/
about:
title: 关于
url: /about/
post: '[btn.blog](/)'
wiki: '[btn.wiki](/wiki/)'
friends: # '[友链](/friends/)'
about: # '[关于](/about/)'
# Sidebar widgets
widgets:
# default layout in home/wiki/categories/tags/archives pages
@ -151,7 +141,7 @@ plugins:
# https://scrollrevealjs.org/api/reveal.html
scrollreveal:
enable: true
enable: #true
js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js
distance: 8px
duration: 500 # ms

View File

@ -4,15 +4,15 @@ function layoutMainMenu() {
el += '<nav class="menu">'
for (let id of Object.keys(theme.sidebar.menu)) {
let item = theme.sidebar.menu[id];
if (item.url == undefined || item.url.length == 0) {
if (item == undefined || item.length == 0) {
continue;
}
el += '<a class="nav-item';
if (id == page.menu_id) {
el += ' active';
}
el += '" href="' + url_for(item.url) + '">';
el += __(item.title);
el += '" href="' + url_for(md_link(item)) + '">';
el += __(md_text(item));
el += '</a>';
}
el += '</nav>';

View File

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

View File

@ -0,0 +1,39 @@
/**
* md_link(theme.sidebar.menu['home']) is '/'
* md_text(theme.sidebar.menu['home']) is 'Home'
*/
'use strict';
hexo.extend.helper.register('md_text', function(args) {
if (args == undefined) {
return '';
}
let tmp = args.split('](');
if (tmp.length > 1) {
tmp = tmp[0];
if (tmp.length > 1) {
tmp = tmp.substring(1, tmp.length);
}
}
if (tmp == 'config.title') {
tmp = hexo.config.title;
} else if (tmp == 'config.avatar') {
tmp = hexo.config.avatar;
}
return tmp;
});
hexo.extend.helper.register('md_link', function(args) {
if (args == undefined) {
return '';
}
let tmp = args.split('](');
if (tmp.length > 1) {
tmp = tmp[1];
if (tmp.length > 1) {
tmp = tmp.substring(0, tmp.length-1);
}
}
return tmp;
});

View File

@ -20,6 +20,11 @@ trans2($op1, $op2)
-webkit-transition: $op1 0.2s ease-out, $op2 0.2s ease-out
-o-transition: $op1 0.2s ease-out, $op2 0.2s ease-out
trans2pro($op1, $t1, $op2, $t2)
transition: $op1 $t1 ease-out, $op2 $t2 ease-out
-moz-transition: $op1 $t1 ease-out, $op2 $t2 ease-out
-webkit-transition: $op1 $t1 ease-out, $op2 $t2 ease-out
-o-transition: $op1 $t1 ease-out, $op2 $t2 ease-out
txt-ellipsis()
white-space: nowrap

View File

@ -38,14 +38,13 @@ nav.cap
align-items: center
flex-direction: row
&:not([style]) a
color: var(--text-p1)
color: $color-link
&[style] a
color: inherit
span.sep
color: var(--text-p3)
// a.cap:hover
// color: $color-cat-hover
// text-decoration: underline
a.cap:hover
color: $color-hover
div#post-meta
margin-top: 2px

View File

@ -1,14 +0,0 @@
img
max-width 100%
&.lazyload:not(.placeholder)
transition opacity .5s ease-out 0s
&:not(.loaded)
opacity: 0
&.loaded
opacity: 1
if hexo-config('plugins.lazyload.blurIn') == true
transition filter .25s ease-out 0s
&:not(.loaded)
filter blur(8px)
&.loaded
filter none

View File

@ -4,8 +4,6 @@
.post-title
margin: 0.5rem 0
line-height: 1.2
color: var(--text-p2)
font-weight: 500
a
color: inherit
&:hover
@ -13,5 +11,8 @@
&.read
color: var(--text-p3)
font-size: $fs14
font-weight: 500
&.unread
color: var(--text-p1)
font-size: 1.75rem
font-weight: 400

View File

@ -70,6 +70,7 @@
height: 240px
@media screen and (max-width: $device-mobile-m)
height: 200px
&:not(.lazyload)
trans1: transform 1s
.post-list .post-card.post:hover
.post-title
@ -92,7 +93,8 @@
align-items: center
img
object-fit: contain
trans1 transform 0.75s
img:not(.lazyload)
trans1: transform 0.75s
.post-list .post-card.wiki article .excerpt
margin: 1rem
min-width: 220px

View File

@ -30,6 +30,8 @@
background: $color-hover
img
object-fit: cover
width: 100%
height: 100%
.title
font-size: 1.75rem
font-weight: 900
@ -79,7 +81,7 @@ nav.menu
margin: 1rem 0 2rem 0
.widget-header
display: flex
font-size: 1rem
font-size: 1.25rem
color: var(--text-meta)
justify-content: space-between
align-items: center
@ -90,8 +92,6 @@ nav.menu
background: var(--site-bg)
padding: 2px 0
z-index 1
.name
font-size: 1rem
.cap-action
hover-block 4px 4px
line-height: 0

View File

@ -2,6 +2,8 @@
@import "common/*"
//
if hexo-config('plugins.lazyload.enable')
@import 'lazyload'
if hexo-config('plugins.swiper.enable')
@import 'swiper'
if hexo-config('plugins.scrollreveal.enable')

View File

@ -0,0 +1,14 @@
if hexo-config('plugins.lazyload.blurIn') == true
img.lazyload:not(.placeholder)
trans2pro: transform 0.75s filter 0.25s
&:not(.loaded)
filter blur(8px)
&.loaded
filter none
else
img.lazyload:not(.placeholder)
trans2pro: transform 0.75s opacity 0.5s
&:not(.loaded)
opacity: 0
&.loaded
opacity: 1