build(config): change scroll.progress_bar and scroll.percent enable mode

This commit is contained in:
XPoet 2022-10-27 15:06:16 +08:00
parent c2ee33fa60
commit d404e93c26
7 changed files with 13 additions and 14 deletions

View File

@ -73,12 +73,10 @@ style:
# Page scroll style settings # Page scroll style settings
scroll: scroll:
# Show progress bar in top when page scroll # Show progress bar in top when page scroll
progress_bar: progress_bar: false # Option values: true | false
enable: false # Option values: true | false
# Show percent when page scroll # Show percent when page scroll
percent: percent: false # Option values: true | false
enable: false # Option values: true | false
# --------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------
# Navigation menu # Navigation menu

View File

@ -3,6 +3,7 @@ const { title: bi_title, logo_img: bi_logo_img } = theme.base_info
const { logo: s_logo, first_screen: s_first_screen } = theme.style const { logo: s_logo, first_screen: s_first_screen } = theme.style
const { enable: s_fs_enable, header_transparent: s_fs_header_transparent } = s_first_screen const { enable: s_fs_enable, header_transparent: s_fs_header_transparent } = s_first_screen
const { title: config_title } = config const { title: config_title } = config
const { enable: local_search_enable } = theme.local_search
%> %>
<header class="header-wrapper<%= s_fs_enable === true && is_home() && s_fs_header_transparent ? ' transparent-1' : '' %>"> <header class="header-wrapper<%= s_fs_enable === true && is_home() && s_fs_header_transparent ? ' transparent-1' : '' %>">
@ -21,7 +22,7 @@ const { title: config_title } = config
<div class="right"> <div class="right">
<div class="pc"> <div class="pc">
<ul class="menu-list"> <ul class="menu-list">
<% for (let i in theme.menu) { %> <% for (const i in theme.menu) { %>
<li class="menu-item"> <li class="menu-item">
<a class="<%- isInHomePaging(page.path, theme.menu[i]) ? 'active' : is_current(theme.menu[i]) ? 'active' : '' %>" <a class="<%- isInHomePaging(page.path, theme.menu[i]) ? 'active' : is_current(theme.menu[i]) ? 'active' : '' %>"
href="<%- url_for(theme.menu[i]) %>" href="<%- url_for(theme.menu[i]) %>"
@ -30,7 +31,7 @@ const { title: config_title } = config
</a> </a>
</li> </li>
<% } %> <% } %>
<% if (theme.local_search.enable === true) { %> <% if (local_search_enable === true) { %>
<li class="menu-item search search-popup-trigger"> <li class="menu-item search search-popup-trigger">
<i class="fas fa-search"></i> <i class="fas fa-search"></i>
</li> </li>
@ -38,7 +39,7 @@ const { title: config_title } = config
</ul> </ul>
</div> </div>
<div class="mobile"> <div class="mobile">
<% if (theme.local_search.enable === true) { %> <% if (local_search_enable === true) { %>
<div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div> <div class="icon-item search search-popup-trigger"><i class="fas fa-search"></i></div>
<% } %> <% } %>
<div class="icon-item menu-bar"> <div class="icon-item menu-bar">

View File

@ -1,5 +1,5 @@
<div class="progress-bar-container"> <div class="progress-bar-container">
<% if (theme.style.scroll.progress_bar.enable === true) { %> <% if (theme.style.scroll.progress_bar === true) { %>
<span class="scroll-progress-bar"></span> <span class="scroll-progress-bar"></span>
<% } %> <% } %>

View File

@ -24,7 +24,7 @@
</li> </li>
<% } %> <% } %>
<% if (theme.style.scroll.percent.enable !== true) { %> <% if (theme.style.scroll.percent !== true) { %>
<li class="tools-item tool-scroll-to-top flex-center"> <li class="tools-item tool-scroll-to-top flex-center">
<i class="fas fa-arrow-up"></i> <i class="fas fa-arrow-up"></i>
</li> </li>
@ -39,7 +39,7 @@
<li class="tools-item tool-toggle-show flex-center"> <li class="tools-item tool-toggle-show flex-center">
<i class="fas fa-cog fa-spin"></i> <i class="fas fa-cog fa-spin"></i>
</li> </li>
<% if (theme.style.scroll.percent.enable === true) { %> <% if (theme.style.scroll.percent === true) { %>
<li class="tools-item tool-scroll-to-top flex-center"> <li class="tools-item tool-scroll-to-top flex-center">
<i class="arrow-up fas fa-arrow-up"></i> <i class="arrow-up fas fa-arrow-up"></i>
<span class="percent"></span> <span class="percent"></span>

View File

@ -48,7 +48,7 @@
} }
} }
if (hexo-config('style.scroll.progress_bar.enable') == true) { if (hexo-config('style.scroll.progress_bar') == true) {
.scroll-progress-bar { .scroll-progress-bar {
position absolute position absolute

View File

@ -70,7 +70,7 @@ $tools-item-border-radius = 0.1rem
.exposed-tools-list { .exposed-tools-list {
if (hexo-config('style.scroll.percent.enable') == true) { if (hexo-config('style.scroll.percent') == true) {
.tool-scroll-to-top { .tool-scroll-to-top {
display none display none

View File

@ -23,8 +23,8 @@ KEEP.initUtils = () => {
initData() { initData() {
const { scroll, first_screen } = KEEP.theme_config.style const { scroll, first_screen } = KEEP.theme_config.style
this.isHasScrollProgressBar = scroll.progress_bar.enable === true this.isHasScrollProgressBar = scroll.progress_bar === true
this.isHasScrollPercent = scroll.percent.enable === true this.isHasScrollPercent = scroll.percent === true
const { enable, header_transparent } = first_screen const { enable, header_transparent } = first_screen
this.isHeaderTransparent = enable === true && header_transparent === true this.isHeaderTransparent = enable === true && header_transparent === true
}, },