hexo-theme-shokax 0.5.2 → 0.5.4
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/.vscode/settings.json +6 -0
- package/CODE_OF_CONDUCT.md +128 -128
- package/LICENSE +660 -660
- package/LICENSE-shoka +21 -21
- package/README.md +74 -74
- package/UsageRestrictions.md +25 -25
- package/_config.yml +355 -352
- package/languages/README.md +19 -19
- package/languages/default.yml +1 -1
- package/languages/en.yml +155 -155
- package/languages/ja.yml +155 -155
- package/languages/zh-CN.yml +155 -155
- package/languages/zh-HK.yml +155 -155
- package/languages/zh-TW.yml +155 -155
- package/layout/_alternate/atom.ejs +30 -30
- package/layout/_alternate/json.ejs +16 -16
- package/layout/_alternate/rss.ejs +34 -34
- package/layout/_mixin/breadcrumb.pug +33 -33
- package/layout/_mixin/card.pug +37 -37
- package/layout/_mixin/comment.pug +6 -6
- package/layout/_mixin/postmeta.pug +29 -29
- package/layout/_mixin/segment.pug +35 -35
- package/layout/_mixin/sidebar.pug +40 -40
- package/layout/_mixin/widgets.pug +28 -28
- package/layout/_partials/footer.pug +43 -43
- package/layout/_partials/head/head.pug +50 -50
- package/layout/_partials/head/head_com.pug +24 -24
- package/layout/_partials/head/pwa.pug +18 -18
- package/layout/_partials/header.pug +18 -18
- package/layout/_partials/layout.pug +138 -137
- package/layout/_partials/loading.pug +13 -13
- package/layout/_partials/pagination.pug +4 -4
- package/layout/_partials/post/copyright.pug +20 -20
- package/layout/_partials/post/footer.pug +20 -20
- package/layout/_partials/post/nav.pug +17 -17
- package/layout/_partials/post/post.pug +42 -42
- package/layout/_partials/post/reward.pug +18 -18
- package/layout/_partials/sidebar/menu.pug +37 -37
- package/layout/_partials/sidebar/overview.pug +42 -42
- package/layout/_partials/third-party/baidu-analytics.pug +11 -11
- package/layout/_partials/third-party/clarity.pug +8 -8
- package/layout/_partials/third-party/google-analytics.pug +9 -9
- package/layout/archive.pug +121 -121
- package/layout/category.pug +62 -62
- package/layout/index.pug +36 -36
- package/layout/page.pug +60 -60
- package/layout/post.pug +42 -42
- package/layout/tag.pug +46 -46
- package/package.json +6 -5
- package/scripts/generaters/script.js +2 -1
- package/scripts/plugin/check.js +13 -7
- package/source/assets/algolia_logo.svg +9 -9
- package/source/assets/logo.svg +16 -16
- package/source/css/_colors.styl +207 -207
- package/source/css/_common/components/components.styl +5 -5
- package/source/css/_common/components/pages/collapse.styl +119 -119
- package/source/css/_common/components/pages/home.styl +391 -391
- package/source/css/_common/components/pages/pages.styl +56 -56
- package/source/css/_common/components/pages/tag-cloud.styl +12 -12
- package/source/css/_common/components/post/breadcrumb.styl +39 -39
- package/source/css/_common/components/post/copyright.styl +41 -41
- package/source/css/_common/components/post/expand.styl +263 -263
- package/source/css/_common/components/post/footer.styl +11 -11
- package/source/css/_common/components/post/header.styl +79 -79
- package/source/css/_common/components/post/nav.styl +64 -64
- package/source/css/_common/components/post/post.styl +29 -29
- package/source/css/_common/components/post/reward.styl +50 -50
- package/source/css/_common/components/post/rtl.styl +12 -12
- package/source/css/_common/components/post/tags.styl +39 -39
- package/source/css/_common/components/tags/collapse.styl +72 -72
- package/source/css/_common/components/tags/container.styl +49 -49
- package/source/css/_common/components/tags/label.styl +12 -12
- package/source/css/_common/components/tags/links.styl +77 -77
- package/source/css/_common/components/tags/list.styl +131 -131
- package/source/css/_common/components/tags/note.styl +70 -70
- package/source/css/_common/components/tags/player.styl +361 -361
- package/source/css/_common/components/tags/quiz.styl +200 -200
- package/source/css/_common/components/tags/tabs.styl +89 -89
- package/source/css/_common/components/tags/tags.styl +9 -9
- package/source/css/_common/components/third-party/loading.styl +222 -222
- package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
- package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
- package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
- package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
- package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
- package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
- package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
- package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
- package/source/css/_common/components/third-party/pace.styl +18 -18
- package/source/css/_common/components/third-party/search.styl +167 -167
- package/source/css/_common/components/third-party/theme.styl +151 -151
- package/source/css/_common/components/third-party/third-party.styl +22 -22
- package/source/css/_common/components/third-party/widgets.styl +57 -57
- package/source/css/_common/outline/footer/footer.styl +67 -67
- package/source/css/_common/outline/header/brand.styl +77 -77
- package/source/css/_common/outline/header/header.styl +20 -20
- package/source/css/_common/outline/header/image.styl +85 -85
- package/source/css/_common/outline/header/menu.styl +117 -117
- package/source/css/_common/outline/header/nav.styl +81 -81
- package/source/css/_common/outline/header/right.styl +15 -15
- package/source/css/_common/outline/header/tool.styl +207 -207
- package/source/css/_common/outline/header/waves.styl +57 -57
- package/source/css/_common/outline/mobile.styl +46 -46
- package/source/css/_common/outline/outline.styl +78 -78
- package/source/css/_common/outline/sidebar/author.styl +59 -59
- package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
- package/source/css/_common/outline/sidebar/menu.styl +63 -63
- package/source/css/_common/outline/sidebar/quick.styl +43 -43
- package/source/css/_common/outline/sidebar/related.styl +56 -56
- package/source/css/_common/outline/sidebar/sidebar.styl +82 -82
- package/source/css/_common/outline/sidebar/social.styl +69 -69
- package/source/css/_common/outline/sidebar/state.styl +37 -37
- package/source/css/_common/outline/sidebar/tab.styl +71 -71
- package/source/css/_common/outline/sidebar/toc.styl +47 -47
- package/source/css/_common/scaffolding/animate.styl +322 -322
- package/source/css/_common/scaffolding/base.styl +192 -192
- package/source/css/_common/scaffolding/buttons.styl +48 -48
- package/source/css/_common/scaffolding/divider.styl +36 -36
- package/source/css/_common/scaffolding/iconfont.styl +443 -443
- package/source/css/_common/scaffolding/normalize.styl +273 -273
- package/source/css/_common/scaffolding/pagination.styl +81 -81
- package/source/css/_common/scaffolding/ribbon.styl +38 -38
- package/source/css/_common/scaffolding/scaffolding.styl +14 -14
- package/source/css/_common/scaffolding/scrollbar.styl +37 -37
- package/source/css/_common/scaffolding/tables.styl +50 -50
- package/source/css/_common/scaffolding/tip.styl +19 -19
- package/source/css/_common/scaffolding/toggles.styl +59 -59
- package/source/css/_iconfont.styl +455 -455
- package/source/css/_mixins.styl +148 -148
- package/source/css/_variables.styl +89 -89
- package/source/css/app.styl +25 -25
- package/source/css/mermaid.styl +5 -5
- package/source/css/page.styl +2 -2
- package/source/css/post.styl +4 -5
- package/source/css/scaffolding.styl +4 -4
- package/source/js/_app/components/cloudflare.ts +18 -18
- package/source/js/_app/components/comments.ts +88 -88
- package/source/js/_app/components/sidebar.ts +243 -243
- package/source/js/_app/components/tcomments.ts +53 -53
- package/source/js/_app/globals/globalVars.ts +84 -84
- package/source/js/_app/globals/handles.ts +124 -124
- package/source/js/_app/globals/themeColor.ts +62 -62
- package/source/js/_app/globals/thirdparty.ts +63 -63
- package/source/js/_app/globals/tools.ts +73 -73
- package/source/js/_app/library/anime.ts +121 -121
- package/source/js/_app/library/declare.d.ts +129 -128
- package/source/js/_app/library/proto.ts +70 -70
- package/source/js/_app/library/vue.ts +49 -49
- package/source/js/_app/page/common.ts +41 -41
- package/source/js/_app/page/imageviewer.ts +15 -15
- package/source/js/_app/page/post.ts +251 -252
- package/source/js/_app/page/search.ts +109 -109
- package/source/js/_app/page/tab.ts +59 -59
- package/source/js/_app/pjax/domInit.ts +102 -102
- package/source/js/_app/pjax/refresh.ts +115 -117
- package/source/js/_app/pjax/siteInit.ts +93 -90
- package/source/js/_app/player.ts +13 -13
- package/toolbox/compiler.mjs +49 -49
- package/toolbox/dev-version.mjs +14 -14
- package/toolbox/hoistdep.mjs +5 -5
- package/toolbox/lib.mjs +63 -63
@@ -1,117 +1,115 @@
|
|
1
|
-
import { cardActive } from '../page/common'
|
2
|
-
import { resizeHandle } from '../globals/handles'
|
3
|
-
import {
|
4
|
-
CONFIG,
|
5
|
-
setLocalHash, setLocalUrl, setOriginTitle,
|
6
|
-
} from '../globals/globalVars'
|
7
|
-
import { positionInit } from '../globals/tools'
|
8
|
-
import { menuActive, sideBarTab, sidebarTOC } from '../components/sidebar'
|
9
|
-
import { Loader, isOutime } from '../globals/thirdparty'
|
10
|
-
import { tabFormat } from '../page/tab'
|
11
|
-
|
12
|
-
export const siteRefresh = async (reload) => {
|
13
|
-
if (__shokax_antiFakeWebsite__) {
|
14
|
-
if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
|
15
|
-
window.location.href = CONFIG.hostname
|
16
|
-
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
17
|
-
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
setLocalHash(0)
|
22
|
-
setLocalUrl(window.location.href)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
}
|
117
|
-
}
|
1
|
+
import { cardActive } from '../page/common'
|
2
|
+
import { resizeHandle } from '../globals/handles'
|
3
|
+
import {
|
4
|
+
CONFIG,
|
5
|
+
setLocalHash, setLocalUrl, setOriginTitle,
|
6
|
+
} from '../globals/globalVars'
|
7
|
+
import { positionInit } from '../globals/tools'
|
8
|
+
import { menuActive, sideBarTab, sidebarTOC } from '../components/sidebar'
|
9
|
+
import { Loader, isOutime } from '../globals/thirdparty'
|
10
|
+
import { tabFormat } from '../page/tab'
|
11
|
+
|
12
|
+
export const siteRefresh = async (reload) => {
|
13
|
+
if (__shokax_antiFakeWebsite__) {
|
14
|
+
if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
|
15
|
+
window.location.href = CONFIG.hostname
|
16
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
17
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
setLocalHash(0)
|
22
|
+
setLocalUrl(window.location.href)
|
23
|
+
|
24
|
+
await import('katex/dist/contrib/copy-tex.mjs')
|
25
|
+
|
26
|
+
// 懒加载背景图
|
27
|
+
const lazyBg = new IntersectionObserver(function (entries, observer) {
|
28
|
+
entries.forEach(entry => {
|
29
|
+
if (entry.isIntersecting) {
|
30
|
+
const el = entry.target as HTMLElement
|
31
|
+
el.style.backgroundImage = `url("${el.getAttribute('data-background-image')}")`
|
32
|
+
el.removeAttribute('data-background-image')
|
33
|
+
observer.unobserve(el)
|
34
|
+
}
|
35
|
+
})
|
36
|
+
}, {
|
37
|
+
root: null,
|
38
|
+
threshold: 0.2
|
39
|
+
})
|
40
|
+
document.querySelectorAll('[data-background-image]').forEach(el => {
|
41
|
+
lazyBg.observe(el)
|
42
|
+
})
|
43
|
+
|
44
|
+
setOriginTitle(document.title)
|
45
|
+
|
46
|
+
resizeHandle()
|
47
|
+
|
48
|
+
menuActive()
|
49
|
+
|
50
|
+
sideBarTab()
|
51
|
+
sidebarTOC()
|
52
|
+
|
53
|
+
const pagePost = await import('../page/post')
|
54
|
+
await pagePost.postBeauty()
|
55
|
+
|
56
|
+
const cpel = document.getElementById('copyright')
|
57
|
+
if (cpel) {
|
58
|
+
const comment = new IntersectionObserver((entries) => {
|
59
|
+
entries.forEach((entry) => {
|
60
|
+
if (entry.isIntersecting) {
|
61
|
+
if (__shokax_waline__) {
|
62
|
+
import('../components/comments').then(({walinePageview, walineComment}) => {
|
63
|
+
walinePageview()
|
64
|
+
walineComment()
|
65
|
+
})
|
66
|
+
}
|
67
|
+
if (__shokax_twikoo__) {
|
68
|
+
import('../components/tcomments').then(({twikooComment}) => {
|
69
|
+
twikooComment()
|
70
|
+
})
|
71
|
+
}
|
72
|
+
comment.disconnect()
|
73
|
+
}
|
74
|
+
})
|
75
|
+
}, {
|
76
|
+
root: null,
|
77
|
+
threshold: 0.2
|
78
|
+
})
|
79
|
+
|
80
|
+
comment.observe(cpel)
|
81
|
+
}
|
82
|
+
|
83
|
+
if (__shokax_waline__) {
|
84
|
+
import('../components/comments').then(async ({walineRecentComments}) => {
|
85
|
+
await walineRecentComments()
|
86
|
+
})
|
87
|
+
}
|
88
|
+
|
89
|
+
if (__shokax_twikoo__) {
|
90
|
+
import('../components/tcomments').then(async ({twikooRecentComments}) => {
|
91
|
+
await twikooRecentComments()
|
92
|
+
})
|
93
|
+
}
|
94
|
+
|
95
|
+
if (__shokax_tabs__) {
|
96
|
+
tabFormat()
|
97
|
+
}
|
98
|
+
|
99
|
+
if (sessionStorage.getItem('loaded') === 'true') {
|
100
|
+
Loader.hide(30)
|
101
|
+
} else {
|
102
|
+
sessionStorage.setItem('loaded', 'true')
|
103
|
+
Loader.hide(500)
|
104
|
+
}
|
105
|
+
|
106
|
+
setTimeout(() => {
|
107
|
+
positionInit()
|
108
|
+
}, 500)
|
109
|
+
|
110
|
+
cardActive()
|
111
|
+
|
112
|
+
if (__shokax_outime__ && LOCAL.ispost) {
|
113
|
+
isOutime()
|
114
|
+
}
|
115
|
+
}
|
@@ -1,90 +1,93 @@
|
|
1
|
-
import domInit from './domInit'
|
2
|
-
import {siteRefresh} from './refresh'
|
3
|
-
import {cloudflareInit} from '../components/cloudflare'
|
4
|
-
import {BODY, CONFIG, setSiteSearch, siteSearch} from '../globals/globalVars'
|
5
|
-
import {autoDarkmode, themeColorListener} from '../globals/themeColor'
|
6
|
-
import {resizeHandle, scrollHandle, visibilityListener} from '../globals/handles'
|
7
|
-
import {pagePosition} from '../globals/tools'
|
8
|
-
import {initVue} from '../library/vue'
|
9
|
-
import {createChild} from '../library/proto'
|
10
|
-
import {transition} from '../library/anime'
|
11
|
-
|
12
|
-
const siteInit = async () => {
|
13
|
-
initVue()
|
14
|
-
domInit()
|
15
|
-
|
16
|
-
autoDarkmode()
|
17
|
-
|
18
|
-
if (__shokax_VL__) {
|
19
|
-
visibilityListener()
|
20
|
-
}
|
21
|
-
themeColorListener()
|
22
|
-
|
23
|
-
if (
|
24
|
-
document.querySelector('li.item.search > i').addEventListener('click', () => {
|
25
|
-
if (CONFIG.search === null) {
|
26
|
-
return
|
27
|
-
}
|
28
|
-
|
29
|
-
if (!siteSearch) {
|
30
|
-
setSiteSearch(createChild(BODY, 'div', {
|
31
|
-
id: 'search',
|
32
|
-
innerHTML: '<div class="inner"><div class="header"><span class="icon"><i class="ic i-search"></i></span><div class="search-input-container"></div><span class="close-btn"><i class="ic i-times-circle"></i></span></div><div class="results"><div class="inner"><div id="search-stats"></div><div id="search-hits"></div><div id="search-pagination"></div></div></div></div>'
|
33
|
-
}))
|
34
|
-
}
|
35
|
-
|
36
|
-
import('../page/search').then(({algoliaSearch}) => {
|
37
|
-
algoliaSearch()
|
38
|
-
})
|
39
|
-
|
40
|
-
// Handle and trigger popup window
|
41
|
-
document.querySelector('.search').addEventListener('click', () => {
|
42
|
-
document.body.style.overflow = 'hidden'
|
43
|
-
transition(siteSearch, 'shrinkIn', () => {
|
44
|
-
(document.querySelector('.search-input') as HTMLInputElement).focus()
|
45
|
-
}) // transition.shrinkIn
|
46
|
-
})
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
1
|
+
import domInit from './domInit'
|
2
|
+
import {siteRefresh} from './refresh'
|
3
|
+
import {cloudflareInit} from '../components/cloudflare'
|
4
|
+
import {BODY, CONFIG, setSiteSearch, siteSearch} from '../globals/globalVars'
|
5
|
+
import {autoDarkmode, themeColorListener} from '../globals/themeColor'
|
6
|
+
import {resizeHandle, scrollHandle, visibilityListener} from '../globals/handles'
|
7
|
+
import {pagePosition} from '../globals/tools'
|
8
|
+
import {initVue} from '../library/vue'
|
9
|
+
import {createChild} from '../library/proto'
|
10
|
+
import {transition} from '../library/anime'
|
11
|
+
|
12
|
+
const siteInit = async () => {
|
13
|
+
initVue()
|
14
|
+
domInit()
|
15
|
+
|
16
|
+
autoDarkmode()
|
17
|
+
|
18
|
+
if (__shokax_VL__) {
|
19
|
+
visibilityListener()
|
20
|
+
}
|
21
|
+
themeColorListener()
|
22
|
+
|
23
|
+
if (__shokax_algolia_search__) {
|
24
|
+
document.querySelector('li.item.search > i').addEventListener('click', () => {
|
25
|
+
if (CONFIG.search === null) {
|
26
|
+
return
|
27
|
+
}
|
28
|
+
|
29
|
+
if (!siteSearch) {
|
30
|
+
setSiteSearch(createChild(BODY, 'div', {
|
31
|
+
id: 'search',
|
32
|
+
innerHTML: '<div class="inner"><div class="header"><span class="icon"><i class="ic i-search"></i></span><div class="search-input-container"></div><span class="close-btn"><i class="ic i-times-circle"></i></span></div><div class="results"><div class="inner"><div id="search-stats"></div><div id="search-hits"></div><div id="search-pagination"></div></div></div></div>'
|
33
|
+
}))
|
34
|
+
}
|
35
|
+
|
36
|
+
import('../page/search').then(({algoliaSearch}) => {
|
37
|
+
algoliaSearch()
|
38
|
+
})
|
39
|
+
|
40
|
+
// Handle and trigger popup window
|
41
|
+
document.querySelector('.search').addEventListener('click', () => {
|
42
|
+
document.body.style.overflow = 'hidden'
|
43
|
+
transition(siteSearch, 'shrinkIn', () => {
|
44
|
+
(document.querySelector('.search-input') as HTMLInputElement).focus()
|
45
|
+
}) // transition.shrinkIn
|
46
|
+
})
|
47
|
+
}, {once: true, capture: true})
|
48
|
+
} else if (__shokax_pagefind_search__){
|
49
|
+
const { initializePagefindSearch } = await import('shokax-uikit/components/pagefind/init')
|
50
|
+
initializePagefindSearch('li.item.search')
|
51
|
+
}
|
52
|
+
|
53
|
+
if (__shokax_fireworks__) {
|
54
|
+
import('mouse-firework').then((firework) => {
|
55
|
+
firework.default(CONFIG.fireworks)
|
56
|
+
})
|
57
|
+
}
|
58
|
+
|
59
|
+
window.addEventListener('scroll', scrollHandle, {
|
60
|
+
passive: true
|
61
|
+
})
|
62
|
+
|
63
|
+
window.addEventListener('resize', resizeHandle, {
|
64
|
+
passive: true
|
65
|
+
})
|
66
|
+
|
67
|
+
window.addEventListener('visibilitychange', () => {
|
68
|
+
pagePosition()
|
69
|
+
})
|
70
|
+
await siteRefresh(1)
|
71
|
+
// TODO 修复内页跳转后重复出现加载动画的问题
|
72
|
+
}
|
73
|
+
|
74
|
+
cloudflareInit()
|
75
|
+
|
76
|
+
if (__shokax_antiFakeWebsite__) {
|
77
|
+
if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
|
78
|
+
window.location.href = CONFIG.hostname
|
79
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
80
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
window.addEventListener('DOMContentLoaded', siteInit, {
|
85
|
+
passive: true
|
86
|
+
})
|
87
|
+
|
88
|
+
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;')
|
89
|
+
|
90
|
+
if (new Date().getDate() === 5 && new Date().getMonth() === 8) {
|
91
|
+
console.log('🎉 ShokaX 生日快乐!\nHappy Birthday ShokaX!')
|
92
|
+
console.log('感谢你们的支持与陪伴!\nThanks for your support and company!')
|
93
|
+
}
|
package/source/js/_app/player.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import { CONFIG } from './globals/globalVars'
|
2
|
-
import 'nyx-player/style'
|
3
|
-
|
4
|
-
export const initAudioPlayer = async function () {
|
5
|
-
const urls = []
|
6
|
-
CONFIG.audio.forEach((item) => {
|
7
|
-
urls.push({
|
8
|
-
name: item.title,
|
9
|
-
url: item.list[0]
|
10
|
-
})
|
11
|
-
})
|
12
|
-
const { initPlayer } = await import('nyx-player')
|
13
|
-
initPlayer("#player","#showBtn", urls, "#playBtn", "html[data-theme="dark"]", "shokax")
|
1
|
+
import { CONFIG } from './globals/globalVars'
|
2
|
+
import 'nyx-player/style'
|
3
|
+
|
4
|
+
export const initAudioPlayer = async function () {
|
5
|
+
const urls = []
|
6
|
+
CONFIG.audio.forEach((item) => {
|
7
|
+
urls.push({
|
8
|
+
name: item.title,
|
9
|
+
url: item.list[0]
|
10
|
+
})
|
11
|
+
})
|
12
|
+
const { initPlayer } = await import('nyx-player')
|
13
|
+
initPlayer("#player","#showBtn", urls, "#playBtn", "html[data-theme="dark"]", "shokax")
|
14
14
|
}
|
package/toolbox/compiler.mjs
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
/*
|
2
|
-
ShokaX ToolBox - Compiler
|
3
|
-
compatibility: ShokaX v0.5.x-dev
|
4
|
-
*/
|
5
|
-
import fs from 'fs/promises'
|
6
|
-
import { glob } from 'glob'
|
7
|
-
import { build } from 'esbuild'
|
8
|
-
|
9
|
-
|
10
|
-
console.log('ShokaX ToolBox - Compiler')
|
11
|
-
console.log('Start compiling...')
|
12
|
-
|
13
|
-
const entryPoints = await glob('./scripts/**/*.ts');
|
14
|
-
const jsons = await glob('./scripts/**/*.json');
|
15
|
-
|
16
|
-
console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!')
|
17
|
-
console.log('Using esbuild compiler...')
|
18
|
-
|
19
|
-
await build({
|
20
|
-
entryPoints: entryPoints,
|
21
|
-
bundle: false,
|
22
|
-
format: 'cjs',
|
23
|
-
target: ['esnext'],
|
24
|
-
platform: 'node',
|
25
|
-
loader: { '.ts': 'ts' },
|
26
|
-
outdir: 'scripts'
|
27
|
-
})
|
28
|
-
|
29
|
-
console.log('deleting ts and json files...')
|
30
|
-
|
31
|
-
await Promise.all(
|
32
|
-
entryPoints.map(async (entry) => {
|
33
|
-
await fs.unlink(entry)
|
34
|
-
})
|
35
|
-
)
|
36
|
-
|
37
|
-
await Promise.all(
|
38
|
-
jsons.map(async (entry)=>{
|
39
|
-
await fs.unlink(entry)
|
40
|
-
})
|
41
|
-
)
|
42
|
-
|
43
|
-
console.log('Finished compiling.')
|
44
|
-
|
45
|
-
console.log('Done.')
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
1
|
+
/*
|
2
|
+
ShokaX ToolBox - Compiler
|
3
|
+
compatibility: ShokaX v0.5.x-dev
|
4
|
+
*/
|
5
|
+
import fs from 'fs/promises'
|
6
|
+
import { glob } from 'glob'
|
7
|
+
import { build } from 'esbuild'
|
8
|
+
|
9
|
+
|
10
|
+
console.log('ShokaX ToolBox - Compiler')
|
11
|
+
console.log('Start compiling...')
|
12
|
+
|
13
|
+
const entryPoints = await glob('./scripts/**/*.ts');
|
14
|
+
const jsons = await glob('./scripts/**/*.json');
|
15
|
+
|
16
|
+
console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!')
|
17
|
+
console.log('Using esbuild compiler...')
|
18
|
+
|
19
|
+
await build({
|
20
|
+
entryPoints: entryPoints,
|
21
|
+
bundle: false,
|
22
|
+
format: 'cjs',
|
23
|
+
target: ['esnext'],
|
24
|
+
platform: 'node',
|
25
|
+
loader: { '.ts': 'ts' },
|
26
|
+
outdir: 'scripts'
|
27
|
+
})
|
28
|
+
|
29
|
+
console.log('deleting ts and json files...')
|
30
|
+
|
31
|
+
await Promise.all(
|
32
|
+
entryPoints.map(async (entry) => {
|
33
|
+
await fs.unlink(entry)
|
34
|
+
})
|
35
|
+
)
|
36
|
+
|
37
|
+
await Promise.all(
|
38
|
+
jsons.map(async (entry)=>{
|
39
|
+
await fs.unlink(entry)
|
40
|
+
})
|
41
|
+
)
|
42
|
+
|
43
|
+
console.log('Finished compiling.')
|
44
|
+
|
45
|
+
console.log('Done.')
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
package/toolbox/dev-version.mjs
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
import fs from 'node:fs';
|
2
|
-
import { execSync } from 'child_process';
|
3
|
-
|
4
|
-
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
5
|
-
const currentVersion = packageJson.version;
|
6
|
-
|
7
|
-
const shortHash = execSync('git rev-parse --short HEAD').toString().trim();
|
8
|
-
|
9
|
-
const newVersion = `${currentVersion}-dev-${shortHash}`;
|
10
|
-
|
11
|
-
packageJson.version = newVersion;
|
12
|
-
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 4));
|
13
|
-
|
14
|
-
console.log(`Updated package version to ${newVersion}`);
|
1
|
+
import fs from 'node:fs';
|
2
|
+
import { execSync } from 'child_process';
|
3
|
+
|
4
|
+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
|
5
|
+
const currentVersion = packageJson.version;
|
6
|
+
|
7
|
+
const shortHash = execSync('git rev-parse --short HEAD').toString().trim();
|
8
|
+
|
9
|
+
const newVersion = `${currentVersion}-dev-${shortHash}`;
|
10
|
+
|
11
|
+
packageJson.version = newVersion;
|
12
|
+
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 4));
|
13
|
+
|
14
|
+
console.log(`Updated package version to ${newVersion}`);
|
package/toolbox/hoistdep.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { hoistDeps } from "./lib.mjs";
|
2
|
-
|
3
|
-
console.log('ShokaX ToolBox - Hoist Dependencies')
|
4
|
-
console.log('Hoisting dependencies...')
|
5
|
-
await hoistDeps()
|
1
|
+
import { hoistDeps } from "./lib.mjs";
|
2
|
+
|
3
|
+
console.log('ShokaX ToolBox - Hoist Dependencies')
|
4
|
+
console.log('Hoisting dependencies...')
|
5
|
+
await hoistDeps()
|
6
6
|
console.log('Finished hoisting dependencies.')
|