hexo-theme-shokax 0.3.6 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +0 -8
- package/README_en.MD +0 -5
- package/UsageRestrictions.md +5 -2
- package/_config.yml +12 -24
- package/languages/zh-HK.yml +1 -1
- package/layout/_mixin/segment.pug +1 -1
- package/layout/_partials/footer.pug +1 -1
- package/layout/_partials/layout.pug +0 -1
- package/layout/_partials/post/footer.pug +2 -2
- package/layout/_partials/sidebar/menu.pug +4 -4
- package/layout/_partials/sidebar/overview.pug +5 -4
- package/layout/_partials/third-party/clarity.pug +1 -1
- package/layout/archive.pug +1 -1
- package/layout/category.pug +11 -16
- package/layout/index.pug +2 -2
- package/layout/tag.pug +1 -1
- package/package.json +23 -23
- package/scripts/filters/post.js +0 -10
- package/scripts/generaters/config.js +7 -1
- package/scripts/generaters/script.js +3 -4
- package/scripts/helpers/engine.js +13 -30
- package/scripts/tags/links.js +2 -2
- package/source/js/_app/library/anime.js +1 -1
- package/source/js/_app/page/comment.js +0 -2
- package/source/js/_app/page/common.js +1 -19
- package/source/js/_app/pjax/refresh.js +0 -1
package/README.md
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
# 📣 公告
|
2
|
-
* [ShokaX 正在寻找社区维护者](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/137)
|
3
|
-
|
4
1
|
# hexo-theme-shokaX
|
5
2
|
![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
|
6
3
|
![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
|
@@ -44,11 +41,6 @@ SXC install shokaX
|
|
44
41
|
```
|
45
42
|
[点此](https://docs.kaitaku.xyz/guide/#%E9%85%8D%E7%BD%AE%E4%B8%BB%E9%A2%98)以进行下一步配置
|
46
43
|
|
47
|
-
github仓库建议通过右边的 releases 下载,步骤为:
|
48
|
-
- 点击 Releases 的 Latest 版本
|
49
|
-
- 下载 Assets 中的 `Source code(zip)`
|
50
|
-
- 解压即可作为主题使用
|
51
|
-
|
52
44
|
## 📚子项目
|
53
45
|
- [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
|
54
46
|
- [HRMNMI](https://github.com/theme-shoka-x/hexo-renderer-multi-next-markdown-it) ShokaX 正在使用的 markdown 渲染器 (等待重构)
|
package/README_en.MD
CHANGED
@@ -37,11 +37,6 @@ Note: This project requires node.js 18.x or higher to run. \
|
|
37
37
|
It is recommended to use [ShokaX-CLI](https://github.com/zkz098/shokaX-CLI) \
|
38
38
|
[Click here](https://docs.kaitaku.xyz/guide/#%E9%85%8D%E7%BD%AE%E4%B8%BB%E9%A2%98) for the next configuration steps.
|
39
39
|
|
40
|
-
For the GitHub repository, it is recommended to download from the releases on the right side, with the following steps:
|
41
|
-
- Click on the Latest version in Releases
|
42
|
-
- Download `Source code(zip)` from Assets
|
43
|
-
- Unzip to use as a theme
|
44
|
-
|
45
40
|
## 📚 Sub-projects
|
46
41
|
- [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX Theme Documentation (work in progress, contributions welcome!)
|
47
42
|
- [HRMNMI](https://github.com/theme-shoka-x/hexo-renderer-multi-next-markdown-it) The markdown renderer used by ShokaX (awaiting refactoring)
|
package/UsageRestrictions.md
CHANGED
@@ -14,10 +14,13 @@
|
|
14
14
|
2. ShokaX 项目组不会制作收费版或高级版的项目,ShokaX及其子项目有且只有社区版 (仅为声明)
|
15
15
|
|
16
16
|
## 处理方式
|
17
|
-
如果您违反了上述使用限制和
|
17
|
+
如果您违反了上述使用限制和AGPLv3的任何规定,ShokaX 项目组保留采取以下措施之一或多个的权利:
|
18
18
|
- 发出警告通知并要求立即纠正违规行为;(根据`AGPLv3 八`)
|
19
19
|
- 暂停或终止您对 ShokaX 及其子项目的使用权限并取消GPLv3授予您的权利;(根据`AGPLv3 八`)
|
20
20
|
- 取消您获取 ShokaX 社区支持和进行协作的权利;(社区管理)
|
21
21
|
- 追究法律责任,包括要求赔偿因违规行为给 ShokaX 项目组造成的损失。(依照相关法律而定)
|
22
22
|
|
23
|
-
当发生纠纷时,全部由甲方(即zkz098)所在地负责,适用中华人民共和国法律。
|
23
|
+
当发生纠纷时,全部由甲方(即zkz098)所在地负责,适用中华人民共和国法律。
|
24
|
+
|
25
|
+
此文件及其后续更新适用于所有版本的 ShokaX,无论其发行版内携带哪种版本的此文件或不携带此文件,均以 Github main分支储存的最新版为准。
|
26
|
+
如果本文件内容与 Github main 分支最新版有冲突的,本文件冲突部分无效,按照 Github main 分支最新版执行
|
package/_config.yml
CHANGED
@@ -140,16 +140,16 @@ iconfont: "1832207_igi8uaupcus"
|
|
140
140
|
|
141
141
|
menu:
|
142
142
|
home: / || home
|
143
|
-
about:
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
posts:
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
friends: /friends/ || heart
|
143
|
+
# about:
|
144
|
+
# default: / || user
|
145
|
+
# aboutsite: /about/ || user
|
146
|
+
# admiration: /admiration/ || coffee
|
147
|
+
# posts:
|
148
|
+
# default: / || feather
|
149
|
+
# archives: /archives/ || list-alt
|
150
|
+
# categories: /categories/ || th
|
151
|
+
# tags: /tags/ || tags
|
152
|
+
# friends: /friends/ || heart
|
153
153
|
|
154
154
|
# https://twikoo.js.org
|
155
155
|
twikoo:
|
@@ -224,7 +224,7 @@ summary:
|
|
224
224
|
# Value before `||` delimiter is the target permalink,
|
225
225
|
# secend value is the name of Font icon.
|
226
226
|
social:
|
227
|
-
github: https://github.com/name || github || "#191717"
|
227
|
+
# github: https://github.com/name || github || "#191717"
|
228
228
|
#google: https://plus.google.com/yourname || google
|
229
229
|
#twitter: https://twitter.com/yourname || twitter || "#00aff0"
|
230
230
|
#zhihu: https://www.zhihu.com/people/yourname || zhihu || "#1e88e5"
|
@@ -358,18 +358,12 @@ advVendors:
|
|
358
358
|
js:
|
359
359
|
pace:
|
360
360
|
src: bytedance:pace/1.0.2/pace.min.js
|
361
|
-
# pjax:
|
362
|
-
# src: npm:theme-shokax-pjax@latest/pjax.shokax.min.js
|
363
361
|
fetch:
|
364
362
|
src: npm:whatwg-fetch@3.4.0/dist/fetch.umd.js
|
365
|
-
# anime:
|
366
|
-
# src: npm:theme-shokax-anime@latest/anime.shokax.min.js
|
367
363
|
algolia:
|
368
364
|
src: bytedance:algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
|
369
365
|
instantsearch:
|
370
366
|
src: bytedance:instantsearch.js/4.39.0/instantsearch.production.min.js
|
371
|
-
# lazyload:
|
372
|
-
# src: bytedance:lozad.js/1.16.0/lozad.min.js
|
373
367
|
quicklink:
|
374
368
|
src: bytedance:quicklink/2.2.0/quicklink.umd.min.js
|
375
369
|
fancybox:
|
@@ -388,11 +382,8 @@ advVendors:
|
|
388
382
|
vendorsList:
|
389
383
|
js:
|
390
384
|
- pace
|
391
|
-
# - pjax
|
392
|
-
# - anime
|
393
385
|
- algolia
|
394
386
|
- instantsearch
|
395
|
-
# - lazyload
|
396
387
|
- quicklink
|
397
388
|
- fancybox
|
398
389
|
- copy_tex
|
@@ -405,15 +396,12 @@ vendors:
|
|
405
396
|
|
406
397
|
js:
|
407
398
|
pace: npm/pace-js@1.0.2/pace.min.js # ok
|
408
|
-
# pjax: npm/theme-shokax-pjax@latest/pjax.shokax.min.js # ok
|
409
399
|
fetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js # ok
|
410
|
-
# anime: npm/theme-shokax-anime@latest/anime.shokax.min.js
|
411
400
|
algolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.js # ok
|
412
401
|
instantsearch: npm/instantsearch.js@4/dist/instantsearch.production.min.js # ok
|
413
|
-
# lazyload: npm/lozad@1/dist/lozad.min.js # ok
|
414
402
|
quicklink: npm/quicklink@2/dist/quicklink.umd.js # ok
|
415
403
|
fancybox: combine/npm/jquery@3.5.1/dist/jquery.min.js,npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js,npm/justifiedGallery@3.8.1/dist/js/jquery.justifiedGallery.min.js # notok
|
416
|
-
valine: gh/amehime/MiniValine@4.2.2-beta10/dist/MiniValine.min.js # TODO 弃用
|
404
|
+
# valine: gh/amehime/MiniValine@4.2.2-beta10/dist/MiniValine.min.js # TODO 弃用
|
417
405
|
copy_tex: npm/katex@0.16.7/dist/contrib/copy-tex.min.js # ok
|
418
406
|
chart: npm/frappe-charts@1.5.0/dist/frappe-charts.min.iife.min.js # ok
|
419
407
|
|
package/languages/zh-HK.yml
CHANGED
@@ -11,7 +11,7 @@ mixin SMRender(item)
|
|
11
11
|
div(class="cover" style=`background: linear-gradient(to bottom right, ${random_color()}, ${random_color()});`)
|
12
12
|
else
|
13
13
|
div(class="cover")
|
14
|
-
!= _url(link1, '<img data-src="'+
|
14
|
+
!= _url(link1, '<img data-src="'+ _cover_index(item) +'" alt="article cover">', {itemprop: 'url', title: postText})
|
15
15
|
div(class="info")
|
16
16
|
+PMRender(item)
|
17
17
|
h3
|
@@ -1,7 +1,7 @@
|
|
1
1
|
div(class="status")
|
2
2
|
div(class="copyright")
|
3
3
|
- var copyright_year = date(null, 'YYYY')
|
4
|
-
if theme.footer.since && theme.footer.since
|
4
|
+
if theme.footer.since && theme.footer.since !== copyright_year
|
5
5
|
!= `© ${theme.footer.since} -`
|
6
6
|
span(itemprop="copyrightYear")
|
7
7
|
!= copyright_year
|
@@ -92,7 +92,6 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
92
92
|
empty: "!{__('search.empty')}",
|
93
93
|
stats: "!{__('search.stats')}"
|
94
94
|
},
|
95
|
-
valine: #{page.valine ? _safedump(page.valine) : true},
|
96
95
|
chart: #{!!page.chart},
|
97
96
|
copy_tex: #{!!page.math},
|
98
97
|
katex: #{!!page.math},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
div(class="meta")
|
2
|
-
if date(post.date)
|
2
|
+
if date(post.date) !== date(post.updated) || time(post.date) !== time(post.updated)
|
3
3
|
if theme.twikoo.enable || theme.waline.pageview
|
4
4
|
span(class="icon")
|
5
5
|
i(class="ic i-eye")
|
@@ -14,7 +14,7 @@ div(class="meta")
|
|
14
14
|
!= date(post.updated)
|
15
15
|
if theme.waline.pageview && !theme.waline.enable && !theme.twikoo.enable
|
16
16
|
script(type = "module" data-pjax).
|
17
|
-
import { pageviewCount } from 'https://unpkg.com/@waline/client/dist/pageview.mjs';
|
17
|
+
import { pageviewCount } from 'https://unpkg.com/@waline/client@2/dist/pageview.mjs';
|
18
18
|
|
19
19
|
const path = document.getElementById("twikoo_visitors").getAttribute("data-path");
|
20
20
|
pageviewCount({
|
@@ -7,7 +7,7 @@ mixin item(name, path, parent, sublist)
|
|
7
7
|
- var menuText = __('menu.' + name).replace('menu.', '')
|
8
8
|
if parent
|
9
9
|
li(class="item dropdown")
|
10
|
-
if itemURL
|
10
|
+
if itemURL === '/'
|
11
11
|
a(href="javascript:void(0);")
|
12
12
|
!= menuIcon + menuText
|
13
13
|
else
|
@@ -18,7 +18,7 @@ mixin item(name, path, parent, sublist)
|
|
18
18
|
- var itemURL = path[0].trim()
|
19
19
|
- if (itemURL==='/') itemURL='javascript:void(0)'
|
20
20
|
- var menuText = __('menu.' + subname).replace('menu.', '')
|
21
|
-
if subname
|
21
|
+
if subname === 'default'
|
22
22
|
- var menuText = __('menu.' + name).replace('menu.', '')
|
23
23
|
else
|
24
24
|
- var menuIcon = '<i class="ic i-' + trimn(path[1]) + '"></i>'
|
@@ -29,9 +29,9 @@ mixin item(name, path, parent, sublist)
|
|
29
29
|
!= _url(itemURL, menuIcon + menuText, {rel: 'section'})
|
30
30
|
|
31
31
|
each value, name in theme.menu
|
32
|
-
if value
|
32
|
+
if value.toString() === '[object Object]'
|
33
33
|
each subvalue, subname in value
|
34
|
-
if subname
|
34
|
+
if subname === 'default'
|
35
35
|
+item(name, subvalue, true, value)
|
36
36
|
else
|
37
37
|
+item(name, value)
|
@@ -30,10 +30,11 @@ nav(class="state")
|
|
30
30
|
!= __('state.tags')
|
31
31
|
|
32
32
|
div(class="social")
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
if theme.social
|
34
|
+
each link, name in theme.social
|
35
|
+
- var sidebarURL = link.split('||')[0].trim()
|
36
|
+
- var sidebarIcon = '<i class="ic i-' + link.split('||')[1].trim() + '"></i>'
|
37
|
+
!= _url(sidebarURL, sidebarIcon, {title: sidebarURL, class: 'item ' + name})
|
37
38
|
|
38
39
|
!= shokax_inject('sidebar')
|
39
40
|
|
@@ -3,6 +3,6 @@ if code
|
|
3
3
|
script.
|
4
4
|
(function(c,l,a,r,i,t,y){
|
5
5
|
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
6
|
-
t=l.createElement(r);t.async=
|
6
|
+
t=l.createElement(r);t.async=true;t.src="https://www.clarity.ms/tag/"+i;
|
7
7
|
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
8
8
|
})(window, document, "clarity", "script", "#{code}");
|
package/layout/archive.pug
CHANGED
@@ -98,7 +98,7 @@ block content
|
|
98
98
|
if post.categories && post.categories.length
|
99
99
|
- var cat_length = post.categories.length
|
100
100
|
each cat,index in post.categories.toArray()
|
101
|
-
if index
|
101
|
+
if index === cat_length && cat.name !== page.category
|
102
102
|
span
|
103
103
|
a(href=url_for(cat.path)) #{cat.name}
|
104
104
|
div(class="title")
|
package/layout/category.pug
CHANGED
@@ -26,25 +26,20 @@ block content
|
|
26
26
|
if post.categories && post.categories.length
|
27
27
|
- var cat_length = post.categories.length
|
28
28
|
each cat,index in post.categories.toArray()
|
29
|
-
if cat.name
|
30
|
-
-
|
31
|
-
-
|
29
|
+
if cat.name === page.title
|
30
|
+
- lastcat = ""
|
31
|
+
- lastcatslug = ""
|
32
32
|
else
|
33
|
-
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if index >= post.categories.toArray().length
|
40
|
-
!= cat.length
|
41
|
-
else
|
42
|
-
#{'/'}
|
43
|
-
- var lastcatslug = lastcatslug + cat.slug
|
33
|
+
- lastcat += `<a href=${url_for(cat.path)}>${cat.name}</a><small>`
|
34
|
+
if index >= post.categories.toArray().length - 1
|
35
|
+
- lastcat = lastcat+' ( '+cat.length+' ) '+`</small>`
|
36
|
+
else
|
37
|
+
- lastcat = lastcat+'/'+`</small>`
|
38
|
+
- lastcatslug = lastcatslug + cat.slug
|
44
39
|
if lastcat && lastcatslug && lastcatslug !== current
|
45
40
|
h3(class="item section")
|
46
|
-
|
47
|
-
-
|
41
|
+
!=lastcat
|
42
|
+
- current = lastcatslug
|
48
43
|
article(class="item normal" itemscope itemtype="http://schema.org/Article")
|
49
44
|
div(class="meta")
|
50
45
|
time(
|
package/layout/index.pug
CHANGED
@@ -5,7 +5,7 @@ include _mixin/segment.pug
|
|
5
5
|
|
6
6
|
block content
|
7
7
|
div(class="index wrap")
|
8
|
-
if page.current
|
8
|
+
if page.current === 1
|
9
9
|
if page.sticky.length > 0
|
10
10
|
h2(class="divider")
|
11
11
|
!= __('index.sticky')
|
@@ -22,7 +22,7 @@ block content
|
|
22
22
|
- var pagePosts = page?.posts?.length
|
23
23
|
if pagePosts > 0
|
24
24
|
- var posts = page.posts.toArray()
|
25
|
-
if page.current
|
25
|
+
if page.current === 1
|
26
26
|
h2(class="divider")
|
27
27
|
!= __('index.posts')
|
28
28
|
div(class="segments posts")
|
package/layout/tag.pug
CHANGED
@@ -27,7 +27,7 @@ block content
|
|
27
27
|
if post.categories && post.categories.length
|
28
28
|
- var cat_length = post.categories.length
|
29
29
|
each cat,index in post.categories.toArray()
|
30
|
-
if index
|
30
|
+
if index === cat_length && cat.name !== page.category
|
31
31
|
span
|
32
32
|
a(href=url_for(cat.path))
|
33
33
|
!= cat.name
|
package/package.json
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.8",
|
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
9
|
"scripts": {
|
10
|
-
"test": "mocha test
|
10
|
+
"test": "mocha test",
|
11
11
|
"build": "pnpm install && tsc"
|
12
12
|
},
|
13
13
|
"devDependencies": {
|
14
|
-
"@types/chai": "^4.3.
|
15
|
-
"@types/fancybox": "^3.5.
|
16
|
-
"@types/hexo": "^3.8.
|
17
|
-
"@types/jquery": "^3.5.
|
18
|
-
"@types/js-yaml": "^4.0.
|
19
|
-
"@types/lozad": "^1.16.
|
20
|
-
"@types/mocha": "^10.0.
|
21
|
-
"@types/node": "^20.
|
22
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
23
|
-
"@typescript-eslint/parser": "^6.
|
24
|
-
"chai": "^4.3.
|
25
|
-
"eslint": "^8.
|
26
|
-
"eslint-config-standard": "
|
14
|
+
"@types/chai": "^4.3.11",
|
15
|
+
"@types/fancybox": "^3.5.6",
|
16
|
+
"@types/hexo": "^3.8.12",
|
17
|
+
"@types/jquery": "^3.5.29",
|
18
|
+
"@types/js-yaml": "^4.0.9",
|
19
|
+
"@types/lozad": "^1.16.4",
|
20
|
+
"@types/mocha": "^10.0.6",
|
21
|
+
"@types/node": "^20.10.0",
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
23
|
+
"@typescript-eslint/parser": "^6.12.0",
|
24
|
+
"chai": "^4.3.10",
|
25
|
+
"eslint": "^8.54.0",
|
26
|
+
"eslint-config-standard": "~17",
|
27
27
|
"eslint-plugin-chai-friendly": "^0.7.2",
|
28
|
-
"eslint-plugin-import": "^2.
|
29
|
-
"eslint-plugin-n": "^16.
|
28
|
+
"eslint-plugin-import": "^2.29.0",
|
29
|
+
"eslint-plugin-n": "^16.3.1",
|
30
30
|
"eslint-plugin-promise": "^6.1.1",
|
31
|
-
"eslint-plugin-vue": "^9.
|
31
|
+
"eslint-plugin-vue": "^9.18.1",
|
32
32
|
"hexo-fs": "^4.1.1",
|
33
33
|
"hexo-util": "^3.1.0",
|
34
|
-
"instantsearch.js": "^4.
|
34
|
+
"instantsearch.js": "^4.60.0",
|
35
35
|
"mocha": "^10.2.0",
|
36
|
-
"typescript": "^5.
|
37
|
-
"vue": "^3.3.
|
38
|
-
"jsdom": "^
|
36
|
+
"typescript": "^5.3.2",
|
37
|
+
"vue": "^3.3.9",
|
38
|
+
"jsdom": "^23.0.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"esbuild": "^0.19.
|
41
|
+
"esbuild": "^0.19.7",
|
42
42
|
"js-yaml": "^4.1.0",
|
43
43
|
"lozad": "^1.16.0",
|
44
44
|
"theme-shokax-anime": "^0.0.4",
|
package/scripts/filters/post.js
CHANGED
@@ -1,13 +1,3 @@
|
|
1
1
|
hexo.extend.filter.register('after_post_render', (data) => {
|
2
|
-
const { config } = hexo;
|
3
2
|
data.content = data.content.replace(/(<img[^>]*) src=/img, '$1 data-src=');
|
4
|
-
const siteHost = new URL(config.url).hostname || config.url;
|
5
|
-
data.content = data.content.replace(/<a[^>]* href="([^"]+)"[^>]*>([^<]*)<\/a>/img, (match, href, html) => {
|
6
|
-
if (!href)
|
7
|
-
return match;
|
8
|
-
const link = new URL(href, config.url);
|
9
|
-
if (!link.protocol || link.hostname === siteHost)
|
10
|
-
return match;
|
11
|
-
return `<span class="exturl" data-url="${Buffer.from(href).toString('base64')}">${html}</span>`;
|
12
|
-
});
|
13
3
|
}, 0);
|
@@ -34,6 +34,12 @@ hexo.extend.filter.register('before_generate', () => {
|
|
34
34
|
hexo.theme.config.image_list = data.images;
|
35
35
|
}
|
36
36
|
else {
|
37
|
-
hexo.theme.config.image_list = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml')));
|
37
|
+
hexo.theme.config.image_list = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml'), { encoding: 'utf-8' }));
|
38
|
+
}
|
39
|
+
if (node_fs_1.default.existsSync(path_1.default.join(__dirname, '../../_images_index.yml'))) {
|
40
|
+
hexo.theme.config.index_images = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images_index.yml'), { encoding: 'utf-8' }));
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
hexo.theme.config.index_images = data.index_images || [];
|
38
44
|
}
|
39
45
|
});
|
@@ -27,7 +27,6 @@ hexo.extend.generator.register('script', function (locals) {
|
|
27
27
|
fancybox: theme.vendors.js.fancybox
|
28
28
|
},
|
29
29
|
css: {
|
30
|
-
valine: theme.css + '/comment.css',
|
31
30
|
katex: theme.vendors.css.katex,
|
32
31
|
mermaid: theme.css + '/mermaid.css',
|
33
32
|
fancybox: theme.vendors.css.fancybox
|
@@ -46,9 +45,9 @@ hexo.extend.generator.register('script', function (locals) {
|
|
46
45
|
disableVL: theme.disableVL,
|
47
46
|
noPlayer: theme.experiments?.noPlayer,
|
48
47
|
audio: undefined,
|
49
|
-
fireworks: (theme.fireworks && theme.fireworks.enable)
|
50
|
-
(theme.fireworks.color || ['rgba(255,182,185,.9)', 'rgba(250,227,217,.9)', 'rgba(187,222,214,.9)', 'rgba(138,198,209,.9)'])
|
51
|
-
undefined
|
48
|
+
fireworks: (theme.fireworks && theme.fireworks.enable)
|
49
|
+
? (theme.fireworks.color || ['rgba(255,182,185,.9)', 'rgba(250,227,217,.9)', 'rgba(187,222,214,.9)', 'rgba(138,198,209,.9)'])
|
50
|
+
: undefined
|
52
51
|
};
|
53
52
|
if (config?.algolia) {
|
54
53
|
siteConfig.search = {
|
@@ -48,43 +48,14 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
|
|
48
48
|
if (!path) {
|
49
49
|
return;
|
50
50
|
}
|
51
|
-
const { config } = this;
|
52
|
-
const data = new URL(path, hexo.config.url);
|
53
|
-
const siteHost = new URL(config.url).hostname || config.url;
|
54
|
-
const theme = hexo.theme.config;
|
55
|
-
let exturl = '';
|
56
51
|
let tag = 'a';
|
57
52
|
let attrs = { href: hexo_util_1.url_for.call(this, path), class: undefined, external: undefined, rel: undefined, 'data-url': undefined };
|
58
|
-
if (theme.exturl && data.protocol && data.hostname !== siteHost) {
|
59
|
-
tag = 'span';
|
60
|
-
exturl = 'exturl';
|
61
|
-
const encoded = Buffer.from(path).toString('base64');
|
62
|
-
attrs = {
|
63
|
-
class: exturl,
|
64
|
-
'data-url': encoded
|
65
|
-
};
|
66
|
-
}
|
67
53
|
for (const key in options) {
|
68
|
-
|
69
|
-
attrs[key] += ' ' + options[key];
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
attrs[key] = options[key];
|
73
|
-
}
|
54
|
+
attrs[key] = options[key];
|
74
55
|
}
|
75
56
|
if (attrs.class && Array.isArray(attrs.class)) {
|
76
57
|
attrs.class = attrs.class.join(' ');
|
77
58
|
}
|
78
|
-
if (data.protocol && data.hostname !== siteHost) {
|
79
|
-
attrs.external = null;
|
80
|
-
if (!theme.exturl) {
|
81
|
-
attrs.rel = 'noopener';
|
82
|
-
attrs.target = '_blank';
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
attrs.rel = null;
|
86
|
-
}
|
87
|
-
}
|
88
59
|
return (0, hexo_util_1.htmlTag)(tag, attrs, decodeURI(text), false);
|
89
60
|
});
|
90
61
|
hexo.extend.helper.register('_image_url', function (img, path = '') {
|
@@ -109,6 +80,18 @@ hexo.extend.helper.register('_cover', function (item, num) {
|
|
109
80
|
return randomBG(num || 1, image_server, image_list);
|
110
81
|
}
|
111
82
|
});
|
83
|
+
hexo.extend.helper.register('_cover_index', function (item) {
|
84
|
+
const { index_images, image_list, image_server } = hexo.theme.config;
|
85
|
+
if (item.cover) {
|
86
|
+
return this._image_url(item.cover, item.path);
|
87
|
+
}
|
88
|
+
else if (item.photos && item.photos.length > 0) {
|
89
|
+
return this._image_url(item.photos[0], item.path);
|
90
|
+
}
|
91
|
+
else {
|
92
|
+
return randomBG(1, image_server, index_images.length === 0 ? image_list : index_images);
|
93
|
+
}
|
94
|
+
});
|
112
95
|
hexo.extend.helper.register('_permapath', function (str) {
|
113
96
|
const { permalink } = hexo.config;
|
114
97
|
let url = str.replace(/index\.html$/, '');
|
package/scripts/tags/links.js
CHANGED
@@ -42,9 +42,9 @@ function linkGrid(args, content) {
|
|
42
42
|
result += `<div class="item" title="${item.owner || item.site}"${item.color}>`;
|
43
43
|
if (urlparam.protocol && urlparam.hostname !== siteHost) {
|
44
44
|
const durl = Buffer.from(item.url).toString('base64');
|
45
|
-
result += `<span class="
|
45
|
+
result += `<span class="image" data-url="${durl}" data-background-image="${item_image}"></span>
|
46
46
|
<div class="info">
|
47
|
-
<span class="
|
47
|
+
<span class="title" data-url="${durl}">${item.site}</span>
|
48
48
|
<p class="desc">${item.desc || item.url}</p>
|
49
49
|
</div></div>`;
|
50
50
|
}
|
@@ -82,7 +82,7 @@ const transition = (target, type, complete, begin) => {
|
|
82
82
|
exports.transition = transition;
|
83
83
|
const pageScroll = (target, offset, complete) => {
|
84
84
|
const opt = {
|
85
|
-
targets: typeof offset === 'number' ? target.parentNode : document.scrollingElement,
|
85
|
+
targets: typeof offset === 'number' && typeof target !== 'number' ? target.parentNode : document.scrollingElement,
|
86
86
|
duration: 500,
|
87
87
|
easing: 'easeInOutQuad',
|
88
88
|
scrollTop: offset || (typeof target === 'number' ? target : (target ? target.getTop() + document.documentElement.scrollTop - globalVars_1.siteNavHeight : 0)),
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const dom_1 = require("../library/dom");
|
4
4
|
const anime_1 = require("../library/anime");
|
5
5
|
const globalVars_1 = require("../globals/globalVars");
|
6
|
-
const loadFile_1 = require("../library/loadFile");
|
7
6
|
function loadComments() {
|
8
7
|
const element = (0, dom_1.$dom)('#comments');
|
9
8
|
if (!element) {
|
@@ -15,7 +14,6 @@ function loadComments() {
|
|
15
14
|
}
|
16
15
|
const io = new IntersectionObserver((entries, observer) => {
|
17
16
|
const entry = entries[0];
|
18
|
-
(0, loadFile_1.vendorCss)('valine');
|
19
17
|
if (entry.isIntersecting || entry.intersectionRatio > 0) {
|
20
18
|
(0, anime_1.transition)((0, dom_1.$dom)('#comments'), 'bounceUpIn');
|
21
19
|
observer.disconnect();
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.cardActive = void 0;
|
4
4
|
const dom_1 = require("../library/dom");
|
5
5
|
const cardActive = () => {
|
6
6
|
if (!(0, dom_1.$dom)('.index.wrap')) {
|
@@ -43,21 +43,3 @@ const cardActive = () => {
|
|
43
43
|
});
|
44
44
|
};
|
45
45
|
exports.cardActive = cardActive;
|
46
|
-
const registerExtURL = () => {
|
47
|
-
dom_1.$dom.each('span.exturl', (element) => {
|
48
|
-
const link = document.createElement('a');
|
49
|
-
link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map((c) => {
|
50
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
51
|
-
}).join(''));
|
52
|
-
link.rel = 'noopener external nofollow noreferrer';
|
53
|
-
link.target = '_blank';
|
54
|
-
link.className = element.className;
|
55
|
-
link.title = element.title || element.innerText;
|
56
|
-
link.innerHTML = element.innerHTML;
|
57
|
-
if (element.dataset.backgroundImage) {
|
58
|
-
link.dataset.backgroundImage = element.dataset.backgroundImage;
|
59
|
-
}
|
60
|
-
element.parentNode.replaceChild(link, element);
|
61
|
-
});
|
62
|
-
};
|
63
|
-
exports.registerExtURL = registerExtURL;
|
@@ -43,7 +43,6 @@ const siteRefresh = (reload) => {
|
|
43
43
|
(0, sidebar_1.menuActive)();
|
44
44
|
(0, sidebar_1.sideBarTab)();
|
45
45
|
(0, sidebar_1.sidebarTOC)();
|
46
|
-
(0, common_1.registerExtURL)();
|
47
46
|
(0, post_1.postBeauty)();
|
48
47
|
(0, tab_1.tabFormat)();
|
49
48
|
if (typeof player_1.mediaPlayer !== 'undefined') {
|