修改一言为js加载

This commit is contained in:
AOAOSTAR 2022-04-27 14:30:06 +08:00
parent ff697b2aff
commit 18fb91d6db
3 changed files with 5 additions and 24 deletions

View File

@ -40,7 +40,7 @@ style:
enable: false enable: false
background_img: /images/bg.svg # You can use local image or image external link background_img: /images/bg.svg # You can use local image or image external link
description: Keep writing and Keep loving. description: Keep writing and Keep loving.
hitokoto: # Hitokoto api. https://v1.hitokoto.cn hitokoto: # Hitokoto api. https://v1.hitokoto.cn/?encode=js
# Scroll style settings # Scroll style settings
scroll: scroll:

View File

@ -1,8 +1,11 @@
<div class="first-screen-container flex-center fade-in-down-animation"> <div class="first-screen-container flex-center fade-in-down-animation">
<div class="content flex-center"> <div class="content flex-center">
<div class="description"> <div class="description hitokoto">
<%= theme.style.first_screen.description || config.description %> <%= theme.style.first_screen.description || config.description %>
</div> </div>
<% if (theme.style.first_screen.hitokoto) { %>
<script data-pjax="" src="<%- theme.style.first_screen.hitokoto %>"></script>
<% } %>
<% if (theme.social_contact.enable) { %> <% if (theme.social_contact.enable) { %>
<div class="s-icon-list"> <div class="s-icon-list">
<% for (const key in theme.social_contact.links) { %> <% for (const key in theme.social_contact.links) { %>

View File

@ -330,25 +330,6 @@ KEEP.initUtils = () => {
}, 200); }, 200);
}, },
// loading hitokoto
initHitokoto() {
if (KEEP.theme_config.style.first_screen.enable === true && KEEP.theme_config.style.first_screen.hitokoto && window.location.pathname === '/') {
fetch(KEEP.theme_config.style.first_screen.hitokoto)
.then((res) => {
return res.json();
})
.then((data) => {
this.firstScreen_dom.querySelector('.description').innerText = data.hitokoto;
})
.catch((err) => {
console.error(err);
})
}
}
} }
// init scroll // init scroll
@ -378,7 +359,4 @@ KEEP.initUtils = () => {
// set how long age in home article block // set how long age in home article block
KEEP.utils.setHowLongAgoInHome(); KEEP.utils.setHowLongAgoInHome();
// loading hitokoto
KEEP.utils.initHitokoto();
} }