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.
Files changed (161) hide show
  1. package/.vscode/settings.json +6 -0
  2. package/CODE_OF_CONDUCT.md +128 -128
  3. package/LICENSE +660 -660
  4. package/LICENSE-shoka +21 -21
  5. package/README.md +74 -74
  6. package/UsageRestrictions.md +25 -25
  7. package/_config.yml +355 -352
  8. package/languages/README.md +19 -19
  9. package/languages/default.yml +1 -1
  10. package/languages/en.yml +155 -155
  11. package/languages/ja.yml +155 -155
  12. package/languages/zh-CN.yml +155 -155
  13. package/languages/zh-HK.yml +155 -155
  14. package/languages/zh-TW.yml +155 -155
  15. package/layout/_alternate/atom.ejs +30 -30
  16. package/layout/_alternate/json.ejs +16 -16
  17. package/layout/_alternate/rss.ejs +34 -34
  18. package/layout/_mixin/breadcrumb.pug +33 -33
  19. package/layout/_mixin/card.pug +37 -37
  20. package/layout/_mixin/comment.pug +6 -6
  21. package/layout/_mixin/postmeta.pug +29 -29
  22. package/layout/_mixin/segment.pug +35 -35
  23. package/layout/_mixin/sidebar.pug +40 -40
  24. package/layout/_mixin/widgets.pug +28 -28
  25. package/layout/_partials/footer.pug +43 -43
  26. package/layout/_partials/head/head.pug +50 -50
  27. package/layout/_partials/head/head_com.pug +24 -24
  28. package/layout/_partials/head/pwa.pug +18 -18
  29. package/layout/_partials/header.pug +18 -18
  30. package/layout/_partials/layout.pug +138 -137
  31. package/layout/_partials/loading.pug +13 -13
  32. package/layout/_partials/pagination.pug +4 -4
  33. package/layout/_partials/post/copyright.pug +20 -20
  34. package/layout/_partials/post/footer.pug +20 -20
  35. package/layout/_partials/post/nav.pug +17 -17
  36. package/layout/_partials/post/post.pug +42 -42
  37. package/layout/_partials/post/reward.pug +18 -18
  38. package/layout/_partials/sidebar/menu.pug +37 -37
  39. package/layout/_partials/sidebar/overview.pug +42 -42
  40. package/layout/_partials/third-party/baidu-analytics.pug +11 -11
  41. package/layout/_partials/third-party/clarity.pug +8 -8
  42. package/layout/_partials/third-party/google-analytics.pug +9 -9
  43. package/layout/archive.pug +121 -121
  44. package/layout/category.pug +62 -62
  45. package/layout/index.pug +36 -36
  46. package/layout/page.pug +60 -60
  47. package/layout/post.pug +42 -42
  48. package/layout/tag.pug +46 -46
  49. package/package.json +6 -5
  50. package/scripts/generaters/script.js +2 -1
  51. package/scripts/plugin/check.js +13 -7
  52. package/source/assets/algolia_logo.svg +9 -9
  53. package/source/assets/logo.svg +16 -16
  54. package/source/css/_colors.styl +207 -207
  55. package/source/css/_common/components/components.styl +5 -5
  56. package/source/css/_common/components/pages/collapse.styl +119 -119
  57. package/source/css/_common/components/pages/home.styl +391 -391
  58. package/source/css/_common/components/pages/pages.styl +56 -56
  59. package/source/css/_common/components/pages/tag-cloud.styl +12 -12
  60. package/source/css/_common/components/post/breadcrumb.styl +39 -39
  61. package/source/css/_common/components/post/copyright.styl +41 -41
  62. package/source/css/_common/components/post/expand.styl +263 -263
  63. package/source/css/_common/components/post/footer.styl +11 -11
  64. package/source/css/_common/components/post/header.styl +79 -79
  65. package/source/css/_common/components/post/nav.styl +64 -64
  66. package/source/css/_common/components/post/post.styl +29 -29
  67. package/source/css/_common/components/post/reward.styl +50 -50
  68. package/source/css/_common/components/post/rtl.styl +12 -12
  69. package/source/css/_common/components/post/tags.styl +39 -39
  70. package/source/css/_common/components/tags/collapse.styl +72 -72
  71. package/source/css/_common/components/tags/container.styl +49 -49
  72. package/source/css/_common/components/tags/label.styl +12 -12
  73. package/source/css/_common/components/tags/links.styl +77 -77
  74. package/source/css/_common/components/tags/list.styl +131 -131
  75. package/source/css/_common/components/tags/note.styl +70 -70
  76. package/source/css/_common/components/tags/player.styl +361 -361
  77. package/source/css/_common/components/tags/quiz.styl +200 -200
  78. package/source/css/_common/components/tags/tabs.styl +89 -89
  79. package/source/css/_common/components/tags/tags.styl +9 -9
  80. package/source/css/_common/components/third-party/loading.styl +222 -222
  81. package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
  82. package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
  83. package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
  84. package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
  85. package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
  86. package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
  87. package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
  88. package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
  89. package/source/css/_common/components/third-party/pace.styl +18 -18
  90. package/source/css/_common/components/third-party/search.styl +167 -167
  91. package/source/css/_common/components/third-party/theme.styl +151 -151
  92. package/source/css/_common/components/third-party/third-party.styl +22 -22
  93. package/source/css/_common/components/third-party/widgets.styl +57 -57
  94. package/source/css/_common/outline/footer/footer.styl +67 -67
  95. package/source/css/_common/outline/header/brand.styl +77 -77
  96. package/source/css/_common/outline/header/header.styl +20 -20
  97. package/source/css/_common/outline/header/image.styl +85 -85
  98. package/source/css/_common/outline/header/menu.styl +117 -117
  99. package/source/css/_common/outline/header/nav.styl +81 -81
  100. package/source/css/_common/outline/header/right.styl +15 -15
  101. package/source/css/_common/outline/header/tool.styl +207 -207
  102. package/source/css/_common/outline/header/waves.styl +57 -57
  103. package/source/css/_common/outline/mobile.styl +46 -46
  104. package/source/css/_common/outline/outline.styl +78 -78
  105. package/source/css/_common/outline/sidebar/author.styl +59 -59
  106. package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
  107. package/source/css/_common/outline/sidebar/menu.styl +63 -63
  108. package/source/css/_common/outline/sidebar/quick.styl +43 -43
  109. package/source/css/_common/outline/sidebar/related.styl +56 -56
  110. package/source/css/_common/outline/sidebar/sidebar.styl +82 -82
  111. package/source/css/_common/outline/sidebar/social.styl +69 -69
  112. package/source/css/_common/outline/sidebar/state.styl +37 -37
  113. package/source/css/_common/outline/sidebar/tab.styl +71 -71
  114. package/source/css/_common/outline/sidebar/toc.styl +47 -47
  115. package/source/css/_common/scaffolding/animate.styl +322 -322
  116. package/source/css/_common/scaffolding/base.styl +192 -192
  117. package/source/css/_common/scaffolding/buttons.styl +48 -48
  118. package/source/css/_common/scaffolding/divider.styl +36 -36
  119. package/source/css/_common/scaffolding/iconfont.styl +443 -443
  120. package/source/css/_common/scaffolding/normalize.styl +273 -273
  121. package/source/css/_common/scaffolding/pagination.styl +81 -81
  122. package/source/css/_common/scaffolding/ribbon.styl +38 -38
  123. package/source/css/_common/scaffolding/scaffolding.styl +14 -14
  124. package/source/css/_common/scaffolding/scrollbar.styl +37 -37
  125. package/source/css/_common/scaffolding/tables.styl +50 -50
  126. package/source/css/_common/scaffolding/tip.styl +19 -19
  127. package/source/css/_common/scaffolding/toggles.styl +59 -59
  128. package/source/css/_iconfont.styl +455 -455
  129. package/source/css/_mixins.styl +148 -148
  130. package/source/css/_variables.styl +89 -89
  131. package/source/css/app.styl +25 -25
  132. package/source/css/mermaid.styl +5 -5
  133. package/source/css/page.styl +2 -2
  134. package/source/css/post.styl +4 -5
  135. package/source/css/scaffolding.styl +4 -4
  136. package/source/js/_app/components/cloudflare.ts +18 -18
  137. package/source/js/_app/components/comments.ts +88 -88
  138. package/source/js/_app/components/sidebar.ts +243 -243
  139. package/source/js/_app/components/tcomments.ts +53 -53
  140. package/source/js/_app/globals/globalVars.ts +84 -84
  141. package/source/js/_app/globals/handles.ts +124 -124
  142. package/source/js/_app/globals/themeColor.ts +62 -62
  143. package/source/js/_app/globals/thirdparty.ts +63 -63
  144. package/source/js/_app/globals/tools.ts +73 -73
  145. package/source/js/_app/library/anime.ts +121 -121
  146. package/source/js/_app/library/declare.d.ts +129 -128
  147. package/source/js/_app/library/proto.ts +70 -70
  148. package/source/js/_app/library/vue.ts +49 -49
  149. package/source/js/_app/page/common.ts +41 -41
  150. package/source/js/_app/page/imageviewer.ts +15 -15
  151. package/source/js/_app/page/post.ts +251 -252
  152. package/source/js/_app/page/search.ts +109 -109
  153. package/source/js/_app/page/tab.ts +59 -59
  154. package/source/js/_app/pjax/domInit.ts +102 -102
  155. package/source/js/_app/pjax/refresh.ts +115 -117
  156. package/source/js/_app/pjax/siteInit.ts +93 -90
  157. package/source/js/_app/player.ts +13 -13
  158. package/toolbox/compiler.mjs +49 -49
  159. package/toolbox/dev-version.mjs +14 -14
  160. package/toolbox/hoistdep.mjs +5 -5
  161. 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
