hexo-theme-shokax 0.3.7 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +4 -1
- package/UsageRestrictions.md +1 -1
- package/_config.yml +11 -11
- package/languages/zh-HK.yml +1 -1
- package/layout/_partials/sidebar/overview.pug +5 -4
- package/package.json +10 -9
- package/scripts/filters/post.js +0 -10
- package/scripts/generaters/config.js +2 -2
- package/scripts/generaters/pages.js +5 -4
- package/scripts/helpers/engine.js +6 -32
- package/scripts/helpers/list_categories.js +0 -28
- package/scripts/plugin/check.js +1 -1
- package/scripts/tags/links.js +7 -25
- package/source/js/_app/page/common.js +1 -19
- package/source/js/_app/pjax/refresh.js +0 -1
package/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
# 公告
|
2
|
+
[关于ShokaX markdown扩展特性的讨论](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/177) \
|
3
|
+
[关于删除部分评论系统的讨论](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/175)
|
1
4
|
# hexo-theme-shokaX
|
2
5
|
![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
|
3
6
|
![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
|
@@ -83,4 +86,4 @@ AGPL许可证主要目的是限制修改后的分发行为,避免未经许可
|
|
83
86
|
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
|
84
87
|
|
85
88
|
## 其他信息
|
86
|
-
![Star history chart](https://api.star-history.com/svg?repos=theme-shoka-x/hexo-theme-shokaX&type=Date)
|
89
|
+
![Star history chart](https://api.star-history.com/svg?repos=theme-shoka-x/hexo-theme-shokaX&type=Date)
|
package/UsageRestrictions.md
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
2. ShokaX 项目组不会制作收费版或高级版的项目,ShokaX及其子项目有且只有社区版 (仅为声明)
|
15
15
|
|
16
16
|
## 处理方式
|
17
|
-
如果您违反了上述使用限制和
|
17
|
+
如果您违反了上述使用限制和AGPLv3的任何规定,ShokaX 项目组保留采取以下措施之一或多个的权利:
|
18
18
|
- 发出警告通知并要求立即纠正违规行为;(根据`AGPLv3 八`)
|
19
19
|
- 暂停或终止您对 ShokaX 及其子项目的使用权限并取消GPLv3授予您的权利;(根据`AGPLv3 八`)
|
20
20
|
- 取消您获取 ShokaX 社区支持和进行协作的权利;(社区管理)
|
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"
|
package/languages/zh-HK.yml
CHANGED
@@ -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
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.9",
|
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",
|
@@ -18,27 +18,28 @@
|
|
18
18
|
"@types/js-yaml": "^4.0.9",
|
19
19
|
"@types/lozad": "^1.16.4",
|
20
20
|
"@types/mocha": "^10.0.6",
|
21
|
-
"@types/node": "^20.10.
|
22
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
23
|
-
"@typescript-eslint/parser": "^6.
|
21
|
+
"@types/node": "^20.10.2",
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.13.1",
|
23
|
+
"@typescript-eslint/parser": "^6.13.1",
|
24
24
|
"chai": "^4.3.10",
|
25
|
-
"eslint": "^8.
|
25
|
+
"eslint": "^8.55.0",
|
26
26
|
"eslint-config-standard": "~17",
|
27
27
|
"eslint-plugin-chai-friendly": "^0.7.2",
|
28
28
|
"eslint-plugin-import": "^2.29.0",
|
29
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.19.2",
|
32
32
|
"hexo-fs": "^4.1.1",
|
33
33
|
"hexo-util": "^3.1.0",
|
34
34
|
"instantsearch.js": "^4.60.0",
|
35
|
+
"jsdom": "^23.0.1",
|
35
36
|
"mocha": "^10.2.0",
|
36
37
|
"typescript": "^5.3.2",
|
37
|
-
"vue": "^3.3.9"
|
38
|
-
"jsdom": "^22.1.0"
|
38
|
+
"vue": "^3.3.9"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"esbuild": "^0.19.
|
41
|
+
"esbuild": "^0.19.8",
|
42
|
+
"hexo": "^7.0.0",
|
42
43
|
"js-yaml": "^4.1.0",
|
43
44
|
"lozad": "^1.16.0",
|
44
45
|
"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);
|
@@ -30,7 +30,7 @@ hexo.extend.filter.register('before_generate', () => {
|
|
30
30
|
hexo.theme.config.style[style] = path_1.default.resolve(hexo.base_dir, custom_file);
|
31
31
|
}
|
32
32
|
}
|
33
|
-
if (data.images && data.images.length
|
33
|
+
if (data.images && data.images.length > 0) {
|
34
34
|
hexo.theme.config.image_list = data.images;
|
35
35
|
}
|
36
36
|
else {
|
@@ -40,6 +40,6 @@ hexo.extend.filter.register('before_generate', () => {
|
|
40
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
41
|
}
|
42
42
|
else {
|
43
|
-
hexo.theme.config.index_images = [];
|
43
|
+
hexo.theme.config.index_images = data.index_images || [];
|
44
44
|
}
|
45
45
|
});
|
@@ -1,16 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
hexo.extend.generator.register('pages', function () {
|
3
4
|
const config = hexo.config;
|
4
5
|
return [
|
5
6
|
{
|
6
7
|
path: config.category_dir + '/index.html',
|
7
8
|
data: { type: 'categories' },
|
8
|
-
layout:
|
9
|
+
layout: 'page'
|
9
10
|
},
|
10
11
|
{
|
11
12
|
path: config.tag_dir + '/index.html',
|
12
13
|
data: { type: 'tags' },
|
13
|
-
layout:
|
14
|
+
layout: 'page'
|
14
15
|
}
|
15
16
|
];
|
16
17
|
});
|
@@ -27,8 +27,11 @@ const randomBG = function (count = 1, image_server = null, image_list = []) {
|
|
27
27
|
}
|
28
28
|
};
|
29
29
|
if (count && count > 1) {
|
30
|
-
|
31
|
-
|
30
|
+
let shuffled = image_list.slice(0);
|
31
|
+
while (shuffled.length <= 6) {
|
32
|
+
shuffled = shuffled.concat(image_list.slice(0));
|
33
|
+
}
|
34
|
+
i = shuffled.length;
|
32
35
|
const min = i - count;
|
33
36
|
let temp;
|
34
37
|
let index;
|
@@ -48,43 +51,14 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
|
|
48
51
|
if (!path) {
|
49
52
|
return;
|
50
53
|
}
|
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
54
|
let tag = 'a';
|
57
55
|
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
56
|
for (const key in options) {
|
68
|
-
|
69
|
-
attrs[key] += ' ' + options[key];
|
70
|
-
}
|
71
|
-
else {
|
72
|
-
attrs[key] = options[key];
|
73
|
-
}
|
57
|
+
attrs[key] = options[key];
|
74
58
|
}
|
75
59
|
if (attrs.class && Array.isArray(attrs.class)) {
|
76
60
|
attrs.class = attrs.class.join(' ');
|
77
61
|
}
|
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
62
|
return (0, hexo_util_1.htmlTag)(tag, attrs, decodeURI(text), false);
|
89
63
|
});
|
90
64
|
hexo.extend.helper.register('_image_url', function (img, path = '') {
|
@@ -1,6 +1,4 @@
|
|
1
1
|
'use strict';
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const fs = require("hexo-fs");
|
4
2
|
const prepareQuery = (categories, parent) => {
|
5
3
|
const query = {
|
6
4
|
parent: undefined
|
@@ -47,32 +45,6 @@ hexo.extend.helper.register('_list_categories', function (depth = 0) {
|
|
47
45
|
};
|
48
46
|
return hierarchicalList(0);
|
49
47
|
});
|
50
|
-
hexo.extend.helper.register('_categories', function () {
|
51
|
-
const categories = this.site.categories;
|
52
|
-
if (!categories || !categories.length)
|
53
|
-
return '';
|
54
|
-
const pangu = {
|
55
|
-
spacing: data => {
|
56
|
-
return data;
|
57
|
-
}
|
58
|
-
};
|
59
|
-
const result = {};
|
60
|
-
categories.forEach((cat, i) => {
|
61
|
-
const child = prepareQuery(categories, cat._id);
|
62
|
-
const cover = 'source/_posts' + cat.path.replace(this.config.category_dir, '') + 'cover.jpg';
|
63
|
-
if (fs.existsSync(cover)) {
|
64
|
-
const className = cat.slug.split('/');
|
65
|
-
className.pop();
|
66
|
-
cat.class = className.join(' ');
|
67
|
-
cat.name = pangu.spacing(cat.name);
|
68
|
-
if (child.length !== 0) {
|
69
|
-
cat.child = child;
|
70
|
-
}
|
71
|
-
result[cat._id] = cat;
|
72
|
-
}
|
73
|
-
});
|
74
|
-
return result;
|
75
|
-
});
|
76
48
|
hexo.extend.helper.register('_category_prev', function (name) {
|
77
49
|
const categories = this.site.categories;
|
78
50
|
if (!categories || !categories.length)
|
package/scripts/plugin/check.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
let findProblem = false;
|
2
2
|
hexo.on('generateBefore', function () {
|
3
|
-
if (hexo.config.
|
3
|
+
if (hexo.config.syntax_highlighter) {
|
4
4
|
findProblem = true;
|
5
5
|
hexo.log.error('[SXEC 101] Highlight.js or Prismjs enabled. The code block will render incomplete');
|
6
6
|
}
|
package/scripts/tags/links.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
@@ -14,47 +14,29 @@ function linkGrid(args, content) {
|
|
14
14
|
if (args[0]) {
|
15
15
|
const filepath = node_path_1.default.join(hexo.source_dir, args[0]);
|
16
16
|
if (node_fs_1.default.existsSync(filepath)) {
|
17
|
-
content = node_fs_1.default.readFileSync(filepath);
|
17
|
+
content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
|
18
18
|
}
|
19
19
|
}
|
20
20
|
if (!content) {
|
21
21
|
return;
|
22
22
|
}
|
23
|
-
const siteHost = new URL(hexo.config.url).hostname || hexo.config.url;
|
24
23
|
const list = js_yaml_1.default.load(content);
|
25
24
|
let result = '';
|
26
25
|
list.forEach((item) => {
|
27
26
|
if (!item.url || !item.site) {
|
28
27
|
return;
|
29
28
|
}
|
30
|
-
let urlparam = {
|
31
|
-
protocol: undefined,
|
32
|
-
hostname: undefined
|
33
|
-
};
|
34
|
-
if (item.url) {
|
35
|
-
urlparam = new URL(item.url, hexo.config.url);
|
36
|
-
}
|
37
29
|
let item_image = item.image || theme.assets + '/404.png';
|
38
30
|
if (!item_image.startsWith('//') && !item_image.startsWith('http')) {
|
39
31
|
item_image = theme.statics + item_image;
|
40
32
|
}
|
41
33
|
item.color = item.color ? ` style="--block-color:${item.color};"` : '';
|
42
34
|
result += `<div class="item" title="${item.owner || item.site}"${item.color}>`;
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
<p class="desc">${item.desc || item.url}</p>
|
49
|
-
</div></div>`;
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
result += `<a href="${item.url}" class="image" data-background-image="${item_image}"></a>
|
53
|
-
<div class="info">
|
54
|
-
<a href="${item.url}" class="title">${item.site}</a>
|
55
|
-
<p class="desc">${item.desc || item.url}</p>
|
56
|
-
</div></div>`;
|
57
|
-
}
|
35
|
+
result += `<a href="${item.url}" class="image" data-background-image="${item_image}"></a>
|
36
|
+
<div class="info">
|
37
|
+
<a href="${item.url}" class="title">${item.site}</a>
|
38
|
+
<p class="desc">${item.desc || item.url}</p>
|
39
|
+
</div></div>`;
|
58
40
|
});
|
59
41
|
return `<div class="links">${result}</div>`;
|
60
42
|
}
|
@@ -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') {
|