hexo-theme-shokax 0.5.0-dev-d82f54b → 0.5.0-dev-2f28258
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/UsageRestrictions.md +1 -1
- package/_config.yml +10 -63
- package/_images.yml +0 -2
- package/layout/_mixin/comment.pug +1 -0
- package/layout/_mixin/segment.pug +1 -1
- package/layout/_partials/footer.pug +4 -1
- package/layout/_partials/head/head.pug +1 -1
- package/layout/_partials/header.pug +1 -0
- package/layout/_partials/layout.pug +5 -12
- package/layout/_partials/post/footer.pug +2 -0
- package/layout/_partials/post/nav.pug +1 -1
- package/layout/_partials/post/post.pug +3 -1
- package/layout/_partials/post/reward.pug +1 -1
- package/layout/_partials/sidebar/overview.pug +2 -0
- package/layout/page.pug +0 -2
- package/layout/post.pug +0 -2
- package/package.json +16 -24
- package/scripts/filters/post.js +1 -1
- package/scripts/generaters/script.js +43 -22
- package/scripts/generaters/summary_ai.js +1 -0
- package/scripts/helpers/engine.js +4 -56
- package/scripts/plugin/index.js +24 -1
- package/scripts/plugin/lib/injects-point.js +40 -0
- package/scripts/plugin/lib/injects.js +105 -0
- package/scripts/tags/media.js +1 -1
- package/source/css/app.styl +0 -3
- package/source/js/_app/components/comments.ts +0 -1
- package/source/js/_app/components/sidebar.ts +4 -2
- package/source/js/_app/globals/globalVars.ts +1 -6
- package/source/js/_app/library/declare.d.ts +0 -4
- package/source/js/_app/library/vue.ts +1 -0
- package/source/js/_app/page/imageviewer.ts +20 -0
- package/source/js/_app/page/post.ts +3 -19
- package/source/js/_app/pjax/domInit.ts +19 -11
- package/source/js/_app/pjax/refresh.ts +2 -9
- package/source/js/_app/player.ts +11 -9
- package/toolbox/compiler.mjs +19 -8
- package/eslint.config.mjs +0 -55
- package/source/css/optimize.styl +0 -6
- package/source/js/_app/page/fancybox.ts +0 -66
package/README.md
CHANGED
@@ -5,23 +5,21 @@
|
|
5
5
|
- [x] 移除 pjax
|
6
6
|
- [x] 移除 quicklink
|
7
7
|
- [x] 移除 assetUrl 为基的动态 Vendor 机制
|
8
|
-
- [x] 移除 ShokaX Inject
|
9
8
|
- [ ] 引入新的 Inject 类技术 (长期)
|
10
9
|
- [ ] 引入新的工作流程
|
11
|
-
- [
|
10
|
+
- [x] 重构 player (nyx-player)
|
12
11
|
- [ ] 重构并修改代码块
|
13
12
|
- [x] 优化和异步化 Smart Bundle 技术
|
14
13
|
- [x] 优化 CSS 结构和加载
|
15
14
|
- [x] 修复/重置 fancybox
|
16
15
|
- [ ] 修复模板长期遗留问题
|
17
|
-
- [
|
18
|
-
- [
|
16
|
+
- [x] 修复 images 遗留问题
|
17
|
+
- [x] 规范化配置文件
|
19
18
|
- [ ] 规范化文档
|
20
19
|
|
21
20
|
## 📚子项目
|
22
21
|
- [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
|
23
22
|
- [HRMNMI](https://github.com/theme-shoka-x/hexo-renderer-multi-next-markdown-it) ShokaX 正在使用的 markdown 渲染器 (等待重构)
|
24
|
-
- [ShokaX Pjax](https://github.com/theme-shoka-x/theme-shokax-pjax) ShokaX 提供的高效 Pjax 实现
|
25
23
|
- [ShokaX Anime](https://github.com/theme-shoka-x/theme-shokax-anime) ShokaX 提供的精简版 Anime.js 实现
|
26
24
|
|
27
25
|
# [许可证](https://github.com/theme-shoka-x/hexo-theme-shokaX/blob/main/LICENSE)
|
package/UsageRestrictions.md
CHANGED
package/_config.yml
CHANGED
@@ -21,18 +21,7 @@ pwa:
|
|
21
21
|
|
22
22
|
# 实验性特性
|
23
23
|
experiments:
|
24
|
-
debug: false # 使用debug模式启动
|
25
|
-
disableThemeComment: false # 禁用主题评论系统(一般用于关闭评论或让插件接管评论系统)
|
26
|
-
usingRelative: false # _image.yml 使用相对路径
|
27
|
-
optimizeLongPosts: false # 优化长文章,这能让长文章的FPS提升70%-150%并解决假死问题,但存在一些副作用
|
28
|
-
# 具体见https://docs.kaitaku.xyz/guide/theme.html#%E9%95%BF%E6%96%87%E7%AB%A0%E4%BC%98%E5%8C%96
|
29
24
|
mobileWidth: 820px # 移动版和桌面版导航栏最短切换长度
|
30
|
-
# 使用 Cloudflare Rocket 或其他优化功能时需开启下列补丁,否则主题无法渲染
|
31
|
-
cloudflarePatch: false
|
32
|
-
coverConfig:
|
33
|
-
enableCover: true # 是否开启头图
|
34
|
-
enablePreload: true #是否开启预加载头图
|
35
|
-
enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面
|
36
25
|
copyrightLength: 50 # 自定义复制时显示copyright的长度
|
37
26
|
antiFakeWebsite: true # 防止恶意网站伪装
|
38
27
|
|
@@ -40,6 +29,10 @@ homeConfig:
|
|
40
29
|
gradient: false # 使用CSS渐变作为文章封面
|
41
30
|
# fixedCover 性能比默认的更好,且开启时将启用LCP优化和预加载
|
42
31
|
fixedCover: "" # 主页面cover(为空则使用bing随机图片)
|
32
|
+
coverConfig:
|
33
|
+
enableCover: true # 是否开启头图
|
34
|
+
enablePreload: true #是否开启预加载头图
|
35
|
+
enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面
|
43
36
|
cateCards:
|
44
37
|
- slug: # 分类 slug
|
45
38
|
cover: # 分类封面
|
@@ -47,13 +40,14 @@ homeConfig:
|
|
47
40
|
# ShokaX 模块化分包引入设置
|
48
41
|
# 请关闭所有不使用的模块以优化主题 js 体积和性能
|
49
42
|
modules:
|
43
|
+
debug: false # 启用调试模式
|
50
44
|
player: true # 启用音乐播放器
|
51
45
|
fireworks: true # 启用鼠标点击烟花特效
|
52
|
-
unlazyHash: false # 启用unlazy hash预览图支持
|
53
46
|
visibilityListener: true # 启用可见度监听器
|
54
47
|
tabs: true # 启用选项卡扩展支持,如需开启 summary 功能请一并开启
|
55
48
|
quiz: true # 启用文章内问题扩展支持
|
56
|
-
|
49
|
+
# 使用 Cloudflare Rocket 或其他优化功能时需开启下列补丁,否则主题无法渲染
|
50
|
+
cloudflarePatch: false
|
57
51
|
|
58
52
|
# 优化性能区
|
59
53
|
performance:
|
@@ -95,13 +89,6 @@ loader:
|
|
95
89
|
start: true # 进入页面时显示加载动画
|
96
90
|
switch: false # 切换页面时显示加载动画
|
97
91
|
|
98
|
-
# 使用polyfill.io自动处理浏览器兼容问题
|
99
|
-
polyfill:
|
100
|
-
enable: false
|
101
|
-
features:
|
102
|
-
- default
|
103
|
-
- fetch
|
104
|
-
|
105
92
|
# 显示的动画(烟花)
|
106
93
|
# 参阅 https://github.com/D-Sketon/mouse-firework
|
107
94
|
fireworks:
|
@@ -278,10 +265,6 @@ footer:
|
|
278
265
|
# Dependencies: https://github.com/theme-next/hexo-symbols-count-time
|
279
266
|
count: true
|
280
267
|
powered: true
|
281
|
-
lantern:
|
282
|
-
enable: true #是否开启
|
283
|
-
word1: 中 #第一个字
|
284
|
-
word2: 秋 #第二个字
|
285
268
|
icp: # ICP备案
|
286
269
|
enable: false
|
287
270
|
# 请在登录后从 https://beian.mps.gov.cn/web/business/businessHome/website 下载对应图标
|
@@ -331,9 +314,9 @@ creative_commons:
|
|
331
314
|
# bgm
|
332
315
|
# 不使用请打开noplayer功能
|
333
316
|
audio:
|
334
|
-
|
335
|
-
|
336
|
-
|
317
|
+
# - title: 列表1
|
318
|
+
# list:
|
319
|
+
# - https://music.163.com/#/playlist?id=2943811283
|
337
320
|
# - title: 列表2
|
338
321
|
# list:
|
339
322
|
# - https://music.163.com/#/playlist?id=2031842656
|
@@ -355,49 +338,13 @@ vendors:
|
|
355
338
|
cdns:
|
356
339
|
cdnjs: https://s4.zstatic.net/ajax/libs
|
357
340
|
js:
|
358
|
-
pace:
|
359
|
-
source: cdnjs
|
360
|
-
url: pace/1.2.4/pace.min.js
|
361
|
-
sri: "sha384-k6YtvFUEIuEFBdrLKJ3YAUbBki333tj1CSUisai5Cswsg9wcLNaPzsTHDswp4Az8"
|
362
|
-
jquery:
|
363
|
-
source: cdnjs
|
364
|
-
url: jquery/3.5.1/jquery.min.js
|
365
|
-
sri: "sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2"
|
366
|
-
fancybox:
|
367
|
-
source: cdnjs
|
368
|
-
url: fancybox/3.5.7/jquery.fancybox.min.js
|
369
|
-
sri: "sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7"
|
370
|
-
justifiedGallery:
|
371
|
-
source: cdnjs
|
372
|
-
url: justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
|
373
|
-
sri: "sha384-TOxsBplaL96/QDWPIUg+ye3v89qSE3s22XNtJMmCeZEep3cVDmXy1zEfZvVv+y2m"
|
374
341
|
async_js:
|
375
342
|
copy_tex:
|
376
343
|
source: cdnjs
|
377
344
|
url: KaTeX/0.16.9/contrib/copy-tex.min.js
|
378
345
|
sri: "sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A"
|
379
|
-
fancybox:
|
380
|
-
source: cdnjs
|
381
|
-
url: fancybox/3.5.7/jquery.fancybox.min.js
|
382
|
-
sri: "sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7"
|
383
|
-
justifiedGallery:
|
384
|
-
source: cdnjs
|
385
|
-
url: justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
|
386
|
-
sri: "sha384-TOxsBplaL96/QDWPIUg+ye3v89qSE3s22XNtJMmCeZEep3cVDmXy1zEfZvVv+y2m"
|
387
346
|
css:
|
388
347
|
katex:
|
389
348
|
source: cdnjs
|
390
349
|
url: KaTeX/0.16.9/katex.min.css
|
391
350
|
sri: "sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV"
|
392
|
-
comment:
|
393
|
-
source: local
|
394
|
-
url: css/comment.css
|
395
|
-
sri: ""
|
396
|
-
fancybox:
|
397
|
-
source: cdnjs
|
398
|
-
url: fancybox/3.5.7/jquery.fancybox.min.css
|
399
|
-
sri: "sha384-Q8BgkilbsFGYNNiDqJm69hvDS7NCJWOodvfK/cwTyQD4VQA0qKzuPpvqNER1UC0F"
|
400
|
-
justifiedGallery:
|
401
|
-
source: cdnjs
|
402
|
-
url: justifiedGallery/3.8.1/css/justifiedGallery.min.css
|
403
|
-
sri: "sha384-V/1Ew9pYm8xpy/L9i078ZXT6HSEOrGC6KNFYLbXOdtqb3+c6brpGqVzZtEPSQOiz"
|
package/_images.yml
CHANGED
@@ -12,7 +12,7 @@ mixin SMRender(item, lazy)
|
|
12
12
|
else
|
13
13
|
div(class="cover")
|
14
14
|
if lazy
|
15
|
-
!= _url(link1, '<img loading="lazy" decoding="async"
|
15
|
+
!= _url(link1, '<img loading="lazy" decoding="async" src="'+ _cover(item) +'" alt="article cover">', {itemprop: 'url', title: postText})
|
16
16
|
else
|
17
17
|
!= _url(link1, '<img loading="eager" decoding="async" src="'+ _cover(item) +'" alt="article cover">', {itemprop: 'url', title: postText})
|
18
18
|
div(class="info")
|
@@ -35,6 +35,9 @@ div(class="status")
|
|
35
35
|
if beianN && RC
|
36
36
|
br
|
37
37
|
a(target="_blank" href=`https://beian.mps.gov.cn/#/query/webSearch?code=${RC}`)
|
38
|
-
img(loading="lazy" decoding="async"
|
38
|
+
img(loading="lazy" decoding="async" src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;" width="20" height="20" alt="备案")
|
39
39
|
!= beianN
|
40
|
+
!= shokax_inject('status')
|
41
|
+
|
42
|
+
!= shokax_inject('footer')
|
40
43
|
|
@@ -4,8 +4,8 @@ include ../_mixin/widgets.pug
|
|
4
4
|
|
5
5
|
- var covers = _cover_index(page, 6)
|
6
6
|
- var enableFixedCover = theme.homeConfig?.fixedCover
|
7
|
-
- var enablePreload = theme.
|
8
|
-
- var enableCover = theme.
|
7
|
+
- var enablePreload = theme.homeConfig?.coverConfig?.enablePreload
|
8
|
+
- var enableCover = theme.homeConfig?.coverConfig?.enableCover
|
9
9
|
|
10
10
|
doctype html
|
11
11
|
html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'filter: grayscale(1);':'' )
|
@@ -21,6 +21,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
21
21
|
link(rel="preload" href!=covers as="image" fetchpriority="high")
|
22
22
|
|
23
23
|
!= partial('_partials/head/head_com.pug')
|
24
|
+
!= shokax_inject('head')
|
24
25
|
block head
|
25
26
|
title
|
26
27
|
block title
|
@@ -75,7 +76,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
75
76
|
+sidebarRender
|
76
77
|
div(class="dimmer")
|
77
78
|
div(id="player")
|
78
|
-
button(id="showBtn") 11111
|
79
79
|
footer(id="footer")
|
80
80
|
div(class="inner")
|
81
81
|
div(class="widgets")
|
@@ -113,7 +113,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
113
113
|
katex: #{!!page.math},
|
114
114
|
mermaid: #{!!page.mermaid},
|
115
115
|
audio: !{audioValue},
|
116
|
-
fancybox: #{page.fancybox !== false},
|
117
116
|
nocopy: #{!!page.nocopy},
|
118
117
|
outime: #{page.outime !== false},
|
119
118
|
template: `!{__('outime.template')}`,
|
@@ -131,14 +130,8 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
131
130
|
!= partial('_partials/third-party/clarity.pug', {}, {cache: true})
|
132
131
|
!= partial('_partials/third-party/google-analytics.pug', {}, {cache: true})
|
133
132
|
|
134
|
-
!= vendor_js('pace')
|
135
|
-
!= vendor_js('jquery')
|
136
|
-
!= vendor_js('justifiedGallery')
|
137
|
-
!= vendor_js('fancybox')
|
138
|
-
|
139
|
-
if theme.polyfill.enable
|
140
|
-
script(src=`https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=${theme.polyfill.features}` defer)
|
141
|
-
|
142
133
|
!= _js('siteInit.js')
|
143
134
|
|
135
|
+
!= shokax_inject('bodyEnd')
|
136
|
+
|
144
137
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
mixin navpost(item, type)
|
2
|
-
- var enableNextGradientCover = theme?.
|
2
|
+
- var enableNextGradientCover = theme?.homeConfig?.coverConfig?.enableNextGradientCover
|
3
3
|
- var postText = item.title || item.link || __('post.untitled')
|
4
4
|
- var lastcat = item.categories.last()
|
5
5
|
- var itemlink = `<span class="type">${__('post.' + type)}</span>${lastcat && lastcat.name ? `<span class="category"><i class="ic i-flag"></i>${lastcat.name}</span>` : ''}<h3>${postText}</h3>`
|
@@ -11,7 +11,7 @@ article(itemscope itemtype="http://schema.org/Article" class="post block" lang=t
|
|
11
11
|
if post.photos && post.photos.length
|
12
12
|
div(class="gallery" itemscope itemtype="http://schema.org/ImageGallery")
|
13
13
|
each photo in post.photos
|
14
|
-
img(loading="lazy" decoding="async"
|
14
|
+
img(loading="lazy" decoding="async" src=_image_url(photo, post.path) itemprop="contentUrl")
|
15
15
|
if theme.summary.enable && page.layout === 'post'
|
16
16
|
div(class='tabs' id='summary')
|
17
17
|
div(class="show-btn")
|
@@ -38,3 +38,5 @@ article(itemscope itemtype="http://schema.org/Article" class="post block" lang=t
|
|
38
38
|
!= partial('_partials/post/reward.pug', {}, {cache: true})
|
39
39
|
if theme.creative_commons.license
|
40
40
|
!= partial('_partials/post/copyright.pug')
|
41
|
+
|
42
|
+
!= shokax_inject('postBodyEnd')
|
@@ -13,6 +13,6 @@ if page.reward !== false
|
|
13
13
|
else
|
14
14
|
- var translation = name
|
15
15
|
div
|
16
|
-
img(loading="lazy"
|
16
|
+
img(loading="lazy" src=`${url_for(theme.statics + theme.assets + image) }` alt=`${ author } ${ translation }`)
|
17
17
|
p
|
18
18
|
!= translation
|
@@ -36,5 +36,7 @@ div(class="social")
|
|
36
36
|
- var sidebarIcon = '<i class="ic i-' + link.split('||')[1].trim() + '"></i>'
|
37
37
|
!= _url(sidebarURL, sidebarIcon, {title: sidebarURL, class: 'item ' + name})
|
38
38
|
|
39
|
+
!= shokax_inject('sidebar')
|
40
|
+
|
39
41
|
div(class="menu")
|
40
42
|
!= partial('_partials/sidebar/menu.pug')
|
package/layout/page.pug
CHANGED
@@ -5,8 +5,6 @@ include _mixin/comment.pug
|
|
5
5
|
block head
|
6
6
|
!= _css('post.css')
|
7
7
|
// 临时处理
|
8
|
-
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css")
|
9
|
-
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css")
|
10
8
|
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css")
|
11
9
|
|
12
10
|
block title
|
package/layout/post.pug
CHANGED
@@ -7,8 +7,6 @@ block head
|
|
7
7
|
!= _css('post.css')
|
8
8
|
!= _css('mermaid.css')
|
9
9
|
// 临时处理
|
10
|
-
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css")
|
11
|
-
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/justifiedGallery/3.8.1/css/justifiedGallery.min.css")
|
12
10
|
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css")
|
13
11
|
|
14
12
|
block title
|
package/package.json
CHANGED
@@ -1,39 +1,32 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.5.0-dev-
|
3
|
+
"version": "0.5.0-dev-2f28258",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
|
7
7
|
"author": "zkz098",
|
8
8
|
"license": "AGPL-3.0-or-later",
|
9
|
-
"packageManager": "pnpm@10.
|
9
|
+
"packageManager": "pnpm@10.10.0",
|
10
10
|
"scripts": {
|
11
11
|
"test": "tsc --build --verbose",
|
12
12
|
"build": "node ./toolbox/compiler.mjs"
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
|
-
"@types/fancybox": "^3.5.7",
|
16
|
-
"@types/jquery": "^3.5.32",
|
17
15
|
"@types/js-yaml": "^4.0.9",
|
18
16
|
"@types/katex": "^0.16.7",
|
19
|
-
"@types/node": "^22.
|
20
|
-
"
|
21
|
-
"
|
22
|
-
"@typescript-eslint/parser": "^8.27.0",
|
23
|
-
"eslint": "^9.22.0",
|
24
|
-
"eslint-config-standard": "~17",
|
25
|
-
"eslint-plugin-vue": "^10.0.0",
|
26
|
-
"glob": "^11.0.1",
|
27
|
-
"typescript": "^5.8.2"
|
17
|
+
"@types/node": "^22.15.3",
|
18
|
+
"glob": "^11.0.2",
|
19
|
+
"typescript": "^5.8.3"
|
28
20
|
},
|
29
21
|
"dependencies": {
|
30
|
-
"@algolia/client-search": "^5.
|
22
|
+
"@algolia/client-search": "^5.24.0",
|
31
23
|
"@common.js/p-limit": "^6.1.0",
|
32
24
|
"@waline/client": "^3.5.6",
|
33
|
-
"algoliasearch": "5.
|
34
|
-
"dompurify": "^3.2.
|
35
|
-
"es-toolkit": "^1.
|
36
|
-
"esbuild": "^0.25.
|
25
|
+
"algoliasearch": "5.24.0",
|
26
|
+
"dompurify": "^3.2.5",
|
27
|
+
"es-toolkit": "^1.37.2",
|
28
|
+
"esbuild": "^0.25.3",
|
29
|
+
"hana-img-viewer": "^1.2.1",
|
37
30
|
"hexo": "^7.3.0",
|
38
31
|
"hexo-algoliasearch": "^2.0.1",
|
39
32
|
"hexo-feed": "^1.1.2",
|
@@ -41,16 +34,15 @@
|
|
41
34
|
"hexo-pagination": "^4.0.0",
|
42
35
|
"hexo-renderer-pug": "^3.0.0",
|
43
36
|
"hexo-util": "^3.3.0",
|
44
|
-
"instantsearch.js": "^4.78.
|
37
|
+
"instantsearch.js": "^4.78.2",
|
45
38
|
"js-yaml": "^4.1.0",
|
46
|
-
"katex": "^0.16.
|
39
|
+
"katex": "^0.16.22",
|
47
40
|
"mouse-firework": "^0.1.1",
|
48
|
-
"nyx-player": "^0.0
|
41
|
+
"nyx-player": "^0.1.0",
|
49
42
|
"quicklink": "^2.3.0",
|
50
43
|
"theme-shokax-anime": "^0.0.8",
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"unlazy": "^0.12.3"
|
44
|
+
"twikoo": "^1.6.42",
|
45
|
+
"vue": "^3.5.13"
|
54
46
|
},
|
55
47
|
"engines": {
|
56
48
|
"node": ">=20.0.0"
|
package/scripts/filters/post.js
CHANGED
@@ -24,6 +24,7 @@ var import_package = __toESM(require("../../package.json"));
|
|
24
24
|
var import_promises = __toESM(require("node:fs/promises"));
|
25
25
|
var import_esbuild = require("esbuild");
|
26
26
|
var import_utils = require("../utils");
|
27
|
+
var import_hexo_util = require("hexo-util");
|
27
28
|
hexo.extend.generator.register("script", async function(locals) {
|
28
29
|
const config = hexo.config;
|
29
30
|
const theme = hexo.theme.config;
|
@@ -45,9 +46,7 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
45
46
|
url: theme.css + "/mermaid.css",
|
46
47
|
local: true,
|
47
48
|
sri: ""
|
48
|
-
}
|
49
|
-
fancybox: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.fancybox),
|
50
|
-
justifiedGallery: (0, import_utils.getVendorLink)(hexo, theme.vendors.css.justifiedGallery)
|
49
|
+
}
|
51
50
|
},
|
52
51
|
loader: theme.loader,
|
53
52
|
search: null,
|
@@ -97,7 +96,8 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
97
96
|
enterPoint = "node_modules/hexo-theme-shokax/source/js/_app/pjax/siteInit.ts";
|
98
97
|
patchDir = "node_modules/hexo-theme-shokax/source/js/_app/components/cloudflare.ts";
|
99
98
|
}
|
100
|
-
await (0, import_esbuild.build)({
|
99
|
+
const resultApp = await (0, import_esbuild.build)({
|
100
|
+
write: false,
|
101
101
|
entryPoints: [enterPoint],
|
102
102
|
bundle: true,
|
103
103
|
outdir: "shokaxTemp",
|
@@ -113,13 +113,11 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
113
113
|
platform: "browser",
|
114
114
|
format: "esm",
|
115
115
|
target: ["es2022"],
|
116
|
-
minify:
|
116
|
+
minify: !theme.modules.debug,
|
117
117
|
legalComments: "linked",
|
118
118
|
mainFields: ["module", "browser", "main"],
|
119
119
|
splitting: true,
|
120
120
|
define: {
|
121
|
-
__UNLAZY_LOGGING__: "false",
|
122
|
-
__UNLAZY_HASH_DECODING__: theme.modules.unlazyHash ? "true" : "false",
|
123
121
|
__shokax_player__: theme.modules.player ? "true" : "false",
|
124
122
|
__shokax_VL__: theme.modules.visibilityListener ? "true" : "false",
|
125
123
|
__shokax_fireworks__: theme.fireworks && theme.fireworks.enable && theme.fireworks.options && theme.modules.fireworks ? "true" : "false",
|
@@ -127,7 +125,6 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
127
125
|
__shokax_outime__: theme.outime.enable ? "true" : "false",
|
128
126
|
__shokax_tabs__: theme.modules.tabs ? "true" : "false",
|
129
127
|
__shokax_quiz__: theme.modules.quiz ? "true" : "false",
|
130
|
-
__shokax_fancybox__: theme.modules.fancybox ? "true" : "false",
|
131
128
|
__shokax_waline__: theme.waline.enable ? "true" : "false",
|
132
129
|
__shokax_twikoo__: theme.twikoo.enable ? "true" : "false",
|
133
130
|
__shokax_antiFakeWebsite__: theme.experiments.antiFakeWebsite ? "true" : "false",
|
@@ -136,27 +133,51 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
136
133
|
}
|
137
134
|
});
|
138
135
|
const res = [];
|
139
|
-
|
140
|
-
|
141
|
-
if (file.
|
136
|
+
resultApp.outputFiles.forEach((file) => {
|
137
|
+
let fileName = "";
|
138
|
+
if (file.path.split("\\").length > 1) {
|
139
|
+
fileName = file.path.split("\\").pop();
|
140
|
+
} else {
|
141
|
+
fileName = file.path.split("/").pop();
|
142
|
+
}
|
143
|
+
if (file.path.endsWith(".js")) {
|
142
144
|
res.push({
|
143
|
-
path: theme.js + "/" +
|
144
|
-
data:
|
145
|
+
path: theme.js + "/" + fileName,
|
146
|
+
data: file.text
|
145
147
|
});
|
146
|
-
} else if (file.endsWith(".css")) {
|
148
|
+
} else if (file.path.endsWith(".css")) {
|
147
149
|
res.push({
|
148
|
-
path: theme.css + "/" +
|
149
|
-
data:
|
150
|
+
path: theme.css + "/" + fileName,
|
151
|
+
data: file.text
|
150
152
|
});
|
151
153
|
} else {
|
152
154
|
res.push({
|
153
|
-
path: theme.statics + "/" +
|
154
|
-
data:
|
155
|
+
path: theme.statics + "/" + fileName,
|
156
|
+
data: file.text
|
155
157
|
});
|
156
158
|
}
|
157
159
|
});
|
158
|
-
|
159
|
-
|
160
|
+
hexo.extend.helper.register("preloadjs", function() {
|
161
|
+
let resultHtml = "";
|
162
|
+
res.forEach((file) => {
|
163
|
+
if (file.path.endsWith(".js")) {
|
164
|
+
resultHtml += (0, import_hexo_util.htmlTag)("link", { rel: "modulepreload", href: import_hexo_util.url_for.call(this, file.path) }, "");
|
165
|
+
}
|
166
|
+
});
|
167
|
+
return resultHtml;
|
168
|
+
});
|
169
|
+
hexo.extend.helper.register("load_async_css", function() {
|
170
|
+
let resultHtml = "";
|
171
|
+
res.forEach((file) => {
|
172
|
+
if (file.path.endsWith(".css")) {
|
173
|
+
resultHtml += (0, import_hexo_util.htmlTag)("link", { rel: "stylesheet", href: import_hexo_util.url_for.call(this, file.path), media: "none", onload: "this.media='all'" }, "");
|
174
|
+
}
|
175
|
+
});
|
176
|
+
return resultHtml;
|
177
|
+
});
|
178
|
+
if (theme.modules.cloudflarePatch) {
|
179
|
+
const resultCF = await (0, import_esbuild.build)({
|
180
|
+
write: false,
|
160
181
|
entryPoints: [patchDir],
|
161
182
|
bundle: true,
|
162
183
|
platform: "browser",
|
@@ -171,12 +192,12 @@ hexo.extend.generator.register("script", async function(locals) {
|
|
171
192
|
}
|
172
193
|
},
|
173
194
|
target: ["es2022"],
|
174
|
-
minify:
|
195
|
+
minify: !theme.modules.debug,
|
175
196
|
outfile: "cf-patch.js"
|
176
197
|
});
|
177
198
|
res.push({
|
178
199
|
path: theme.js + "/cf-patch.js",
|
179
|
-
data:
|
200
|
+
data: resultCF.outputFiles[0].text
|
180
201
|
});
|
181
202
|
}
|
182
203
|
return res;
|
@@ -90,6 +90,7 @@ class SummaryDatabase {
|
|
90
90
|
if (this.data.summaries[pathHash]?.sha256 === contentHash) {
|
91
91
|
return this.data.summaries[pathHash].summary;
|
92
92
|
} else {
|
93
|
+
hexo.log.info(`[ShokaX Summary AI] \u6B63\u5728\u5411 API \u8BF7\u6C42 ${path} \u7684\u6458\u8981`);
|
93
94
|
const summaryContent = await getSummaryByAPI(content);
|
94
95
|
this.data.summaries[pathHash] = {
|
95
96
|
summary: summaryContent,
|
@@ -1,28 +1,4 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
10
|
-
for (let key of __getOwnPropNames(from))
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
13
|
-
}
|
14
|
-
return to;
|
15
|
-
};
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
22
|
-
mod
|
23
|
-
));
|
24
1
|
var import_hexo_util = require("hexo-util");
|
25
|
-
var import_node_fs = __toESM(require("node:fs"));
|
26
2
|
const randomBG = function(count = 1, image_server = null, image_list = []) {
|
27
3
|
let i;
|
28
4
|
if (image_server) {
|
@@ -35,15 +11,6 @@ const randomBG = function(count = 1, image_server = null, image_list = []) {
|
|
35
11
|
}
|
36
12
|
return image_server + "?" + Math.floor(Math.random() * 999999);
|
37
13
|
}
|
38
|
-
const parseImage = function(img, size) {
|
39
|
-
if (img.startsWith("//") || img.startsWith("https")) {
|
40
|
-
return img;
|
41
|
-
} else if (hexo.theme.config.experiments?.usingRelative) {
|
42
|
-
return img;
|
43
|
-
} else {
|
44
|
-
throw new Error("Image URL is not valid: " + img);
|
45
|
-
}
|
46
|
-
};
|
47
14
|
if (count && count > 1) {
|
48
15
|
let shuffled = image_list.slice(0);
|
49
16
|
while (shuffled.length <= 6) {
|
@@ -59,31 +26,12 @@ const randomBG = function(count = 1, image_server = null, image_list = []) {
|
|
59
26
|
shuffled[index] = shuffled[i];
|
60
27
|
shuffled[i] = temp;
|
61
28
|
}
|
62
|
-
return shuffled.slice(min)
|
63
|
-
return parseImage(img, "large");
|
64
|
-
});
|
29
|
+
return shuffled.slice(min);
|
65
30
|
}
|
66
|
-
return
|
31
|
+
return image_list[Math.floor(Math.random() * image_list.length)];
|
67
32
|
};
|
68
|
-
hexo.extend.helper.register("
|
69
|
-
|
70
|
-
let res = "";
|
71
|
-
import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
|
72
|
-
if (file.endsWith(".js")) {
|
73
|
-
res += (0, import_hexo_util.htmlTag)("link", { rel: "modulepreload", href: import_hexo_util.url_for.call(this, `${statics}${js}/${file}`) }, "");
|
74
|
-
}
|
75
|
-
});
|
76
|
-
return res;
|
77
|
-
});
|
78
|
-
hexo.extend.helper.register("load_async_css", function() {
|
79
|
-
const { statics, css } = hexo.theme.config;
|
80
|
-
let res = "";
|
81
|
-
import_node_fs.default.readdirSync("./shokaxTemp").forEach((file) => {
|
82
|
-
if (file.endsWith(".css")) {
|
83
|
-
res += (0, import_hexo_util.htmlTag)("link", { rel: "stylesheet", href: import_hexo_util.url_for.call(this, `${statics}${css}/${file}`), media: "none", onload: "this.media='all'" }, "");
|
84
|
-
}
|
85
|
-
});
|
86
|
-
return res;
|
33
|
+
hexo.extend.helper.register("shokax_inject", function(point) {
|
34
|
+
return hexo.theme.config.injects[point].map((item) => this.partial(item.layout, item.locals, item.options)).join("");
|
87
35
|
});
|
88
36
|
hexo.extend.helper.register("_url", function(path, text, options = {}) {
|
89
37
|
if (!path) {
|