pref: perfect configuration & optimize style

This commit is contained in:
XPoet 2020-09-11 15:06:38 +08:00
parent 5f272b4bf6
commit 145272ff15
12 changed files with 143 additions and 85 deletions

View File

@ -1,17 +1,30 @@
# theme basic info
# ------------------------------------------------------------
# Theme basic info (please don't change)
# ------------------------------------------------------------
theme_info:
name: ILS
version: 2.0.1
author: XPoet
repository: https://github.com/XPoet/hexo-theme-ils
# favicon
favicon: images/favicon.png
# avatar
avatar: images/avatar.png
# ------------------------------------------------------------
# Theme style settings
# ------------------------------------------------------------
style:
# Theme color
theme_color: "#0066CC"
# navigation menu
# favicon
favicon: images/favicon.png
# avatar
avatar: images/avatar.png
# ------------------------------------------------------------
# Navigation menu
# ------------------------------------------------------------
menu:
Home: /
Archives: /archives
@ -21,13 +34,22 @@ menu:
# About: /about
# ...
# RSS
rss:
enable: true
# comment plugin
# ------------------------------------------------------------
# RSS
# Dependencies: hexo-generator-feed
# See: https://github.com/hexojs/hexo-generator-feed
# ------------------------------------------------------------
rss:
enable: false
# ------------------------------------------------------------
# Comment plugin
# ------------------------------------------------------------
comments:
# Valine https://github.com/xCss/Valine
# Valine
# See: https://github.com/xCss/Valine
valine:
enable: false
appid: # your leancloud application appid
@ -35,7 +57,8 @@ comments:
meta: # comment input meta, type: Array, values: ['nick','mail','link']
placeholder: # your placeholder
# Gitalk https://github.com/gitalk/gitalk
# Gitalk
# See: https://github.com/gitalk/gitalk
gitalk:
enable: false
github_id: # GitHub repo owner
@ -43,17 +66,25 @@ comments:
client_id: # GitHub Application Client ID
client_secret: # GitHub Application Client Secret
# website count
# ------------------------------------------------------------
# Website count
# ------------------------------------------------------------
website_count:
# busuanzi http://ibruce.info/2015/04/04/busuanzi/
# busuanzi
# See: http://ibruce.info/2015/04/04/busuanzi/
busuanzi_count:
enable: false
site_uv: false
site_pv: false
page_pv: false
# ------------------------------------------------------------
# Local Search
# Dependencies: https://github.com/theme-next/hexo-generator-searchdb
# Dependencies: hexo-generator-searchdb
# See: https://github.com/theme-next/hexo-generator-searchdb
# ------------------------------------------------------------
local_search:
enable: true
@ -67,36 +98,57 @@ local_search:
# Preload the search data when the page loads.
preload: false
# ------------------------------------------------------------
# Post word count
# Dependencies: https://github.com/willin/hexo-wordcount
# Dependencies: hexo-wordcount
# See: https://github.com/willin/hexo-wordcount
# ------------------------------------------------------------
post_wordcount:
enable: false
wordcount: false # word count, one article
min2read: false # time to read, one article
# Home page article block display settings
home_article:
category: true # show category in article block
tag: true # show tags in article block
tag_limit: 5 # max number of tags shown in article block
# Code Copy
# ------------------------------------------------------------
# Home page article block display settings
# ------------------------------------------------------------
home_article:
category:
enable: false # show category in home page article block
limit: 3 # max number of categories shown in home page article block
tag:
enable: false # show tags in home page article block
limit: 5 # max number of tags shown in home page article block
# ------------------------------------------------------------
# Code copy
# ------------------------------------------------------------
code_copy:
enable: true
style: flat # values: default | flat | mac
# sidebar tools
# ------------------------------------------------------------
# Sidebar tools
# ------------------------------------------------------------
side_tools:
enable: true
position: right # values: left | right
enable: false
# back to top
# ------------------------------------------------------------
# Back to top
# ------------------------------------------------------------
back2top:
enable: true
position: right # values: left | right
enable: false
# ------------------------------------------------------------
# Table of Contents in the Sidebar
# ------------------------------------------------------------
toc:
enable: true
enable: false
# Automatically add list number to toc.
number: true
@ -104,8 +156,11 @@ toc:
# If true, all level of TOC in a post will be displayed, rather than the activated part of it.
expand_all: true
# magic theme
# ------------------------------------------------------------
# Magic
# ------------------------------------------------------------
magic:
enable: true
scale: false
shadow: true
scale: false # scale effect when the mouse hover
shadow: false # shadow effect when the mouse hover

