hexo-theme-shokax 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +30 -0
- package/README.md +6 -3
- package/_config.yml +2 -2
- package/package.json +16 -15
- package/scripts/filters/locals.js +5 -7
- package/scripts/generaters/archive.js +6 -2
- package/scripts/generaters/config.js +13 -9
- package/scripts/generaters/images.js +2 -1
- package/scripts/generaters/index.js +7 -3
- package/scripts/generaters/script.js +8 -3
- package/scripts/helpers/asset.js +16 -11
- package/scripts/helpers/engine.js +6 -5
- package/scripts/helpers/list_categories.js +7 -8
- package/scripts/helpers/symbols_count_time.js +3 -2
- package/scripts/plugin/index.js +11 -6
- package/scripts/plugin/lib/injects-point.js +2 -1
- package/scripts/plugin/lib/injects.js +17 -13
- package/scripts/tags/links.js +11 -7
- package/scripts/tags/media.js +6 -2
- package/source/css/_mixins.styl +1 -1
- package/source/css/app.styl +9 -6
- package/source/js/_app/fireworks.js +14 -14
- package/source/js/_app/library.js +13 -9
- package/source/js/_app/page.js +1 -1
- package/source/js/_app/vue.js +2 -0
package/.eslintrc.cjs
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module.exports = {
|
2
|
+
parser: '@typescript-eslint/parser',
|
3
|
+
env: {
|
4
|
+
browser: true,
|
5
|
+
commonjs: true,
|
6
|
+
es6: true,
|
7
|
+
node: true
|
8
|
+
},
|
9
|
+
extends: [
|
10
|
+
'standard',
|
11
|
+
'plugin:@typescript-eslint/recommended',
|
12
|
+
'plugin:vue/vue3-recommended'
|
13
|
+
],
|
14
|
+
plugins: [
|
15
|
+
'@typescript-eslint',
|
16
|
+
'vue'
|
17
|
+
],
|
18
|
+
parserOptions: {
|
19
|
+
ecmaVersion: 12
|
20
|
+
},
|
21
|
+
rules: {
|
22
|
+
camelcase: 'off',
|
23
|
+
'n/no-callback-literal': 'off',
|
24
|
+
'@typescript-eslint/ban-types': 'off',
|
25
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
26
|
+
'@typescript-eslint/no-var-requires': 'off',
|
27
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
28
|
+
'prefer-const': 'warn'
|
29
|
+
}
|
30
|
+
}
|
package/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
如果你访问的仓库地址是**zkz098/hexo-theme-shokaX**,请转为访问最新地址: [theme-shoka-x/hexo-theme-shokaX](https://github.com/theme-shoka-x/hexo-theme-shokaX)
|
2
|
+
|
1
3
|
# hexo-theme-shokaX
|
2
4
|
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fzkz098%2Fhexo-theme-shokaX?ref=badge_shield)
|
3
|
-
![LICENSE]( https://img.shields.io/github/license/
|
4
|
-
![stars](https://img.shields.io/github/stars/
|
5
|
+
![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
|
6
|
+
![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
|
5
7
|
![version](https://shields.io/npm/v/hexo-theme-shokax)
|
8
|
+
![build](https://img.shields.io/github/actions/workflow/status/theme-shoka-x/hexo-theme-shokaX/build-theme.yml)
|
6
9
|
|
7
10
|
语言(language): 简体中文 | [English](./README_en.md) \
|
8
11
|
此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验 \
|
@@ -73,4 +76,4 @@ GPL许可证主要目的是限制修改后的分发行为,避免未经许可
|
|
73
76
|
[![](https://contributors-img.web.app/image?repo=zkz098/hexo-theme-shokaX)](https://github.com/zkz098/hexo-theme-shokaX/graphs/contributors)
|
74
77
|
|
75
78
|
## 特别鸣谢
|
76
|
-
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
|
79
|
+
[<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
|
package/_config.yml
CHANGED
@@ -344,7 +344,7 @@ advVendors:
|
|
344
344
|
fetch:
|
345
345
|
src: npm:whatwg-fetch@3.4.0/dist/fetch.umd.js
|
346
346
|
anime:
|
347
|
-
src:
|
347
|
+
src: npm:theme-shokax-anime@latest/anime.shokax.min.js
|
348
348
|
algolia:
|
349
349
|
src: bytedance:algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
|
350
350
|
instantsearch:
|
@@ -394,7 +394,7 @@ vendors:
|
|
394
394
|
pace: npm/pace-js@1.0.2/pace.min.js # ok
|
395
395
|
pjax: npm/pjax@0.2.8/pjax.min.js # ok
|
396
396
|
fetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js # ok
|
397
|
-
anime: npm/
|
397
|
+
anime: npm/theme-shokax-anime@latest/anime.shokax.min.js
|
398
398
|
algolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.js # ok
|
399
399
|
instantsearch: npm/instantsearch.js@4/dist/instantsearch.production.min.js # ok
|
400
400
|
lazyload: npm/lozad@1/dist/lozad.min.js # ok
|
package/package.json
CHANGED
@@ -1,47 +1,48 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.4",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
6
|
"repository": "https://github.com/zkz098/hexo-theme-shokaX",
|
7
7
|
"author": "Chou kaitaku",
|
8
8
|
"license": "GPL-3.0-or-later",
|
9
9
|
"scripts": {
|
10
|
-
"test": "
|
10
|
+
"test": "tsc",
|
11
11
|
"build": "pnpm install && tsc",
|
12
12
|
"docs:dev": "vuepress dev docs",
|
13
13
|
"docs:build": "vuepress build docs"
|
14
14
|
},
|
15
15
|
"devDependencies": {
|
16
16
|
"@algolia/client-search": "^4",
|
17
|
-
"@types/animejs": "^3.1.7",
|
18
17
|
"@types/fancybox": "^3.5.3",
|
19
18
|
"@types/hexo": "^3.8.8",
|
20
19
|
"@types/jquery": "^3.5.16",
|
21
20
|
"@types/js-yaml": "^4.0.5",
|
22
21
|
"@types/lozad": "^1.16.1",
|
23
|
-
"@types/node": "^18.15.
|
24
|
-
"@
|
25
|
-
"@typescript-eslint/
|
26
|
-
"@typescript-eslint/parser": "^5.56.0",
|
22
|
+
"@types/node": "^18.15.13",
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
24
|
+
"@typescript-eslint/parser": "^5.59.0",
|
27
25
|
"@vuepress/client": "2.0.0-beta.61",
|
28
26
|
"@vuepress/plugin-docsearch": "2.0.0-beta.61",
|
29
|
-
"algoliasearch": "^4.
|
30
|
-
"eslint": "^8.
|
27
|
+
"algoliasearch": "^4.17.0",
|
28
|
+
"eslint": "^8.39.0",
|
31
29
|
"eslint-config-standard": "^17.0.0",
|
32
30
|
"eslint-plugin-import": "^2.27.5",
|
33
|
-
"eslint-plugin-n": "^15.
|
31
|
+
"eslint-plugin-n": "^15.7.0",
|
34
32
|
"eslint-plugin-promise": "^6.1.1",
|
35
|
-
"eslint-plugin-vue": "^9.
|
36
|
-
"
|
33
|
+
"eslint-plugin-vue": "^9.11.0",
|
34
|
+
"hexo-fs": "^4.1.1",
|
35
|
+
"hexo-util": "^3.0.1",
|
36
|
+
"instantsearch.js": "^4.54.1",
|
37
37
|
"pjax": "^0.2.8",
|
38
|
-
"
|
38
|
+
"theme-shokax-anime": "^0.0.4",
|
39
|
+
"typescript": "^5.0.4",
|
39
40
|
"vue": "^3.2.47",
|
40
41
|
"vuepress": "2.0.0-beta.61",
|
41
|
-
"vuepress-plugin-sitemap2": "2.0.0-beta.
|
42
|
+
"vuepress-plugin-sitemap2": "2.0.0-beta.205"
|
42
43
|
},
|
43
44
|
"dependencies": {
|
44
45
|
"js-yaml": "^4.1.0",
|
45
|
-
"sass": "^1.
|
46
|
+
"sass": "^1.62.0"
|
46
47
|
}
|
47
48
|
}
|
@@ -5,13 +5,11 @@ hexo.extend.filter.register('template_locals', (locals) => {
|
|
5
5
|
const { config } = hexo;
|
6
6
|
const { __, theme } = locals;
|
7
7
|
const { i18n } = hexo.theme;
|
8
|
-
const pangu =
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
};
|
8
|
+
const pangu = {
|
9
|
+
spacing: (data) => {
|
10
|
+
return data;
|
11
|
+
}
|
12
|
+
};
|
15
13
|
locals.alternate = theme.alternate;
|
16
14
|
locals.title = pangu.spacing(__('title') !== 'title' ? __('title') : config.title);
|
17
15
|
locals.subtitle = pangu.spacing(__('subtitle') !== 'subtitle' ? __('subtitle') : config.subtitle);
|
@@ -1,5 +1,9 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
|
3
7
|
const fmtNum = num => {
|
4
8
|
return num < 10 ? '0' + num : num;
|
5
9
|
};
|
@@ -34,7 +38,7 @@ if (!(hexo.config.archive && hexo.config.archive.enabled === false)) {
|
|
34
38
|
function generate(path, posts, options) {
|
35
39
|
options = options || {};
|
36
40
|
options.archive = true;
|
37
|
-
result = result.concat(
|
41
|
+
result = result.concat((0, hexo_pagination_1.default)(path, posts, {
|
38
42
|
perPage: path === archiveDir ? 0 : perPage,
|
39
43
|
layout: ['archive', 'index'],
|
40
44
|
format: paginationDir + '/%d/',
|
@@ -1,18 +1,22 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const hexo_util_1 = __importDefault(require("hexo-util"));
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
8
|
+
const path_1 = __importDefault(require("path"));
|
9
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
6
10
|
hexo.extend.filter.register('before_generate', () => {
|
7
11
|
if (hexo.config.theme_config) {
|
8
|
-
hexo.theme.config =
|
12
|
+
hexo.theme.config = hexo_util_1.default.deepMerge(hexo.theme.config, hexo.config.theme_config);
|
9
13
|
}
|
10
14
|
const data = hexo.locals.get('data');
|
11
15
|
if (data.languages) {
|
12
16
|
const { i18n } = hexo.theme;
|
13
17
|
const mergeLang = lang => {
|
14
18
|
if (data.languages[lang]) {
|
15
|
-
i18n.set(lang,
|
19
|
+
i18n.set(lang, hexo_util_1.default.deepMerge(i18n.get([lang]), data.languages[lang]));
|
16
20
|
}
|
17
21
|
};
|
18
22
|
for (const lang of ['en', 'ja', 'zh-CN', 'zh-HK', 'zh-TW']) {
|
@@ -22,14 +26,14 @@ hexo.extend.filter.register('before_generate', () => {
|
|
22
26
|
hexo.theme.config.style = {};
|
23
27
|
for (const style of ['iconfont', 'colors', 'custom']) {
|
24
28
|
const custom_file = 'source/_data/' + style + '.styl';
|
25
|
-
if (
|
26
|
-
hexo.theme.config.style[style] =
|
29
|
+
if (node_fs_1.default.existsSync(custom_file)) {
|
30
|
+
hexo.theme.config.style[style] = path_1.default.resolve(hexo.base_dir, custom_file);
|
27
31
|
}
|
28
32
|
}
|
29
33
|
if (data.images && data.images.length >= 6) {
|
30
34
|
hexo.theme.config.image_list = data.images;
|
31
35
|
}
|
32
36
|
else {
|
33
|
-
hexo.theme.config.image_list =
|
37
|
+
hexo.theme.config.image_list = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml')));
|
34
38
|
}
|
35
39
|
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const fs = require("hexo-fs");
|
3
4
|
hexo.extend.generator.register('images', function (locals) {
|
4
5
|
const theme = hexo.theme.config;
|
5
6
|
const dir = 'source/_data/' + theme.assets + '/';
|
@@ -1,6 +1,10 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
3
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const fs = require("hexo-fs");
|
7
|
+
const hexo_pagination_1 = __importDefault(require("hexo-pagination"));
|
4
8
|
hexo.config.index_generator = Object.assign({
|
5
9
|
per_page: typeof hexo.config.per_page === 'undefined' ? 10 : hexo.config.per_page,
|
6
10
|
order_by: '-date'
|
@@ -74,7 +78,7 @@ hexo.extend.generator.register('index', function (locals) {
|
|
74
78
|
});
|
75
79
|
}
|
76
80
|
if (posts.length > 0) {
|
77
|
-
pages =
|
81
|
+
pages = (0, hexo_pagination_1.default)(path, posts, {
|
78
82
|
perPage: config.index_generator.per_page,
|
79
83
|
layout: ['index', 'archive'],
|
80
84
|
format: paginationDir + '/%d/',
|
@@ -1,11 +1,16 @@
|
|
1
|
-
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
7
|
+
const fs = require("hexo-fs");
|
2
8
|
hexo.extend.generator.register('script', function (locals) {
|
3
9
|
const log = hexo.log || console.log;
|
4
10
|
const config = hexo.config;
|
5
11
|
const theme = hexo.theme.config;
|
6
|
-
const env = require('../../package.json');
|
7
12
|
const siteConfig = {
|
8
|
-
version:
|
13
|
+
version: package_json_1.default.version,
|
9
14
|
hostname: config.url,
|
10
15
|
root: config.root,
|
11
16
|
statics: theme.statics,
|
package/scripts/helpers/asset.js
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
7
|
+
const hexo_util_1 = require("hexo-util");
|
3
8
|
hexo.extend.helper.register('_new_comments', function (mode) {
|
4
9
|
if (mode === 'twikoo') {
|
5
10
|
return `<script data-pjax type="module">
|
@@ -56,7 +61,7 @@ hexo.extend.helper.register('hexo_env', function (type) {
|
|
56
61
|
return this.env[type];
|
57
62
|
});
|
58
63
|
hexo.extend.helper.register('theme_env', function (type) {
|
59
|
-
return
|
64
|
+
return package_json_1.default[type];
|
60
65
|
});
|
61
66
|
hexo.extend.helper.register('_vendor_font', () => {
|
62
67
|
const config = hexo.theme.config.font;
|
@@ -76,7 +81,7 @@ hexo.extend.helper.register('_vendor_font', () => {
|
|
76
81
|
fontFamilies = [...new Set(fontFamilies)];
|
77
82
|
fontFamilies = fontFamilies.join('|');
|
78
83
|
return fontFamilies
|
79
|
-
? htmlTag('link', {
|
84
|
+
? (0, hexo_util_1.htmlTag)('link', {
|
80
85
|
rel: 'stylesheet',
|
81
86
|
href: `${fontHost}/css?family=${fontFamilies.concat(fontDisplay, fontSubset)}`
|
82
87
|
})
|
@@ -95,18 +100,18 @@ hexo.extend.helper.register('_vendor_js', () => {
|
|
95
100
|
vendorJs = vendorJs.filter(item => item !== '');
|
96
101
|
vendorJs = [...new Set(vendorJs)];
|
97
102
|
vendorJs = vendorJs.join(',');
|
98
|
-
return vendorJs ? htmlTag('script', { src: `https://cdn.jsdelivr.net/combine/${vendorJs}` }, '') : '';
|
103
|
+
return vendorJs ? (0, hexo_util_1.htmlTag)('script', { src: `https://cdn.jsdelivr.net/combine/${vendorJs}` }, '') : '';
|
99
104
|
});
|
100
105
|
hexo.extend.helper.register('_css', function (...urls) {
|
101
106
|
const { statics, css } = hexo.theme.config;
|
102
|
-
return urls.map(url => htmlTag('link', {
|
107
|
+
return urls.map(url => (0, hexo_util_1.htmlTag)('link', {
|
103
108
|
rel: 'stylesheet',
|
104
|
-
href: url_for.call(this, `${statics}${css}/${url}?v=${
|
109
|
+
href: hexo_util_1.url_for.call(this, `${statics}${css}/${url}?v=${package_json_1.default.version}`)
|
105
110
|
})).join('');
|
106
111
|
});
|
107
112
|
hexo.extend.helper.register('_js', function (...urls) {
|
108
113
|
const { statics, js } = hexo.theme.config;
|
109
|
-
return urls.map(url => htmlTag('script', { src: url_for.call(this, `${statics}${js}/${url}?v=${
|
114
|
+
return urls.map(url => (0, hexo_util_1.htmlTag)('script', { src: hexo_util_1.url_for.call(this, `${statics}${js}/${url}?v=${package_json_1.default.version}`) }, '')).join('');
|
110
115
|
});
|
111
116
|
hexo.extend.helper.register('_list_vendor_js', () => {
|
112
117
|
return hexo.theme.config.vendorsList.js;
|
@@ -158,14 +163,14 @@ hexo.extend.helper.register('_adv_vendor_js', function (js_name) {
|
|
158
163
|
if (config['hash-value'])
|
159
164
|
attr.integrity = config['hash-value'];
|
160
165
|
if (config.deferLoad) {
|
161
|
-
return htmlTag('script', { 'data-pjax': true }, `
|
166
|
+
return (0, hexo_util_1.htmlTag)('script', { 'data-pjax': true }, `
|
162
167
|
const script=document.createElement("script");script.src="${result}",script.async=true,document.body.appendChild(script)
|
163
168
|
`);
|
164
169
|
}
|
165
|
-
return htmlTag('script', attr, '');
|
170
|
+
return (0, hexo_util_1.htmlTag)('script', attr, '');
|
166
171
|
});
|
167
172
|
hexo.extend.helper.register('_striptags', function (data) {
|
168
|
-
return stripHTML(data);
|
173
|
+
return (0, hexo_util_1.stripHTML)(data);
|
169
174
|
});
|
170
175
|
hexo.extend.helper.register('_truncate', function (data, end) {
|
171
176
|
return data.substring(0, end);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const hexo_util_1 = require("hexo-util");
|
3
4
|
const randomServer = parseInt(String(Math.random() * 4), 10) + 1;
|
4
5
|
const randomBG = function (count = 1, image_server = null, image_list = []) {
|
5
6
|
let i;
|
@@ -53,7 +54,7 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
|
|
53
54
|
const theme = hexo.theme.config;
|
54
55
|
let exturl = '';
|
55
56
|
let tag = 'a';
|
56
|
-
let attrs = { href: url_for.call(this, path), class: undefined, external: undefined, rel: undefined, 'data-url': undefined };
|
57
|
+
let attrs = { href: hexo_util_1.url_for.call(this, path), class: undefined, external: undefined, rel: undefined, 'data-url': undefined };
|
57
58
|
if (theme.exturl && data.protocol && data.hostname !== siteHost) {
|
58
59
|
tag = 'span';
|
59
60
|
exturl = 'exturl';
|
@@ -84,7 +85,7 @@ hexo.extend.helper.register('_url', function (path, text, options = {}) {
|
|
84
85
|
attrs.rel = null;
|
85
86
|
}
|
86
87
|
}
|
87
|
-
return htmlTag(tag, attrs, decodeURI(text), false);
|
88
|
+
return (0, hexo_util_1.htmlTag)(tag, attrs, decodeURI(text), false);
|
88
89
|
});
|
89
90
|
hexo.extend.helper.register('_image_url', function (img, path = '') {
|
90
91
|
const { statics } = hexo.theme.config;
|
@@ -93,7 +94,7 @@ hexo.extend.helper.register('_image_url', function (img, path = '') {
|
|
93
94
|
return img;
|
94
95
|
}
|
95
96
|
else {
|
96
|
-
return url_for.call(this, statics + (post_asset_folder ? path : '') + img);
|
97
|
+
return hexo_util_1.url_for.call(this, statics + (post_asset_folder ? path : '') + img);
|
97
98
|
}
|
98
99
|
});
|
99
100
|
hexo.extend.helper.register('_cover', function (item, num) {
|
@@ -122,7 +123,7 @@ hexo.extend.helper.register('canonical', function () {
|
|
122
123
|
hexo.extend.helper.register('i18n_path', function (language) {
|
123
124
|
const { path, lang } = this.page;
|
124
125
|
const base = path.startsWith(lang) ? path.slice(lang.length + 1) : path;
|
125
|
-
return url_for.call(this, `${this.languages.indexOf(language) === 0 ? '' : '/' + language}/${base}`);
|
126
|
+
return hexo_util_1.url_for.call(this, `${this.languages.indexOf(language) === 0 ? '' : '/' + language}/${base}`);
|
126
127
|
});
|
127
128
|
hexo.extend.helper.register('language_name', function (language) {
|
128
129
|
const name = hexo.theme.i18n.__(language)('name');
|
@@ -1,5 +1,6 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const fs = require("hexo-fs");
|
3
4
|
const prepareQuery = (categories, parent) => {
|
4
5
|
const query = {
|
5
6
|
parent: undefined
|
@@ -50,13 +51,11 @@ hexo.extend.helper.register('_categories', function () {
|
|
50
51
|
const categories = this.site.categories;
|
51
52
|
if (!categories || !categories.length)
|
52
53
|
return '';
|
53
|
-
const pangu =
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
};
|
54
|
+
const pangu = {
|
55
|
+
spacing: data => {
|
56
|
+
return data;
|
57
|
+
}
|
58
|
+
};
|
60
59
|
const result = {};
|
61
60
|
categories.forEach((cat, i) => {
|
62
61
|
const child = prepareQuery(categories, cat._id);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const hexo_util_1 = require("hexo-util");
|
3
4
|
const config = hexo.config.symbols_count_time = Object.assign({
|
4
5
|
symbols: true,
|
5
6
|
time: true,
|
@@ -58,5 +59,5 @@ hexo.extend.filter.register('after_post_render', (data) => {
|
|
58
59
|
let { content } = data;
|
59
60
|
if (config.exclude_codeblock)
|
60
61
|
content = content.replace(/<pre>.*?<\/pre>/g, '');
|
61
|
-
data.length = stripHTML(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
|
62
|
+
data.length = (0, hexo_util_1.stripHTML)(content).replace(/\r?\n|\r/g, '').replace(/\s+/g, '').length;
|
62
63
|
}, 0);
|
package/scripts/plugin/index.js
CHANGED
@@ -1,11 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const injects_1 = __importDefault(require("./lib/injects"));
|
7
|
+
const node_https_1 = __importDefault(require("node:https"));
|
8
|
+
const package_json_1 = require("../../package.json");
|
1
9
|
hexo.on('generateBefore', () => {
|
2
|
-
|
10
|
+
(0, injects_1.default)(hexo);
|
3
11
|
});
|
4
12
|
hexo.on('generateAfter', () => {
|
5
|
-
|
6
|
-
const path = require('path');
|
7
|
-
const { version } = require(path.normalize('../../package.json'));
|
8
|
-
https.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
|
13
|
+
node_https_1.default.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
|
9
14
|
headers: {
|
10
15
|
'User-Agent': 'Theme ShokaX Client'
|
11
16
|
}
|
@@ -17,7 +22,7 @@ hexo.on('generateAfter', () => {
|
|
17
22
|
res.on('end', () => {
|
18
23
|
try {
|
19
24
|
const latest = JSON.parse(result).tag_name.replace('v', '').split('.');
|
20
|
-
const current = version.split('.');
|
25
|
+
const current = package_json_1.version.split('.');
|
21
26
|
let isOutdated = false;
|
22
27
|
for (let i = 0; i < Math.max(latest.length, current.length); i++) {
|
23
28
|
if (!current[i] || latest[i] > current[i]) {
|
@@ -1,7 +1,11 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
8
|
+
const injects_point_1 = __importDefault(require("./injects-point"));
|
5
9
|
const defaultExtname = '.pug';
|
6
10
|
class StylusInject {
|
7
11
|
constructor(base_dir) {
|
@@ -9,7 +13,7 @@ class StylusInject {
|
|
9
13
|
this.files = [];
|
10
14
|
}
|
11
15
|
push(file) {
|
12
|
-
this.files.push(
|
16
|
+
this.files.push(node_path_1.default.resolve(this.base_dir, file));
|
13
17
|
}
|
14
18
|
}
|
15
19
|
class ViewInject {
|
@@ -18,36 +22,36 @@ class ViewInject {
|
|
18
22
|
this.raws = [];
|
19
23
|
}
|
20
24
|
raw(name, raw, ...args) {
|
21
|
-
if (
|
25
|
+
if (node_path_1.default.extname(name) === '') {
|
22
26
|
name += defaultExtname;
|
23
27
|
}
|
24
28
|
this.raws.push({ name, raw, args });
|
25
29
|
}
|
26
30
|
file(name, file, ...args) {
|
27
|
-
if (
|
28
|
-
name +=
|
31
|
+
if (node_path_1.default.extname(name) === '') {
|
32
|
+
name += node_path_1.default.extname(file);
|
29
33
|
}
|
30
|
-
this.raw(name,
|
34
|
+
this.raw(name, node_fs_1.default.readFileSync(node_path_1.default.resolve(this.base_dir, file), 'utf8'), ...args);
|
31
35
|
}
|
32
36
|
}
|
33
37
|
function initInject(base_dir) {
|
34
38
|
const injects = {};
|
35
|
-
|
39
|
+
injects_point_1.default.styles.forEach(item => {
|
36
40
|
injects[item] = new StylusInject(base_dir);
|
37
41
|
});
|
38
|
-
|
42
|
+
injects_point_1.default.views.forEach(item => {
|
39
43
|
injects[item] = new ViewInject(base_dir);
|
40
44
|
});
|
41
45
|
return injects;
|
42
46
|
}
|
43
|
-
|
47
|
+
exports.default = (hexo) => {
|
44
48
|
const injects = initInject(hexo.base_dir);
|
45
49
|
hexo.execFilterSync('theme_inject', injects);
|
46
50
|
hexo.theme.config.injects = {};
|
47
|
-
|
51
|
+
injects_point_1.default.styles.forEach(type => {
|
48
52
|
hexo.theme.config.injects[type] = injects[type].files;
|
49
53
|
});
|
50
|
-
|
54
|
+
injects_point_1.default.views.forEach(type => {
|
51
55
|
const configs = Object.create(null);
|
52
56
|
hexo.theme.config.injects[type] = [];
|
53
57
|
injects[type].raws.forEach((injectObj, index) => {
|
package/scripts/tags/links.js
CHANGED
@@ -1,23 +1,27 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
5
9
|
function linkGrid(args, content) {
|
6
10
|
const theme = hexo.theme.config;
|
7
11
|
if (!args[0] && !content) {
|
8
12
|
return;
|
9
13
|
}
|
10
14
|
if (args[0]) {
|
11
|
-
const filepath =
|
12
|
-
if (
|
13
|
-
content =
|
15
|
+
const filepath = node_path_1.default.join(hexo.source_dir, args[0]);
|
16
|
+
if (node_fs_1.default.existsSync(filepath)) {
|
17
|
+
content = node_fs_1.default.readFileSync(filepath);
|
14
18
|
}
|
15
19
|
}
|
16
20
|
if (!content) {
|
17
21
|
return;
|
18
22
|
}
|
19
23
|
const siteHost = new URL(hexo.config.url).hostname || hexo.config.url;
|
20
|
-
const list =
|
24
|
+
const list = js_yaml_1.default.load(content);
|
21
25
|
let result = '';
|
22
26
|
list.forEach((item) => {
|
23
27
|
if (!item.url || !item.site) {
|
package/scripts/tags/media.js
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
'use strict';
|
2
|
-
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
3
7
|
function postMedia(args, content) {
|
4
8
|
if (!args[0] || !content) {
|
5
9
|
return;
|
6
10
|
}
|
7
|
-
const list =
|
11
|
+
const list = js_yaml_1.default.load(content);
|
8
12
|
switch (args[0]) {
|
9
13
|
case 'video':
|
10
14
|
case 'audio':
|
package/source/css/_mixins.styl
CHANGED
package/source/css/app.styl
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
@import "_variables";
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
if hexo-config('injects.variable')
|
4
|
+
for $inject_variable in hexo-config('injects.variable')
|
5
|
+
@import $inject_variable
|
5
6
|
|
6
7
|
@import "_mixins";
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
if hexo-config('injects.mixin')
|
10
|
+
for $inject_mixin in hexo-config('injects.mixin')
|
11
|
+
@import $inject_mixin;
|
10
12
|
|
11
13
|
if $colors = hexo-config('style.colors')
|
12
14
|
@import $colors;
|
@@ -30,8 +32,9 @@ else
|
|
30
32
|
if $custom = hexo-config('style.custom')
|
31
33
|
@import $custom;
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
+
if hexo-config('injects.style')
|
36
|
+
for $inject_style in hexo-config('injects.style')
|
37
|
+
@import $inject_style;
|
35
38
|
|
36
39
|
if $optimize = hexo-config('experiments.optimizeLongPosts')
|
37
40
|
@import "optimize.styl"
|
@@ -77,9 +77,9 @@ function createCircle(x, y) {
|
|
77
77
|
};
|
78
78
|
return p;
|
79
79
|
}
|
80
|
-
function renderParticule(
|
81
|
-
for (
|
82
|
-
|
80
|
+
function renderParticule(targets) {
|
81
|
+
for (const target of targets) {
|
82
|
+
target.draw();
|
83
83
|
}
|
84
84
|
}
|
85
85
|
function animateParticules(x, y) {
|
@@ -88,31 +88,31 @@ function animateParticules(x, y) {
|
|
88
88
|
for (let i = 0; i < numberOfParticules; i++) {
|
89
89
|
particules.push(createParticule(x, y));
|
90
90
|
}
|
91
|
-
anime.timeline().add({
|
91
|
+
anime().timeline().add({
|
92
92
|
targets: particules,
|
93
|
+
duration: anime.random(1200, 1800),
|
94
|
+
easing: 'easeOutExpo',
|
95
|
+
update: renderParticule,
|
93
96
|
x: function (p) {
|
94
97
|
return p.endPos.x;
|
95
98
|
},
|
96
99
|
y: function (p) {
|
97
100
|
return p.endPos.y;
|
98
101
|
},
|
99
|
-
radius: 0.1
|
100
|
-
duration: anime.random(1200, 1800),
|
101
|
-
easing: 'easeOutExpo',
|
102
|
-
update: renderParticule
|
102
|
+
radius: 0.1
|
103
103
|
}).add({
|
104
104
|
targets: circle,
|
105
|
+
duration: anime.random(1200, 1800),
|
106
|
+
easing: 'easeOutExpo',
|
107
|
+
update: renderParticule,
|
105
108
|
radius: anime.random(80, 160),
|
106
109
|
lineWidth: 0,
|
107
110
|
alpha: {
|
108
111
|
value: 0,
|
109
112
|
easing: 'linear',
|
110
113
|
duration: anime.random(600, 800)
|
111
|
-
}
|
112
|
-
|
113
|
-
easing: 'easeOutExpo',
|
114
|
-
update: renderParticule
|
115
|
-
}, 0);
|
114
|
+
}
|
115
|
+
}).play();
|
116
116
|
}
|
117
117
|
const render = anime({
|
118
118
|
duration: Infinity,
|
@@ -127,7 +127,7 @@ const hasAncestor = function (node, name) {
|
|
127
127
|
break;
|
128
128
|
if (node.nodeName === name)
|
129
129
|
return true;
|
130
|
-
} while (node = node.parentNode);
|
130
|
+
} while ((node = node.parentNode) !== null);
|
131
131
|
return false;
|
132
132
|
};
|
133
133
|
document.addEventListener(tap, function (e) {
|
@@ -192,7 +192,7 @@ const vendorCss = function (type, condition) {
|
|
192
192
|
window['css' + type] = true;
|
193
193
|
}
|
194
194
|
};
|
195
|
-
const transition = (target, type, complete) => {
|
195
|
+
const transition = (target, type, complete, begin) => {
|
196
196
|
let animation;
|
197
197
|
let display = 'none';
|
198
198
|
switch (type) {
|
@@ -236,14 +236,14 @@ const transition = (target, type, complete) => {
|
|
236
236
|
begin: function (anim) {
|
237
237
|
target.display('block');
|
238
238
|
},
|
239
|
-
translateX: [100, 0],
|
239
|
+
translateX: ['100%', '0%'],
|
240
240
|
opacity: [0, 1]
|
241
241
|
};
|
242
242
|
display = 'block';
|
243
243
|
break;
|
244
244
|
case 'slideRightOut':
|
245
245
|
animation = {
|
246
|
-
translateX: [0, 100],
|
246
|
+
translateX: ['0%', '100%'],
|
247
247
|
opacity: [1, 0]
|
248
248
|
};
|
249
249
|
break;
|
@@ -255,11 +255,15 @@ const transition = (target, type, complete) => {
|
|
255
255
|
anime(Object.assign({
|
256
256
|
targets: target,
|
257
257
|
duration: 200,
|
258
|
-
easing: 'linear'
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
258
|
+
easing: 'linear',
|
259
|
+
begin: function () {
|
260
|
+
begin && begin();
|
261
|
+
},
|
262
|
+
complete: function () {
|
263
|
+
target.display(display);
|
264
|
+
complete && complete();
|
265
|
+
}
|
266
|
+
}, animation)).play();
|
263
267
|
};
|
264
268
|
const pjaxScript = function (element) {
|
265
269
|
const { text, parentNode, id, className, type, src, dataset } = element;
|
@@ -297,5 +301,5 @@ const pageScroll = function (target, offset, complete) {
|
|
297
301
|
complete && complete();
|
298
302
|
}
|
299
303
|
};
|
300
|
-
anime(opt);
|
304
|
+
anime(opt).play();
|
301
305
|
};
|
package/source/js/_app/page.js
CHANGED
@@ -616,7 +616,7 @@ const domInit = function () {
|
|
616
616
|
const pjaxReload = function () {
|
617
617
|
pagePosition();
|
618
618
|
if (sideBar.hasClass('on')) {
|
619
|
-
transition(sideBar, function () {
|
619
|
+
transition(sideBar, 0, function () {
|
620
620
|
sideBar.removeClass('on');
|
621
621
|
menuToggle.removeClass('close');
|
622
622
|
});
|