Skip to content

Commit

Permalink
Merge pull request #232 from zkz098/refactor_comment
Browse files Browse the repository at this point in the history
beta1:修复 lazyload 无法正确运行 & 导航栏会埋头像眉毛 & 加载动画总是超过实际加载时间
  • Loading branch information
zkz098 authored Feb 14, 2024
2 parents fdb2e3d + a9e54a9 commit a2f3b04
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 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.0-alpha.4",
"version": "0.4.0-beta.1",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
Expand Down
2 changes: 1 addition & 1 deletion scripts/generaters/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ hexo.extend.generator.register('script', function (locals) {
target: ['es2022'],
minify: true,
legalComments: 'linked',
mainFields: ['module', 'main'],
mainFields: ['module', 'browser', 'main'],
splitting: true,
define: {
__UNLAZY_LOGGING__: 'false',
Expand Down
5 changes: 5 additions & 0 deletions source/css/_common/outline/sidebar/sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@
overflow: hidden;

.inner {
margin-top: 2.5rem;
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
width: auto;
height: 100%;

+tablet-mobile() {
margin-top: 0;
}

&::-webkit-scrollbar {
display: none;
}
Expand Down
3 changes: 0 additions & 3 deletions source/js/_app/components/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { init, pageviewCount, RecentComments } from '@waline/client'

import { createApp } from 'vue'

// await import('@waline/client/style')
// fixme 处理样式引入问题

export const walineComment = function () {
init({
el: '#comments',
Expand Down
8 changes: 5 additions & 3 deletions source/js/_app/pjax/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { pagePosition, positionInit } from '../globals/tools'
import { menuActive, sideBarTab, sidebarTOC } from '../components/sidebar'
import { Loader, isOutime } from '../globals/thirdparty'
import { tabFormat } from '../page/tab'
import { lazyLoad } from 'unlazy'

export const pjaxReload = () => {
pagePosition()
Expand All @@ -41,7 +42,6 @@ export const siteRefresh = (reload) => {
vendorCss('mermaid')

// 懒加载背景图
console.log('lazyBg')
const lazyBg = new IntersectionObserver(function (entries, observer) {
entries.forEach(entry => {
if (entry.isIntersecting) {
Expand Down Expand Up @@ -102,6 +102,8 @@ export const siteRefresh = (reload) => {
comment.observe($dom('#copyright'))
}

lazyLoad()

if (__shokax_waline__) {
import('../components/comments').then(async ({ walinePageview, walineRecentComments }) => {
await walineRecentComments()
Expand All @@ -121,15 +123,15 @@ export const siteRefresh = (reload) => {
if (__shokax_player__) {
toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {})
}
Loader.hide()
Loader.hide(500)

setTimeout(() => {
positionInit()
}, 500)

cardActive()

if (__shokax_outime__) {
if (__shokax_outime__ && LOCAL.ispost) {
isOutime()
}
}
2 changes: 0 additions & 2 deletions source/js/_app/pjax/siteInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { resizeHandle, scrollHandle, visibilityListener } from '../globals/handl
import { pagePosition } from '../globals/tools'
import Pjax from 'theme-shokax-pjax'
import { initVue } from '../library/vue'
import { lazyLoad } from 'unlazy'
import { $dom } from '../library/dom'
import { createChild } from '../library/proto'
import { transition } from '../library/anime'
Expand Down Expand Up @@ -72,7 +71,6 @@ const siteInit = () => {
firework.default(CONFIG.fireworks)
})
}
lazyLoad()

window.addEventListener('scroll', scrollHandle, {
passive: true
Expand Down

0 comments on commit a2f3b04

Please sign in to comment.