View File

@ -31,12 +31,12 @@
<i class="fa fa-eye"></i> <span id="busuanzi_value_page_pv"></span>
</span>
<% } %>
<% if(theme.post_wordcount.wordcount && is_post()){ %>
<% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.wordcount){ %>
<span class="article-wordcount article-meta-item">
<i class="fa fa-book"></i> <span><%= wordcount(page.content) %> <%- __('wordcount') %></span>
</span>
<% } %>
<% if(theme.post_wordcount.min2read && is_post()){ %>
<% if(is_post() && theme.post_wordcount.enable && theme.post_wordcount.min2read){ %>
<span class="article-min2read article-meta-item">
<i class="fa fa-clock-o"></i> <span><%= min2read(page.content) %> <%- __('min2read') %></span>
</span>

View File

@ -3,10 +3,6 @@
<div class="copyright-info info-item">
&copy; <%= date(new Date(), 'YYYY') %> <i class="fa fa-heart-o"></i> <a href="/"><%= config.author %></a>
</div>
<div class="theme-info info-item">
<%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a
href="https://github.com/XPoet/hexo-theme-ils" target="_blank"><%= theme.theme_info.name %> v<%= theme.theme_info.version %></a>
</div>
<% if (theme.website_count.busuanzi_count.enable) { %>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="website-count info-item">
@ -22,5 +18,9 @@
<% } %>
</div>
<% } %>
<div class="theme-info info-item">
<%- __('powered_by', '<a target="_blank" href="https://hexo.io">Hexo</a>') %> | <%- __('theme') %> <a
href="https://github.com/XPoet/hexo-theme-ils" target="_blank"><%= theme.theme_info.name %> v<%= theme.theme_info.version %></a>
</div>
</div>
</footer>

View File

@ -21,8 +21,8 @@
<% if (title){ %><%= title %> | <% } %><%= config.title %>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<% if (theme.favicon){ %>
<%- favicon_tag(theme.favicon) %>
<% if (theme.style.favicon){ %>
<%- favicon_tag(theme.style.favicon) %>
<% } %>
<%- css('css/style') %>
<%- export_config() %>

View File

@ -15,9 +15,7 @@
<% } %>
<% if (theme.toc.enable) { %>
<%- js(['lib/anime.min.js', 'js/toc.js']) %>
<%- js(['lib/anime.min.js', 'js/toc.js', 'js/post-toc.js']) %>
<% } %>
<%- js('js/post.js') %>
<% } %>

View File

