Skip to content

Commit

Permalink
refactor: reconstructs the scroll configuration items
Browse files Browse the repository at this point in the history
  • Loading branch information
XPoet committed Oct 31, 2023
1 parent dceafaa commit a8909aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ style:
# Avatar (You can use local image or image external link)
avatar: /images/avatar.svg

# Page scroll style settings
scroll:
# Show progress bar in top when page scroll
progress_bar: false # Option values: true | false

# Show percent when page scroll
percent: false # Option values: true | false

# ---------------------------------------------------------------------------------------
# First screen style settings
# ---------------------------------------------------------------------------------------
first_screen:
enable: false # Option values: true | false

Expand All @@ -59,6 +53,16 @@ first_screen:
# If enable hitokoto, first screen description is different every time when you enter the site
hitokoto: false # Option values: true | false

# ---------------------------------------------------------------------------------------
# Page scroll style settings
# ---------------------------------------------------------------------------------------
scroll:
# Show progress bar in top when page scroll
progress_bar: false # Option values: true | false

# Show percent when page scroll
percent: false # Option values: true | false

# ---------------------------------------------------------------------------------------
# Navigation menu
# Docs: https://keep-docs.xpoet.cn/basis/configuration-guide/menu.html
Expand Down
2 changes: 1 addition & 1 deletion layout/_partial/progress-bar.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="progress-bar-container">
<% if (theme?.style?.scroll?.progress_bar === true) { %>
<% if (theme?.scroll?.progress_bar === true) { %>
<span class="scroll-progress-bar"></span>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion source/css/layout/_partial/progress-bar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
}

if (hexo-config('style') && hexo-config('style.scroll') && hexo-config('style.scroll.progress_bar') == true) {
if (hexo-config('scroll') && hexo-config('scroll.progress_bar') == true) {
.scroll-progress-bar {
position absolute
top 0
Expand Down
2 changes: 1 addition & 1 deletion source/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ KEEP.initUtils = () => {

// initialization data
initData() {
const { scroll } = KEEP.theme_config?.style || {}
const scroll = KEEP.theme_config?.scroll || {}
const first_screen = KEEP.theme_config?.first_screen || {}
this.isHasScrollProgressBar = scroll?.progress_bar === true
this.isHasScrollPercent = scroll?.percent === true
Expand Down

0 comments on commit a8909aa

Please sign in to comment.