hexo-theme-shokax 0.4.25 → 0.5.0-beta1
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 +19 -31
- package/UsageRestrictions.md +2 -2
- package/_config.yml +11 -25
- package/_images.yml +0 -7
- package/eslint.config.mjs +4 -5
- package/layout/_mixin/card.pug +1 -2
- package/layout/_mixin/comment.pug +0 -1
- package/layout/_mixin/segment.pug +1 -1
- package/layout/_partials/footer.pug +1 -4
- package/layout/_partials/head/head.pug +0 -8
- package/layout/_partials/head/pwa.pug +1 -1
- package/layout/_partials/header.pug +0 -1
- package/layout/_partials/layout.pug +4 -14
- package/layout/_partials/post/footer.pug +0 -2
- package/layout/_partials/post/post.pug +1 -2
- package/layout/_partials/post/reward.pug +1 -1
- package/layout/_partials/sidebar/overview.pug +0 -2
- package/layout/_partials/third-party/baidu-analytics.pug +1 -1
- package/layout/_partials/third-party/google-analytics.pug +1 -1
- package/layout/archive.pug +3 -0
- package/layout/category.pug +3 -0
- package/layout/index.pug +3 -0
- package/layout/page.pug +7 -0
- package/layout/post.pug +8 -0
- package/layout/tag.pug +3 -0
- package/package.json +9 -10
- package/scripts/filters/post.js +1 -1
- package/scripts/generaters/config.js +12 -7
- package/scripts/generaters/images.js +9 -8
- package/scripts/generaters/index.js +57 -44
- package/scripts/generaters/script.js +18 -33
- package/scripts/helpers/engine.js +2 -7
- package/scripts/plugin/index.js +32 -69
- package/scripts/tags/media.js +1 -1
- package/source/css/app.styl +0 -13
- package/source/css/page.styl +3 -0
- package/source/css/post.styl +5 -0
- package/source/css/scaffolding.styl +5 -0
- package/source/js/_app/components/comments.ts +2 -3
- package/source/js/_app/components/sidebar.ts +35 -35
- package/source/js/_app/components/tcomments.ts +0 -1
- package/source/js/_app/globals/globalVars.ts +0 -15
- package/source/js/_app/globals/handles.ts +9 -9
- package/source/js/_app/globals/themeColor.ts +5 -6
- package/source/js/_app/globals/thirdparty.ts +2 -2
- package/source/js/_app/globals/tools.ts +4 -6
- package/source/js/_app/library/anime.ts +30 -19
- package/source/js/_app/library/declare.d.ts +0 -5
- package/source/js/_app/library/proto.ts +0 -67
- package/source/js/_app/library/vue.ts +7 -7
- package/source/js/_app/page/common.ts +8 -10
- package/source/js/_app/page/fancybox.ts +6 -8
- package/source/js/_app/page/post.ts +42 -54
- package/source/js/_app/page/search.ts +1 -6
- package/source/js/_app/page/tab.ts +8 -9
- package/source/js/_app/pjax/domInit.ts +19 -14
- package/source/js/_app/pjax/refresh.ts +8 -36
- package/source/js/_app/pjax/siteInit.ts +13 -42
- package/source/js/_app/player.ts +14 -798
- package/toolbox/compiler.mjs +20 -48
- package/toolbox/dev-version.mjs +14 -0
- package/README_en.MD +0 -71
- package/scripts/plugin/lib/injects-point.js +0 -41
- package/scripts/plugin/lib/injects.js +0 -105
- package/source/js/_app/library/dom.ts +0 -28
- package/source/js/_app/library/loadFile.ts +0 -47
- package/source/js/_app/library/scriptPjax.ts +0 -56
- package/source/js/_app/library/storage.ts +0 -12
package/README.md
CHANGED
@@ -1,34 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
| 多种评论系统支持 | ✅ | AI生成文章概括 | 🔬 |
|
21
|
-
| 底部备案号 | ✅ | 自定义页尾 | ✅* |
|
22
|
-
| CSS渐变封面 | ✅ | typescript支持 | ✅ |
|
23
|
-
|
24
|
-
备注:
|
25
|
-
- *: 需要使用注入API实现
|
26
|
-
- 🔬: 实验中,可能存在问题
|
27
|
-
|
28
|
-
|
29
|
-
## 🔧 如何安装?
|
30
|
-
注意: 本项目需要 node.js 18.x 或更高版本才能运行 \
|
31
|
-
见文档中[如何安装](https://hexo.docs.shokax.top/getting-started/)部分
|
1
|
+
**🏗️ 当前分支为 ShokaX 0.5 Dev分支,不建议普通用户使用** \
|
2
|
+
此分支为 ShokaX 0.5 实验性变更分支,确保0.5开发期间0.4的维护不受影响
|
3
|
+
|
4
|
+
计划更改:
|
5
|
+
- [x] 移除 pjax
|
6
|
+
- [x] 移除 quicklink
|
7
|
+
- [x] 移除 assetUrl 为基的动态 Vendor 机制
|
8
|
+
- [x] 移除 ShokaX Inject
|
9
|
+
- [ ] 引入新的 Inject 类技术 (长期)
|
10
|
+
- [ ] 引入新的工作流程
|
11
|
+
- [x] 重构 player (nyx-player)
|
12
|
+
- [ ] 重构并修改代码块
|
13
|
+
- [x] 优化和异步化 Smart Bundle 技术
|
14
|
+
- [x] 优化 CSS 结构和加载
|
15
|
+
- [x] 修复/重置 fancybox
|
16
|
+
- [ ] 修复模板长期遗留问题
|
17
|
+
- [ ] 修复 images 遗留问题
|
18
|
+
- [ ] 规范化配置文件
|
19
|
+
- [ ] 规范化文档
|
32
20
|
|
33
21
|
## 📚子项目
|
34
22
|
- [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
|
package/UsageRestrictions.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# 使用限制
|
2
2
|
感谢您使用 ShokaX 及其子项目。在使用之前,请仔细阅读并遵守以下使用限制。使用 ShokaX 及其子项目,表示您同意遵守以下规定:
|
3
3
|
## 归属权
|
4
|
-
1.
|
4
|
+
1. 您需要保留控制台的主题链接。 (根据 `AGPLv3 七 (b)`)
|
5
5
|
2. 分发 ShokaX 及其子项目的修改版本时,必须以合理的方式更改软件名称或版本号,以将其与原始版本区分开来。(根据 `AGPLv3 七 (c)`)
|
6
6
|
|
7
7
|
## 责任
|
@@ -16,7 +16,7 @@
|
|
16
16
|
## 处理方式
|
17
17
|
如果您违反了上述使用限制和AGPLv3的任何规定,ShokaX 项目组保留采取以下措施之一或多个的权利:
|
18
18
|
- 发出警告通知并要求立即纠正违规行为;(根据`AGPLv3 八`)
|
19
|
-
- 暂停或终止您对 ShokaX 及其子项目的使用权限并取消
|
19
|
+
- 暂停或终止您对 ShokaX 及其子项目的使用权限并取消AGPLv3授予您的权利;(根据`AGPLv3 八`)
|
20
20
|
- 取消您获取 ShokaX 社区支持和进行协作的权利;(社区管理)
|
21
21
|
- 追究法律责任,包括要求赔偿因违规行为给 ShokaX 项目组造成的损失。(依照相关法律而定)
|
22
22
|
|
package/_config.yml
CHANGED
@@ -38,15 +38,17 @@ experiments:
|
|
38
38
|
|
39
39
|
homeConfig:
|
40
40
|
gradient: false # 使用CSS渐变作为文章封面
|
41
|
-
# fixedCover 性能比默认的更好,且开启时将启用LCP优化和预加载
|
41
|
+
# fixedCover 性能比默认的更好,且开启时将启用LCP优化和预加载
|
42
42
|
fixedCover: "" # 主页面cover(为空则使用bing随机图片)
|
43
|
+
cateCards:
|
44
|
+
- slug: # 分类 slug
|
45
|
+
cover: # 分类封面
|
43
46
|
|
44
47
|
# ShokaX 模块化分包引入设置
|
45
48
|
# 请关闭所有不使用的模块以优化主题 js 体积和性能
|
46
49
|
modules:
|
47
50
|
player: true # 启用音乐播放器
|
48
51
|
fireworks: true # 启用鼠标点击烟花特效
|
49
|
-
unlazyHash: false # 启用unlazy hash预览图支持
|
50
52
|
visibilityListener: true # 启用可见度监听器
|
51
53
|
tabs: true # 启用选项卡扩展支持,如需开启 summary 功能请一并开启
|
52
54
|
quiz: true # 启用文章内问题扩展支持
|
@@ -328,10 +330,9 @@ creative_commons:
|
|
328
330
|
# bgm
|
329
331
|
# 不使用请打开noplayer功能
|
330
332
|
audio:
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
# - https://music.163.com/#/playlist?id=2297706586
|
333
|
+
- title: 列表1
|
334
|
+
list:
|
335
|
+
- https://music.163.com/#/playlist?id=2943811283
|
335
336
|
# - title: 列表2
|
336
337
|
# list:
|
337
338
|
# - https://music.163.com/#/playlist?id=2031842656
|
@@ -345,21 +346,6 @@ search:
|
|
345
346
|
hits:
|
346
347
|
per_page: 10
|
347
348
|
|
348
|
-
# Dependencies: https://github.com/amehime/hexo-renderer-multi-markdown-it
|
349
|
-
pangu: false
|
350
|
-
|
351
|
-
# Quicklink Support
|
352
|
-
# For more information: https://github.com/GoogleChromeLabs/quicklink
|
353
|
-
quicklink:
|
354
|
-
# Custom a time in milliseconds by which the browser must execute prefetching.
|
355
|
-
timeout: 3000
|
356
|
-
# Default (true) will attempt to use the fetch() API if supported (rather than link[rel=prefetch]).
|
357
|
-
priority: true
|
358
|
-
|
359
|
-
# For more flexibility you can add some patterns (RegExp, Function, or Array) to ignores.
|
360
|
-
# See: https://github.com/GoogleChromeLabs/quicklink#custom-ignore-patterns
|
361
|
-
ignores:
|
362
|
-
|
363
349
|
#! ---------------------------------------------------------------
|
364
350
|
#! DO NOT EDIT THE FOLLOWING `vendors` SETTINGS
|
365
351
|
#! UNLESS YOU KNOW WHAT YOU ARE DOING
|
@@ -385,6 +371,10 @@ vendors:
|
|
385
371
|
url: justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
|
386
372
|
sri: "sha384-TOxsBplaL96/QDWPIUg+ye3v89qSE3s22XNtJMmCeZEep3cVDmXy1zEfZvVv+y2m"
|
387
373
|
async_js:
|
374
|
+
copy_tex:
|
375
|
+
source: cdnjs
|
376
|
+
url: KaTeX/0.16.9/contrib/copy-tex.min.js
|
377
|
+
sri: "sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A"
|
388
378
|
fancybox:
|
389
379
|
source: cdnjs
|
390
380
|
url: fancybox/3.5.7/jquery.fancybox.min.js
|
@@ -393,10 +383,6 @@ vendors:
|
|
393
383
|
source: cdnjs
|
394
384
|
url: justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
|
395
385
|
sri: "sha384-TOxsBplaL96/QDWPIUg+ye3v89qSE3s22XNtJMmCeZEep3cVDmXy1zEfZvVv+y2m"
|
396
|
-
copy_tex:
|
397
|
-
source: cdnjs
|
398
|
-
url: KaTeX/0.16.9/contrib/copy-tex.min.js
|
399
|
-
sri: "sha384-ww/583aHhxWkz5DEVn6OKtNiIaLi2iBRNZXfJRiY1Ai7tnJ9UXpEsyvOITVpTl4A"
|
400
386
|
css:
|
401
387
|
katex:
|
402
388
|
source: cdnjs
|
package/_images.yml
CHANGED
@@ -1,9 +1,2 @@
|
|
1
1
|
# 此images已失效,见https://github.com/theme-shoka-x/hexo-theme-shokaX/issues/6
|
2
|
-
- 6833939bly1giciryrr3rj20zk0m8nhk.jpg
|
3
|
-
- 6833939bly1gicis081o9j20zk0m8dmr.jpg
|
4
|
-
- 6833939bly1gicis3attqj20zk0m8k7l.jpg
|
5
|
-
- 6833939bly1giciszlczyj20zk0m816d.jpg
|
6
|
-
- 6833939bly1gicit31ffoj20zk0m8naf.jpg
|
7
|
-
- 6833939bly1gicit4jrvuj20zk0m8785.jpg
|
8
|
-
- 6833939bly1gicitcxhpij20zk0m8hdt.jpg
|
9
2
|
|
package/eslint.config.mjs
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
+
import tsParser from "@typescript-eslint/parser";
|
2
|
+
|
1
3
|
export default [
|
2
4
|
{
|
3
|
-
files: ['*.ts', '*.tsx', '*.vue'],
|
5
|
+
files: ['*.ts', '*.tsx', '*.vue', '*.mjs'],
|
4
6
|
languageOptions: {
|
5
|
-
parser:
|
6
|
-
parserOptions: {
|
7
|
-
ecmaVersion: 2022
|
8
|
-
}
|
7
|
+
parser: tsParser
|
9
8
|
},
|
10
9
|
plugins: {
|
11
10
|
'@typescript-eslint': await import('@typescript-eslint/eslint-plugin'),
|
package/layout/_mixin/card.pug
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
mixin CardRender(item)
|
2
|
-
- cover = url_for(theme.statics + item.slug + '/cover.jpg')
|
3
2
|
- itemname = item.name
|
4
3
|
|
5
4
|
section(class="item")
|
6
|
-
div(class="cover" data-background-image
|
5
|
+
div(class="cover" data-background-image=`${theme.statics}${item.slug}/cover.${getCoverExt(item.slug)}`)
|
7
6
|
h2(class="title")
|
8
7
|
!= itemname
|
9
8
|
- var temp = item?.top?.name
|
@@ -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,9 +35,6 @@ 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')
|
43
40
|
|
@@ -41,7 +41,6 @@ each dnsLink in dnslinks
|
|
41
41
|
- var fontConfig = theme.font?.loadFromGoogle
|
42
42
|
if fontConfig
|
43
43
|
!= _vendor_font()
|
44
|
-
!= _css('app.css')
|
45
44
|
!= preloadjs()
|
46
45
|
!= load_async_css()
|
47
46
|
|
@@ -49,10 +48,3 @@ if theme.experiments.cloudflarePatch
|
|
49
48
|
!= _js('cf-patch.js')
|
50
49
|
|
51
50
|
include pwa.pug
|
52
|
-
|
53
|
-
- var qw = theme?.qweather?.enable
|
54
|
-
if qw
|
55
|
-
style.
|
56
|
-
img[data-v-7d48daab] {
|
57
|
-
max-width: 2em !important;
|
58
|
-
}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- var timeNow = new Date().getTime()
|
3
3
|
if theme.pwa.enable
|
4
4
|
- var sworker = theme.pwa.serviceworker
|
5
|
-
script(
|
5
|
+
script(async).
|
6
6
|
if ('serviceWorker' in navigator) {
|
7
7
|
navigator.serviceWorker.register("/#{sworker}?time=#{timeNow}").then(async (reg) => {
|
8
8
|
if (window.localStorage.getItem('install') !== 'true') {
|
@@ -2,10 +2,6 @@ include ../_mixin/breadcrumb.pug
|
|
2
2
|
include ../_mixin/sidebar.pug
|
3
3
|
include ../_mixin/widgets.pug
|
4
4
|
|
5
|
-
- ignores = []
|
6
|
-
if (theme.quicklink.ignores)
|
7
|
-
- ignores.push(theme.quicklink.ignores)
|
8
|
-
|
9
5
|
- var covers = _cover_index(page, 6)
|
10
6
|
- var enableFixedCover = theme.homeConfig?.fixedCover
|
11
7
|
- var enablePreload = theme.experiments?.coverConfig?.enablePreload
|
@@ -25,7 +21,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
25
21
|
link(rel="preload" href!=covers as="image" fetchpriority="high")
|
26
22
|
|
27
23
|
!= partial('_partials/head/head_com.pug')
|
28
|
-
|
24
|
+
block head
|
29
25
|
title
|
30
26
|
block title
|
31
27
|
!= `${alternate?alternate + " = ":""}${title}${subtitle?" = "+subtitle:""}`
|
@@ -78,6 +74,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
78
74
|
block sidebar
|
79
75
|
+sidebarRender
|
80
76
|
div(class="dimmer")
|
77
|
+
div(id="player")
|
81
78
|
footer(id="footer")
|
82
79
|
div(class="inner")
|
83
80
|
div(class="widgets")
|
@@ -126,12 +123,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
126
123
|
essay: `#{__('quiz.essay')}`,
|
127
124
|
gap_fill: `#{__('quiz.gap_fill')}`,
|
128
125
|
mistake: `#{__('quiz.mistake')}`
|
129
|
-
}
|
130
|
-
ignores: [
|
131
|
-
(uri) => uri.includes('#'),
|
132
|
-
(uri) => new RegExp(LOCAL.path + '$').test(uri),
|
133
|
-
!{JSON.stringify(ignores)}
|
134
|
-
]
|
126
|
+
}
|
135
127
|
};
|
136
128
|
|
137
129
|
!= partial('_partials/third-party/baidu-analytics.pug', {}, {cache: true})
|
@@ -140,14 +132,12 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
140
132
|
|
141
133
|
!= vendor_js('pace')
|
142
134
|
!= vendor_js('jquery')
|
143
|
-
!= vendor_js('fancybox')
|
144
135
|
!= vendor_js('justifiedGallery')
|
136
|
+
!= vendor_js('fancybox')
|
145
137
|
|
146
138
|
if theme.polyfill.enable
|
147
139
|
script(src=`https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0&features=${theme.polyfill.features}` defer)
|
148
140
|
|
149
141
|
!= _js('siteInit.js')
|
150
142
|
|
151
|
-
!= shokax_inject('bodyEnd')
|
152
|
-
|
153
143
|
|
@@ -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,4 +38,3 @@ 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
|
-
!= 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,7 +36,5 @@ 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
|
-
|
41
39
|
div(class="menu")
|
42
40
|
!= partial('_partials/sidebar/menu.pug')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
- var googleId = theme.visitor.googleAnalytics
|
2
2
|
if googleId
|
3
3
|
script(async, src=`https://www.googletagmanager.com/gtag/js?id=${ googleId }`)
|
4
|
-
script
|
4
|
+
script.
|
5
5
|
window.dataLayer = window.dataLayer || [];
|
6
6
|
function gtag() {
|
7
7
|
dataLayer.push(arguments);
|
package/layout/archive.pug
CHANGED
package/layout/category.pug
CHANGED
package/layout/index.pug
CHANGED
package/layout/page.pug
CHANGED
@@ -2,6 +2,13 @@ extends _partials/layout.pug
|
|
2
2
|
include _mixin/sidebar.pug
|
3
3
|
include _mixin/comment.pug
|
4
4
|
|
5
|
+
block head
|
6
|
+
!= _css('post.css')
|
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
|
+
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css")
|
11
|
+
|
5
12
|
block title
|
6
13
|
if page.type === 'categories'
|
7
14
|
!= __('title.all') + __('title.category')
|
package/layout/post.pug
CHANGED
@@ -3,6 +3,14 @@ include _mixin/sidebar.pug
|
|
3
3
|
include _mixin/comment.pug
|
4
4
|
include _mixin/postmeta.pug
|
5
5
|
|
6
|
+
block head
|
7
|
+
!= _css('post.css')
|
8
|
+
!= _css('mermaid.css')
|
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
|
+
link(rel="stylesheet" media="none" onload="this.media='all'" href="https://s4.zstatic.net/ajax/libs/KaTeX/0.16.9/katex.min.css")
|
13
|
+
|
6
14
|
block title
|
7
15
|
- var page_title = page.title
|
8
16
|
if page.categories && page.categories.length
|
package/layout/tag.pug
CHANGED
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0-beta1",
|
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.6.
|
9
|
+
"packageManager": "pnpm@10.6.5",
|
10
10
|
"scripts": {
|
11
11
|
"test": "tsc --build --verbose",
|
12
12
|
"build": "node ./toolbox/compiler.mjs"
|
@@ -18,8 +18,8 @@
|
|
18
18
|
"@types/katex": "^0.16.7",
|
19
19
|
"@types/node": "^22.13.10",
|
20
20
|
"@types/quicklink": "^2.3.4",
|
21
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
22
|
-
"@typescript-eslint/parser": "^8.
|
21
|
+
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
22
|
+
"@typescript-eslint/parser": "^8.27.0",
|
23
23
|
"eslint": "^9.22.0",
|
24
24
|
"eslint-config-standard": "~17",
|
25
25
|
"eslint-plugin-vue": "^10.0.0",
|
@@ -44,15 +44,14 @@
|
|
44
44
|
"instantsearch.js": "^4.78.0",
|
45
45
|
"js-yaml": "^4.1.0",
|
46
46
|
"katex": "^0.16.21",
|
47
|
-
"mouse-firework": "^0.1.
|
47
|
+
"mouse-firework": "^0.1.1",
|
48
|
+
"nyx-player": "^0.0.1",
|
48
49
|
"quicklink": "^2.3.0",
|
49
50
|
"theme-shokax-anime": "^0.0.8",
|
50
|
-
"
|
51
|
-
"twikoo": "^1.6.41",
|
52
|
-
"unlazy": "^0.12.3"
|
51
|
+
"twikoo": "^1.6.41"
|
53
52
|
},
|
54
53
|
"engines": {
|
55
|
-
"node": ">=
|
54
|
+
"node": ">=20.0.0"
|
56
55
|
},
|
57
56
|
"engineStrict": true,
|
58
57
|
"pnpm": {
|
@@ -72,4 +71,4 @@
|
|
72
71
|
"hexo-util"
|
73
72
|
]
|
74
73
|
}
|
75
|
-
}
|
74
|
+
}
|
package/scripts/filters/post.js
CHANGED
@@ -22,10 +22,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
22
22
|
mod
|
23
23
|
));
|
24
24
|
var import_hexo_util = require("hexo-util");
|
25
|
-
var
|
25
|
+
var import_promises = __toESM(require("node:fs/promises"));
|
26
26
|
var import_path = __toESM(require("path"));
|
27
27
|
var import_js_yaml = __toESM(require("js-yaml"));
|
28
|
-
hexo.extend.filter.register("before_generate", () => {
|
28
|
+
hexo.extend.filter.register("before_generate", async () => {
|
29
29
|
if (hexo.config.theme_config) {
|
30
30
|
hexo.theme.config = (0, import_hexo_util.deepMerge)(hexo.theme.config, hexo.config.theme_config);
|
31
31
|
}
|
@@ -44,20 +44,25 @@ hexo.extend.filter.register("before_generate", () => {
|
|
44
44
|
hexo.theme.config.style = {};
|
45
45
|
for (const style of ["iconfont", "colors", "custom"]) {
|
46
46
|
const custom_file = "source/_data/" + style + ".styl";
|
47
|
-
|
47
|
+
try {
|
48
|
+
await import_promises.default.readFile(custom_file);
|
48
49
|
hexo.theme.config.style[style] = import_path.default.resolve(hexo.base_dir, custom_file);
|
50
|
+
} catch {
|
49
51
|
}
|
50
52
|
}
|
51
53
|
if (data.images && data.images.length > 0) {
|
52
54
|
hexo.theme.config.image_list = data.images;
|
53
55
|
} else {
|
54
|
-
hexo.theme.config.image_list = import_js_yaml.default.load(
|
56
|
+
hexo.theme.config.image_list = import_js_yaml.default.load(await import_promises.default.readFile(import_path.default.join(__dirname, "../../_images.yml"), { encoding: "utf-8" }));
|
55
57
|
}
|
56
58
|
if (data.images_index && data.images_index.length > 0) {
|
57
59
|
hexo.theme.config.index_images = data.images_index;
|
58
|
-
} else if (import_node_fs.default.existsSync(import_path.default.join(__dirname, "../../_images_index.yml"))) {
|
59
|
-
hexo.theme.config.index_images = import_js_yaml.default.load(import_node_fs.default.readFileSync(import_path.default.join(__dirname, "../../_images_index.yml"), { encoding: "utf-8" }));
|
60
60
|
} else {
|
61
|
-
|
61
|
+
try {
|
62
|
+
const fileContent = await import_promises.default.readFile(import_path.default.join(__dirname, "../../_images_index.yml"), "utf-8");
|
63
|
+
hexo.theme.config.index_images = import_js_yaml.default.load(fileContent);
|
64
|
+
} catch (e) {
|
65
|
+
hexo.theme.config.index_images = data.index_images || [];
|
66
|
+
}
|
62
67
|
}
|
63
68
|
});
|
@@ -1,19 +1,20 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
|
-
hexo.extend.generator.register("images", function(locals) {
|
2
|
+
var import_promises = require("node:fs/promises");
|
3
|
+
hexo.extend.generator.register("images", async function(locals) {
|
4
4
|
const theme = hexo.theme.config;
|
5
5
|
const dir = "source/_data/" + theme.assets + "/";
|
6
|
-
|
6
|
+
try {
|
7
|
+
await (0, import_promises.readdir)(dir);
|
8
|
+
} catch (e) {
|
7
9
|
return;
|
8
10
|
}
|
9
11
|
const result = [];
|
10
|
-
const files =
|
11
|
-
files.forEach((file) => {
|
12
|
+
const files = await (0, import_promises.readdir)(dir);
|
13
|
+
files.forEach(async (file) => {
|
14
|
+
const fileContent = await (0, import_promises.readFile)(dir + file);
|
12
15
|
result.push({
|
13
16
|
path: theme.assets + "/" + file,
|
14
|
-
data:
|
15
|
-
return fs.createReadStream(dir + file);
|
16
|
-
}
|
17
|
+
data: fileContent
|
17
18
|
});
|
18
19
|
});
|
19
20
|
return result;
|