Skip to content

Commit

Permalink
fix: 杂项修复
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 committed Jun 24, 2024
1 parent dc46e60 commit 71756ea
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-shokax",
"version": "0.4.3",
"version": "0.4.4",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
Expand Down
4 changes: 3 additions & 1 deletion scripts/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ hexo.on('generateBefore', () => {

hexo.on('generateAfter', () => {
// 检查版本更新
fetch('https://api.shokax.top/version/hexo').then((res) => {
fetch('https://api.shokax.top/version/hexo', {headers: {
"User-Agent": "Mozilla/5.0 ShokaX Client (hexo-theme-shokax)"
}}).then((res) => {
res.json().then((resp) => {
try {
const latest = resp['version']
Expand Down
43 changes: 23 additions & 20 deletions source/js/_app/pjax/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,32 @@ export const siteRefresh = (reload) => {
postBeauty()
})

const comment = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
if (__shokax_waline__) {
import('../components/comments').then(({ walinePageview, walineComment }) => {
walinePageview()
walineComment()
})
}
if (__shokax_twikoo__) {
import('../components/tcomments').then(({ twikooComment }) => {
twikooComment()
})
const cpel = $dom('#copyright')
if (cpel) {
const comment = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.isIntersecting) {
if (__shokax_waline__) {
import('../components/comments').then(({walinePageview, walineComment}) => {
walinePageview()
walineComment()
})
}
if (__shokax_twikoo__) {
import('../components/tcomments').then(({twikooComment}) => {
twikooComment()
})
}
comment.disconnect()
}
comment.disconnect()
}
})
}, {
root: null,
threshold: 0.2
})
}, {
root: null,
threshold: 0.2
})

comment.observe($dom('#copyright'))
comment.observe(cpel)
}

lazyLoad()

Expand Down

0 comments on commit 71756ea

Please sign in to comment.