hexo-theme-shokax 0.2.5-beta1 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- package/_config.yml +3 -2
- package/languages/en.yml +9 -9
- package/languages/zh-HK.yml +7 -0
- package/languages/zh-TW.yml +7 -0
- package/layout/_partials/head/head.pug +1 -1
- package/layout/_partials/layout.pug +41 -59
- package/layout/_partials/post/footer.pug +1 -1
- package/package.json +5 -5
- package/scripts/generaters/config.js +3 -3
- package/scripts/helpers/summary_ai.js +12 -4
- package/scripts/plugin/index.js +7 -0
- package/source/js/_app/library.js +12 -0
- package/source/js/_app/page.js +18 -28
- package/source/js/_app/player.js +6 -6
package/_config.yml
CHANGED
@@ -202,6 +202,7 @@ summary:
|
|
202
202
|
enable: false
|
203
203
|
introduce: "我是基于ChatGPT-turbo-3.5实现的AI助手,在此网站上负责整理和概括文章" # AI自我介绍
|
204
204
|
mode: openai # openai/custom
|
205
|
+
pricing: "trial" # trial为试用模板(3 RPM);pay为即用即付模板(60 RPM)
|
205
206
|
openai:
|
206
207
|
remote: "https://api.openai.com"
|
207
208
|
apikey: "key"
|
@@ -351,7 +352,7 @@ advVendors:
|
|
351
352
|
pace:
|
352
353
|
src: bytedance:pace/1.0.2/pace.min.js
|
353
354
|
pjax:
|
354
|
-
src:
|
355
|
+
src: npm:theme-shokax-pjax@latest/pjax.shokax.min.js
|
355
356
|
fetch:
|
356
357
|
src: npm:whatwg-fetch@3.4.0/dist/fetch.umd.js
|
357
358
|
anime:
|
@@ -403,7 +404,7 @@ vendors:
|
|
403
404
|
|
404
405
|
js:
|
405
406
|
pace: npm/pace-js@1.0.2/pace.min.js # ok
|
406
|
-
pjax: npm/pjax@
|
407
|
+
pjax: npm/theme-shokax-pjax@latest/pjax.shokax.min.js # ok
|
407
408
|
fetch: npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js # ok
|
408
409
|
anime: npm/theme-shokax-anime@latest/anime.shokax.min.js
|
409
410
|
algolia: npm/algoliasearch@4/dist/algoliasearch-lite.umd.js # ok
|
package/languages/en.yml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
name: English
|
2
2
|
|
3
3
|
favicon:
|
4
|
-
show:
|
5
|
-
hide: (´Д`)
|
4
|
+
show: (●´3`●) Here we go again.
|
5
|
+
hide: (´Д`) It's a disaster!
|
6
6
|
|
7
7
|
title:
|
8
8
|
archive: Archive
|
9
9
|
category: Category
|
10
10
|
tag: Tag
|
11
11
|
all: All
|
12
|
-
not_found: Σ( ° △ °|||)︴404!
|
12
|
+
not_found: Σ( ° △ °|||)︴404! Nothing can be seen
|
13
13
|
category_in: Posted in category "%s"
|
14
14
|
tag_in: Posted with tag "%s"
|
15
15
|
archive_in: Posted on "%s"
|
@@ -22,13 +22,13 @@ menu:
|
|
22
22
|
tags: Tags
|
23
23
|
about: About
|
24
24
|
search: Search
|
25
|
-
|
26
|
-
|
27
|
-
updata:
|
28
|
-
statistics:
|
29
|
-
admiration: Appreciation
|
25
|
+
census: Blog Visits Statistics
|
26
|
+
aboutsite: About This Site
|
27
|
+
updata: Update Log
|
28
|
+
statistics: Statistics
|
29
|
+
admiration: Appreciation
|
30
30
|
friends: Friends
|
31
|
-
privacy: Privacy
|
31
|
+
privacy: Privacy Policy
|
32
32
|
|
33
33
|
sidebar:
|
34
34
|
overview: Overview
|
package/languages/zh-HK.yml
CHANGED
package/languages/zh-TW.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
- var yandexValid = theme?.seo?.yandex,baiduValid = theme?.seo?.baidu
|
3
3
|
- var siteTitle = config.title,noBaiduT = theme?.seo?.disable_baidu_transformation
|
4
4
|
- var feedLink = full_url_for("/feed.json")
|
5
|
-
- var tk= theme?.twikoo?.enable
|
5
|
+
- var tk= theme?.twikoo?.enable
|
6
6
|
- var wl = theme.waline.enable,gt=theme?.gitalk?.enable
|
7
7
|
meta(charset="UTF-8")
|
8
8
|
meta(name="viewport" content="width=device-width,initial-scale=1,maximum-scale=2")
|
@@ -2,6 +2,10 @@ include ../_mixin/breadcrumb.pug
|
|
2
2
|
include ../_mixin/sidebar.pug
|
3
3
|
include ../_mixin/widgets.pug
|
4
4
|
|
5
|
+
- var ignores = []
|
6
|
+
if (theme.quicklink.ignores)
|
7
|
+
- ignores.push(theme.quicklink.ignores)
|
8
|
+
|
5
9
|
doctype html
|
6
10
|
html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'filter: grayscale(1);':'' )
|
7
11
|
head
|
@@ -67,65 +71,43 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
|
|
67
71
|
!= partial('_partials/footer.pug', {}, {cache: true})
|
68
72
|
- var ccIcon = '<i class="ic i-creative-commons"></i>'
|
69
73
|
- var ccText = theme.creative_commons.license.toUpperCase()
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
if page.quiz
|
108
|
-
| quiz: {
|
109
|
-
!= `choice: \'${__('quiz.choice')}\',`
|
110
|
-
!= `multiple: \'${__('quiz.multiple')}\',`
|
111
|
-
!= `true_false: \'${__('quiz.true_false')}\',`
|
112
|
-
!= `essay: \'${__('quiz.essay')}\',`
|
113
|
-
!= `gap_fill: \'${__('quiz.gap_fill')}\',`
|
114
|
-
!= `mistake: \'${__('quiz.mistake')}\'`
|
115
|
-
| },
|
116
|
-
| ignores : [
|
117
|
-
| function(uri) {
|
118
|
-
| return uri.includes('#');
|
119
|
-
| },
|
120
|
-
| function(uri) {
|
121
|
-
| return new RegExp(LOCAL.path+"$").test(uri);
|
122
|
-
| }
|
123
|
-
if theme.quicklink.ignores
|
124
|
-
| ,
|
125
|
-
!= _safedump(theme.quicklink.ignores)
|
126
|
-
| ]
|
127
|
-
| };
|
128
|
-
</script>
|
74
|
+
script(data-config type="text/javascript").
|
75
|
+
var LOCAL = {
|
76
|
+
path: `#{_permapath(page.path)}`,
|
77
|
+
favicon: {
|
78
|
+
show: `#{__('favicon.show')}`,
|
79
|
+
hide: `#{__('favicon.hide')}`
|
80
|
+
},
|
81
|
+
search: {
|
82
|
+
placeholder: "!{__('search.placeholder')}",
|
83
|
+
empty: "!{__('search.empty')}",
|
84
|
+
stats: "!{__('search.stats')}"
|
85
|
+
},
|
86
|
+
valine: `#{page.valine ? _safedump(page.valine) : 'true'}`,
|
87
|
+
chart: `#{page.chart ? 'true' : 'false'}`,
|
88
|
+
copy_tex: `#{page.math ? 'true' : 'false'}`,
|
89
|
+
katex: `#{page.math ? 'true' : 'false'}`,
|
90
|
+
mermaid: `#{page.mermaid ? 'true' : 'false'}`,
|
91
|
+
audio: `#{_safedump(page.audio)}`,
|
92
|
+
fancybox: `#{page.fancybox !== false ? 'true' : 'false'}`,
|
93
|
+
nocopy: `#{page.nocopy ? 'true' : 'false'}`,
|
94
|
+
outime: `#{page.outime !== false ? 'true' : 'false'}`,
|
95
|
+
template: `#{__('outime.template')}`,
|
96
|
+
quiz: {
|
97
|
+
choice: `#{__('quiz.choice')}`,
|
98
|
+
multiple: `#{__('quiz.multiple')}`,
|
99
|
+
true_false: `#{__('quiz.true_false')}`,
|
100
|
+
essay: `#{__('quiz.essay')}`,
|
101
|
+
gap_fill: `#{__('quiz.gap_fill')}`,
|
102
|
+
mistake: `#{__('quiz.mistake')}`
|
103
|
+
},
|
104
|
+
ignores: [
|
105
|
+
(uri) => uri.includes('#'),
|
106
|
+
(uri) => new RegExp(LOCAL.path + '$').test(uri),
|
107
|
+
!{JSON.stringify(ignores)}
|
108
|
+
]
|
109
|
+
};
|
110
|
+
|
129
111
|
script(src="https://polyfill.alicdn.com/polyfill.min.js")
|
130
112
|
if theme.advVendors.enable
|
131
113
|
each i in _list_vendor_js()
|
@@ -11,7 +11,7 @@ div(class="meta")
|
|
11
11
|
!= __('post.edited')
|
12
12
|
time(title=__('post.modified') + __('symbol.colon') + full_date(post.updated) itemprop="dateModified" datetime=moment(post.updated).format())
|
13
13
|
!= date(post.updated)
|
14
|
-
if theme.waline.pageview && !theme.waline.enable
|
14
|
+
if theme.waline.pageview && !theme.waline.enable && !theme.twikoo.enable
|
15
15
|
script(type = "module" data-pjax).
|
16
16
|
import { pageviewCount } from 'https://unpkg.com/@waline/client/dist/pageview.mjs';
|
17
17
|
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "hexo-theme-shokax",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.6",
|
4
4
|
"description": "a hexo theme based on shoka",
|
5
5
|
"main": "index.js",
|
6
|
-
"repository": "https://github.com/
|
6
|
+
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
|
7
7
|
"author": "Chou kaitaku",
|
8
8
|
"license": "GPL-3.0-or-later",
|
9
9
|
"scripts": {
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"@types/jquery": "^3.5.16",
|
20
20
|
"@types/js-yaml": "^4.0.5",
|
21
21
|
"@types/lozad": "^1.16.1",
|
22
|
-
"@types/node": "^
|
22
|
+
"@types/node": "^20.1.0",
|
23
23
|
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
24
24
|
"@typescript-eslint/parser": "^5.59.0",
|
25
25
|
"@vuepress/client": "2.0.0-beta.61",
|
@@ -34,12 +34,12 @@
|
|
34
34
|
"hexo-fs": "^4.1.1",
|
35
35
|
"hexo-util": "^3.0.1",
|
36
36
|
"instantsearch.js": "^4.54.1",
|
37
|
-
"pjax": "^0.2.8",
|
38
37
|
"theme-shokax-anime": "^0.0.4",
|
38
|
+
"theme-shokax-pjax": "^0.0.2",
|
39
39
|
"typescript": "^5.0.4",
|
40
40
|
"vue": "^3.2.47",
|
41
41
|
"vuepress": "2.0.0-beta.61",
|
42
|
-
"vuepress-plugin-sitemap2": "2.0.0-beta.
|
42
|
+
"vuepress-plugin-sitemap2": "2.0.0-beta.208"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
45
|
"js-yaml": "^4.1.0",
|
@@ -3,20 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const hexo_util_1 =
|
6
|
+
const hexo_util_1 = require("hexo-util");
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
8
8
|
const path_1 = __importDefault(require("path"));
|
9
9
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
10
10
|
hexo.extend.filter.register('before_generate', () => {
|
11
11
|
if (hexo.config.theme_config) {
|
12
|
-
hexo.theme.config = hexo_util_1.
|
12
|
+
hexo.theme.config = (0, hexo_util_1.deepMerge)(hexo.theme.config, hexo.config.theme_config);
|
13
13
|
}
|
14
14
|
const data = hexo.locals.get('data');
|
15
15
|
if (data.languages) {
|
16
16
|
const { i18n } = hexo.theme;
|
17
17
|
const mergeLang = lang => {
|
18
18
|
if (data.languages[lang]) {
|
19
|
-
i18n.set(lang, hexo_util_1.
|
19
|
+
i18n.set(lang, (0, hexo_util_1.deepMerge)(i18n.get([lang]), data.languages[lang]));
|
20
20
|
}
|
21
21
|
};
|
22
22
|
for (const lang of ['en', 'ja', 'zh-CN', 'zh-HK', 'zh-TW']) {
|
@@ -58,14 +58,14 @@ function postMessage(path, content, dbPath, startMessage) {
|
|
58
58
|
});
|
59
59
|
});
|
60
60
|
};
|
61
|
-
const checkTime = () => {
|
61
|
+
const checkTime = (waitTime) => {
|
62
62
|
if (node_fs_1.default.existsSync('request.lock')) {
|
63
63
|
if (node_fs_1.default.existsSync('requested.lock')) {
|
64
|
-
setTimeout(checkTime, 1000 *
|
64
|
+
setTimeout(checkTime, 1000 * waitTime);
|
65
65
|
return;
|
66
66
|
}
|
67
67
|
node_fs_1.default.writeFileSync('requested.lock', '');
|
68
|
-
setTimeout(request, 1000 *
|
68
|
+
setTimeout(request, 1000 * 2.5 * waitTime);
|
69
69
|
node_fs_1.default.unlinkSync('request.lock');
|
70
70
|
}
|
71
71
|
else {
|
@@ -82,7 +82,15 @@ function postMessage(path, content, dbPath, startMessage) {
|
|
82
82
|
messages: [{ role: 'user', content: `${startMessage} ${content}` }],
|
83
83
|
temperature: 0.7
|
84
84
|
};
|
85
|
-
|
85
|
+
if (config.pricing === 'trial') {
|
86
|
+
hexo.log.info('Requesting OpenAI API... (3 RPM mode)');
|
87
|
+
hexo.log.info('It may take 20 minutes or more (depending on the number of articles, each one takes 25 seconds)');
|
88
|
+
checkTime(10);
|
89
|
+
}
|
90
|
+
else {
|
91
|
+
hexo.log.info('Requesting OpenAI API... (60 RPM mode)');
|
92
|
+
checkTime(0.5);
|
93
|
+
}
|
86
94
|
}
|
87
95
|
else {
|
88
96
|
}
|
package/scripts/plugin/index.js
CHANGED
@@ -6,8 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const injects_1 = __importDefault(require("./lib/injects"));
|
7
7
|
const node_https_1 = __importDefault(require("node:https"));
|
8
8
|
const package_json_1 = require("../../package.json");
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
9
10
|
hexo.on('generateBefore', () => {
|
10
11
|
(0, injects_1.default)(hexo);
|
12
|
+
if (node_fs_1.default.existsSync('request.lock')) {
|
13
|
+
node_fs_1.default.unlinkSync('request.lock');
|
14
|
+
}
|
15
|
+
if (node_fs_1.default.existsSync('requested.lock')) {
|
16
|
+
node_fs_1.default.unlinkSync('requested.lock');
|
17
|
+
}
|
11
18
|
});
|
12
19
|
hexo.on('generateAfter', () => {
|
13
20
|
node_https_1.default.get('https://api.github.com/repos/theme-shoka-x/hexo-theme-shokaX/releases/latest', {
|
@@ -303,3 +303,15 @@ const pageScroll = function (target, offset, complete) {
|
|
303
303
|
};
|
304
304
|
anime(opt).play();
|
305
305
|
};
|
306
|
+
let inCloudFlare = true;
|
307
|
+
window.addEventListener('DOMContentLoaded', function () {
|
308
|
+
inCloudFlare = false;
|
309
|
+
});
|
310
|
+
if (document.readyState === 'loading') {
|
311
|
+
window.addEventListener('load', function () {
|
312
|
+
if (inCloudFlare) {
|
313
|
+
window.dispatchEvent(new Event('DOMContentLoaded'));
|
314
|
+
console.log('%c ☁️cloudflare patch ' + '%c running(rocket & minify)', 'color: white; background: #ff8c00; padding: 5px 3px;', 'padding: 4px;border:1px solid #ff8c00');
|
315
|
+
}
|
316
|
+
});
|
317
|
+
}
|
package/source/js/_app/page.js
CHANGED
@@ -2,35 +2,26 @@ const cardActive = function () {
|
|
2
2
|
if (!$dom('.index.wrap')) {
|
3
3
|
return;
|
4
4
|
}
|
5
|
-
|
6
|
-
|
7
|
-
if (article.hasClass('show')
|
8
|
-
article.
|
5
|
+
const io = new IntersectionObserver(function (entries) {
|
6
|
+
entries.forEach(function (article) {
|
7
|
+
if (article.target.hasClass('show')) {
|
8
|
+
io.unobserve(article.target);
|
9
9
|
}
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
const io = new IntersectionObserver(function (entries) {
|
14
|
-
entries.forEach(function (article) {
|
15
|
-
if (article.target.hasClass('show')) {
|
10
|
+
else {
|
11
|
+
if (article.isIntersecting || article.intersectionRatio > 0) {
|
12
|
+
article.target.addClass('show');
|
16
13
|
io.unobserve(article.target);
|
17
14
|
}
|
18
|
-
|
19
|
-
if (article.isIntersecting || article.intersectionRatio > 0) {
|
20
|
-
article.target.addClass('show');
|
21
|
-
io.unobserve(article.target);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
});
|
25
|
-
}, {
|
26
|
-
root: null,
|
27
|
-
threshold: [0.3]
|
28
|
-
});
|
29
|
-
$dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
|
30
|
-
io.observe(article);
|
15
|
+
}
|
31
16
|
});
|
32
|
-
|
33
|
-
|
17
|
+
}, {
|
18
|
+
root: null,
|
19
|
+
threshold: [0.3]
|
20
|
+
});
|
21
|
+
$dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
|
22
|
+
io.observe(article);
|
23
|
+
});
|
24
|
+
$dom('.index.wrap .item:first-child').addClass('show');
|
34
25
|
$dom.each('.cards .item', function (element, index) {
|
35
26
|
['mouseenter', 'touchstart'].forEach(function (item) {
|
36
27
|
element.addEventListener(item, function (event) {
|
@@ -50,7 +41,7 @@ const cardActive = function () {
|
|
50
41
|
const registerExtURL = function () {
|
51
42
|
$dom.each('span.exturl', function (element) {
|
52
43
|
const link = document.createElement('a');
|
53
|
-
link.href = decodeURIComponent(atob(element.dataset.url).split('').map(function (c) {
|
44
|
+
link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map(function (c) {
|
54
45
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
55
46
|
}).join(''));
|
56
47
|
link.rel = 'noopener external nofollow noreferrer';
|
@@ -666,7 +657,6 @@ const siteInit = function () {
|
|
666
657
|
'.leancloud-recent-comment',
|
667
658
|
'script[data-config]'
|
668
659
|
],
|
669
|
-
analytics: false,
|
670
660
|
cacheBust: false
|
671
661
|
});
|
672
662
|
CONFIG.quicklink.ignores = LOCAL.ignores;
|
@@ -689,5 +679,5 @@ const siteInit = function () {
|
|
689
679
|
window.addEventListener('DOMContentLoaded', siteInit, {
|
690
680
|
passive: true
|
691
681
|
});
|
692
|
-
console.log('%c Theme.ShokaX v' + CONFIG.version + ' %c https://github.com/
|
682
|
+
console.log('%c Theme.ShokaX v' + CONFIG.version + ' %c https://github.com/theme-shoka-x/hexo-theme-shokaX ', 'color: white; background: #e9546b; padding:5px 0;', 'padding:4px;border:1px solid #e9546b;');
|
693
683
|
console.log('%c by kaitaku ' + '%c https://www.kaitaku.xyz', 'color: white; background: #00bfff; padding: 5px 3px;', 'padding: 4px;border:1px solid #00bfff');
|
package/source/js/_app/player.js
CHANGED
@@ -425,7 +425,7 @@ const mediaPlayer = function (t, config) {
|
|
425
425
|
t.player = {
|
426
426
|
_id: utils.random(999999),
|
427
427
|
group: true,
|
428
|
-
load: (newList)
|
428
|
+
load: function (newList) {
|
429
429
|
let d = '';
|
430
430
|
if (newList && newList.length > 0) {
|
431
431
|
if (this.options.rawList !== newList) {
|
@@ -483,7 +483,7 @@ const mediaPlayer = function (t, config) {
|
|
483
483
|
}
|
484
484
|
});
|
485
485
|
},
|
486
|
-
mode: ()
|
486
|
+
mode: function () {
|
487
487
|
const total = playlist.data.length;
|
488
488
|
if (!total || playlist.errnum === total) {
|
489
489
|
return;
|
@@ -523,7 +523,7 @@ const mediaPlayer = function (t, config) {
|
|
523
523
|
}
|
524
524
|
this.init();
|
525
525
|
},
|
526
|
-
switch: (index)
|
526
|
+
switch: function (index) {
|
527
527
|
if (typeof index === 'number' &&
|
528
528
|
index !== playlist.index &&
|
529
529
|
playlist.current() &&
|
@@ -532,7 +532,7 @@ const mediaPlayer = function (t, config) {
|
|
532
532
|
this.init();
|
533
533
|
}
|
534
534
|
},
|
535
|
-
init: ()
|
535
|
+
init: function () {
|
536
536
|
const item = playlist.current();
|
537
537
|
if (!item || item.error) {
|
538
538
|
this.mode();
|
@@ -555,7 +555,7 @@ const mediaPlayer = function (t, config) {
|
|
555
555
|
this.play();
|
556
556
|
}
|
557
557
|
},
|
558
|
-
play: ()
|
558
|
+
play: function () {
|
559
559
|
NOWPLAYING && NOWPLAYING.player.pause();
|
560
560
|
if (playlist.current().error) {
|
561
561
|
this.mode();
|
@@ -608,7 +608,7 @@ const mediaPlayer = function (t, config) {
|
|
608
608
|
el: null,
|
609
609
|
data: null,
|
610
610
|
index: 0,
|
611
|
-
create: (box)
|
611
|
+
create: function (box) {
|
612
612
|
const current = playlist.index;
|
613
613
|
const raw = playlist.current().lrc;
|
614
614
|
const callback = function (body) {
|