@ -24,23 +24,26 @@
<div class="article-date">
<span><i class="fa fa-pencil-square-o"></i> <%= date(post.date, 'YYYY-MM-DD') %></span>
<% if (theme.magic.enable === true) { %>
<% if (theme.home_article.category === true) { %>
<% if (theme.home_article.category.enable === true) { %>
<span>
<i class="fa fa-folder"></i>
<ul>
<% post.categories.forEach((category, i) => { %>
<li><%= i === 0 ? '' : '> ' %><a
href="<%- url_for(category.path) %>"><%= category.name %></a></li>
<% post.categories.forEach((category, i) => {
if (theme.home_article.category.limit === 0 || i + 1 <= theme.home_article.category.limit) { %>
<li>
<%= i === 0 ? '' : '> ' %><a href="<%- url_for(category.path) %>"><%= category.name %></a>
</li>
<% } %>
<% }); %>
</ul>
</span>
<% } %>
<% if (theme.home_article.tag === true) { %>
<% if (theme.home_article.tag.enable === true) { %>
<span>
<i class="fa fa-tags"></i>
<ul>
<% post.tags.forEach((tag, i) => {
if (theme.home_article.tag_limit === 0 | i + 1 <= theme.home_article.tag_limit) { %>
if (theme.home_article.tag.limit === 0 || i + 1 <= theme.home_article.tag.limit) { %>
<li>
<%= i === 0 ? '' : '| ' %><a href="<%- url_for(tag.path) %>"><%= tag.name %></a>
</li>

View File

@ -59,8 +59,6 @@
<%- partial('_partial/tools') %>
</div>
<!-- page aside -->
<aside class="page-aside">
<% if (is_post()) { %>
@ -71,7 +69,6 @@
</div>
<% if (theme.local_search.enable) { %>
<%- partial('_partial/local-search') %>
<% } %>

View File

@ -57,6 +57,9 @@ $li-margin-bottom = 12px;
&.scroll-to-top {
display: none;
position: fixed;
right: $component-interspace;
bottom: $component-interspace;
}
&.page-aside-toggle {

View File

@ -51,7 +51,7 @@ $z-index-8 = 1008;
// color
// ===================================
// normal mode color
$primary-color = rgba(30, 88, 217, 0.96); //
$primary-color = convert(hexo-config("style.theme_color")) || #0066CC;
$background-color = #fff; // normal
$magic-background-color = #fafafa; // magic
$normal-text-color = #43404d; //
@ -60,7 +60,7 @@ $second-text-color = darken($normal-text-color, 4%); // 第二文本颜色
$third-text-color = lighten($normal-text-color, 40%); //
$fourth-text-color = #eee; //
$border-color = darken($background-color, 30%); //
$selection-color = lighten($primary-color, 20%); //
$selection-color = lighten($primary-color, 10%); //
// dark mode color
$dark-primary-color = $primary-color;

View File

@ -137,6 +137,7 @@ $page-aside-width = 248px;
the-transition-ease-out();
}
.sidebar-tools {
position: fixed;
top: $header-height + $component-interspace;
@ -155,4 +156,10 @@ $page-aside-width = 248px;
transform-origin: right top;
}
}
.sidebar-tools-shrink {
transition();
top: $header-shrink-height + $component-interspace;
}
}

View File

@ -1,9 +1,9 @@
const pageTemplateDom = document.querySelector('.page-main-content');
const articleTocContainerDom = document.querySelector('.article-toc-container');
const sidebarToolsDom = document.querySelector('.sidebar-tools');
const headerDom = document.querySelector('.header-wrapper');
const menuBarDom = document.querySelector('.menu-bar');
const windowMaskDom = document.querySelector('.window-mask');
const scrollPercentDom = document.querySelector('.scroll-percent');
let isHeaderShrink = false;
const headerHeight = headerDom.getBoundingClientRect().height;
@ -14,18 +14,13 @@ window.addEventListener('scroll', function (_e) {
isHeaderShrink = true;
headerDom.classList.add('header-wrapper-shrink');
pageTemplateDom.classList.add('page-main-content-top-shrink');
sidebarToolsDom.classList.add('sidebar-tools-shrink');
if (articleTocContainerDom) {
articleTocContainerDom.classList.add('article-toc-container-shrink');
}
} else if (isHeaderShrink && scrollTop <= headerHeight) {
isHeaderShrink = false;
headerDom.classList.remove('header-wrapper-shrink');
pageTemplateDom.classList.remove('page-main-content-top-shrink');
if (articleTocContainerDom) {
articleTocContainerDom.classList.remove('article-toc-container-shrink');
}
sidebarToolsDom.classList.remove('sidebar-tools-shrink');
}
});