diff --git a/package.json b/package.json index c6045ab..d357d04 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/generaters/script.ts b/scripts/generaters/script.ts index 57041ff..dd2eca6 100644 --- a/scripts/generaters/script.ts +++ b/scripts/generaters/script.ts @@ -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', diff --git a/source/css/_common/outline/sidebar/sidebar.styl b/source/css/_common/outline/sidebar/sidebar.styl index 2408a53..8a0cc6a 100644 --- a/source/css/_common/outline/sidebar/sidebar.styl +++ b/source/css/_common/outline/sidebar/sidebar.styl @@ -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; } diff --git a/source/js/_app/components/comments.ts b/source/js/_app/components/comments.ts index 63f75f3..8a6469e 100644 --- a/source/js/_app/components/comments.ts +++ b/source/js/_app/components/comments.ts @@ -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', diff --git a/source/js/_app/pjax/refresh.ts b/source/js/_app/pjax/refresh.ts index 2adfb75..bbdd92f 100644 --- a/source/js/_app/pjax/refresh.ts +++ b/source/js/_app/pjax/refresh.ts @@ -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() @@ -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) { @@ -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() @@ -121,7 +123,7 @@ export const siteRefresh = (reload) => { if (__shokax_player__) { toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {}) } - Loader.hide() + Loader.hide(500) setTimeout(() => { positionInit() @@ -129,7 +131,7 @@ export const siteRefresh = (reload) => { cardActive() - if (__shokax_outime__) { + if (__shokax_outime__ && LOCAL.ispost) { isOutime() } } diff --git a/source/js/_app/pjax/siteInit.ts b/source/js/_app/pjax/siteInit.ts index a5c18d0..35e9bfb 100644 --- a/source/js/_app/pjax/siteInit.ts +++ b/source/js/_app/pjax/siteInit.ts @@ -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' @@ -72,7 +71,6 @@ const siteInit = () => { firework.default(CONFIG.fireworks) }) } - lazyLoad() window.addEventListener('scroll', scrollHandle, { passive: true