perf(first-screen): optimize first screen hitokoto settings

This commit is contained in:
XPoet 2022-09-24 00:20:47 +08:00
parent 6bfc5a7f8a
commit 422f2176ac
2 changed files with 33 additions and 11 deletions

View File

@ -39,17 +39,27 @@ style:
# Mouse hover
hover:
shadow: false # shadow effect when the mouse hover
scale: false # scale effect when the mouse hover
# shadow effect when the mouse hover
shadow: false
# scale effect when the mouse hover
scale: false
# First screen
first_screen:
enable: false
background_img: /images/bg.svg # You can use local image or image external link
description: Keep writing and Keep loving.
hitokoto: # Hitokoto api. https://v1.hitokoto.cn/?encode=js
# Scroll style settings
# First screen background image (You can use local image or image external link)
background_img: /images/bg.svg
# First screen background image (You can use local image or image external link)
description: Keep writing and Keep loving.
# If enable hitokoto
# First screen description is different every time when you enter the site
hitokoto:
enable: false
# Page scroll style settings
scroll:
progress_bar:
enable: false

View File

@ -1,10 +1,22 @@
<%
const {
description: fs_description,
hitokoto: fs_hitokoto
} = theme.style.first_screen
const { description: c_description } = config
%>
<div class="first-screen-container flex-center fade-in-down-animation">
<div class="content flex-center">
<div class="description hitokoto">
<%= theme.style.first_screen.description || config.description %>
</div>
<% if (theme.style.first_screen.hitokoto) { %>
<script data-pjax="" src="<%- theme.style.first_screen.hitokoto %>"></script>
<% if (fs_description || c_description || fs_hitokoto.enable) { %>
<div class="description hitokoto">
<%= fs_description || c_description %>
</div>
<% } %>
<% if (fs_hitokoto.enable) { %>
<script async <%= theme.pjax.enable === true ? 'data-pjax' : '' %>
src="https://v1.hitokoto.cn/?encode=js"
>
</script>
<% } %>
<% if (theme.social_contact.enable) { %>
<div class="s-icon-list">