- // @ts-ignore
25
- // await import('katex/dist/katex.min.css')
26
- await import('katex/dist/contrib/copy-tex.mjs')
27
-
28
- // 懒加载背景图
29
- const lazyBg = new IntersectionObserver(function (entries, observer) {
30
- entries.forEach(entry => {
31
- if (entry.isIntersecting) {
32
- const el = entry.target as HTMLElement
33
- el.style.backgroundImage = `url("${el.getAttribute('data-background-image')}")`
34
- el.removeAttribute('data-background-image')
35
- observer.unobserve(el)
36
- }
37
- })
38
- }, {
39
- root: null,
40
- threshold: 0.2
41
- })
42
- document.querySelectorAll('[data-background-image]').forEach(el => {
43
- lazyBg.observe(el)
44
- })
45
-
46
- setOriginTitle(document.title)
47
-
48
- resizeHandle()
49
-
50
- menuActive()
51
-
52
- sideBarTab()
53
- sidebarTOC()
54
-
55
- const pagePost = await import('../page/post')
56
- await pagePost.postBeauty()
57
-
58
- const cpel = document.getElementById('copyright')
59
- if (cpel) {
60
- const comment = new IntersectionObserver((entries) => {
61
- entries.forEach((entry) => {
62
- if (entry.isIntersecting) {
63
- if (__shokax_waline__) {
64
- import('../components/comments').then(({walinePageview, walineComment}) => {
65
- walinePageview()
66
- walineComment()
67
- })
68
- }
69
- if (__shokax_twikoo__) {
70
- import('../components/tcomments').then(({twikooComment}) => {
71
- twikooComment()
72
- })
73
- }
74
- comment.disconnect()
75
- }
76
- })
77
- }, {
78
- root: null,
79
- threshold: 0.2
80
- })
81
-
82
- comment.observe(cpel)
83
- }
84
-
85
- if (__shokax_waline__) {
86
- import('../components/comments').then(async ({walineRecentComments}) => {
87
- await walineRecentComments()
88
- })
89
- }
90
-
91
- if (__shokax_twikoo__) {
92
- import('../components/tcomments').then(async ({twikooRecentComments}) => {
93
- await twikooRecentComments()
94
- })
95
- }
96
-
97
- if (__shokax_tabs__) {
98
- tabFormat()
99
- }
100
-
101
- if (sessionStorage.getItem('loaded') === 'true') {
102
- Loader.hide(30)
103
- } else {
104
- sessionStorage.setItem('loaded', 'true')
105
- Loader.hide(500)
106
- }
107
-
108
- setTimeout(() => {
109
- positionInit()
110
- }, 500)
111
-
112
- cardActive()
113
-
114
- if (__shokax_outime__ && LOCAL.ispost) {
115
- isOutime()
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 (__shokax_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
- }
49
-
50
- if (__shokax_fireworks__) {
51
- import('mouse-firework').then((firework) => {
52
- firework.default(CONFIG.fireworks)
53
- })
54
- }
55
-
56
- window.addEventListener('scroll', scrollHandle, {
57
- passive: true
58
- })
59
-
60
- window.addEventListener('resize', resizeHandle, {
61
- passive: true
62
- })
63
-
64
- window.addEventListener('visibilitychange', () => {
65
- pagePosition()
66
- })
67
- await siteRefresh(1)
68
- // TODO 修复内页跳转后重复出现加载动画的问题
69
- }
70
-
71
- cloudflareInit()
72
-
73
- if (__shokax_antiFakeWebsite__) {
74
- if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
75
- window.location.href = CONFIG.hostname
76
- /*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
77
- alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
78
- }
79
- }
80
-
81
- window.addEventListener('DOMContentLoaded', siteInit, {
82
- passive: true
83
- })
84
-
85
- 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;')
86
-
87
- if (new Date().getDate() === 5 && new Date().getMonth() === 8) {
88
- console.log('🎉 ShokaX 生日快乐!\nHappy Birthday ShokaX!')
89
- console.log('感谢你们的支持与陪伴!\nThanks for your support and company!')
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
+ }
@@ -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=&quot;dark&quot;]", "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=&quot;dark&quot;]", "shokax")
14
14
  }
@@ -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
+
@@ -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}`);
@@ -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.')