hexo-theme-shokax 0.5.1 → 0.5.2-hotfix.2

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 (165) 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 -68
  6. package/UsageRestrictions.md +25 -25
  7. package/_config.yml +352 -350
  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 +137 -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 +13 -12
  50. package/scripts/generaters/images.js +11 -13
  51. package/scripts/generaters/script.js +3 -1
  52. package/scripts/plugin/check.js +48 -10
  53. package/scripts/plugin/index.js +2 -2
  54. package/source/assets/algolia_logo.svg +9 -9
  55. package/source/assets/logo.svg +16 -16
  56. package/source/css/_colors.styl +207 -207
  57. package/source/css/_common/components/components.styl +5 -6
  58. package/source/css/_common/components/pages/collapse.styl +119 -119
  59. package/source/css/_common/components/pages/home.styl +391 -391
  60. package/source/css/_common/components/pages/pages.styl +56 -56
  61. package/source/css/_common/components/pages/tag-cloud.styl +12 -12
  62. package/source/css/_common/components/post/breadcrumb.styl +39 -39
  63. package/source/css/_common/components/post/copyright.styl +41 -41
  64. package/source/css/_common/components/post/expand.styl +263 -263
  65. package/source/css/_common/components/post/footer.styl +11 -11
  66. package/source/css/_common/components/post/header.styl +79 -79
  67. package/source/css/_common/components/post/nav.styl +64 -64
  68. package/source/css/_common/components/post/post.styl +29 -29
  69. package/source/css/_common/components/post/reward.styl +50 -50
  70. package/source/css/_common/components/post/rtl.styl +12 -12
  71. package/source/css/_common/components/post/tags.styl +39 -39
  72. package/source/css/_common/components/tags/collapse.styl +72 -72
  73. package/source/css/_common/components/tags/container.styl +49 -49
  74. package/source/css/_common/components/tags/label.styl +12 -12
  75. package/source/css/_common/components/tags/links.styl +77 -77
  76. package/source/css/_common/components/tags/list.styl +131 -131
  77. package/source/css/_common/components/tags/note.styl +70 -70
  78. package/source/css/_common/components/tags/player.styl +361 -361
  79. package/source/css/_common/components/tags/quiz.styl +200 -200
  80. package/source/css/_common/components/tags/tabs.styl +89 -89
  81. package/source/css/_common/components/tags/tags.styl +9 -9
  82. package/source/css/_common/components/third-party/loading.styl +222 -222
  83. package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
  84. package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
  85. package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
  86. package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
  87. package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
  88. package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
  89. package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
  90. package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
  91. package/source/css/_common/components/third-party/pace.styl +18 -18
  92. package/source/css/_common/components/third-party/search.styl +167 -167
  93. package/source/css/_common/components/third-party/theme.styl +151 -151
  94. package/source/css/_common/components/third-party/third-party.styl +22 -22
  95. package/source/css/_common/components/third-party/widgets.styl +57 -57
  96. package/source/css/_common/outline/footer/footer.styl +67 -67
  97. package/source/css/_common/outline/header/brand.styl +77 -77
  98. package/source/css/_common/outline/header/header.styl +20 -20
  99. package/source/css/_common/outline/header/image.styl +85 -85
  100. package/source/css/_common/outline/header/menu.styl +117 -117
  101. package/source/css/_common/outline/header/nav.styl +81 -81
  102. package/source/css/_common/outline/header/right.styl +15 -15
  103. package/source/css/_common/outline/header/tool.styl +207 -207
  104. package/source/css/_common/outline/header/waves.styl +57 -57
  105. package/source/css/_common/outline/mobile.styl +46 -46
  106. package/source/css/_common/outline/outline.styl +78 -78
  107. package/source/css/_common/outline/sidebar/author.styl +59 -59
  108. package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
  109. package/source/css/_common/outline/sidebar/menu.styl +63 -63
  110. package/source/css/_common/outline/sidebar/quick.styl +43 -43
  111. package/source/css/_common/outline/sidebar/related.styl +56 -56
  112. package/source/css/_common/outline/sidebar/sidebar.styl +82 -82
  113. package/source/css/_common/outline/sidebar/social.styl +69 -69
  114. package/source/css/_common/outline/sidebar/state.styl +37 -37
  115. package/source/css/_common/outline/sidebar/tab.styl +71 -71
  116. package/source/css/_common/outline/sidebar/toc.styl +47 -47
  117. package/source/css/_common/scaffolding/animate.styl +322 -322
  118. package/source/css/_common/scaffolding/base.styl +192 -190
  119. package/source/css/_common/scaffolding/buttons.styl +48 -48
  120. package/source/css/_common/scaffolding/divider.styl +36 -36
  121. package/source/css/_common/scaffolding/iconfont.styl +443 -443
  122. package/source/css/_common/scaffolding/normalize.styl +273 -273
  123. package/source/css/_common/scaffolding/pagination.styl +81 -81
  124. package/source/css/_common/scaffolding/ribbon.styl +38 -38
  125. package/source/css/_common/scaffolding/scaffolding.styl +14 -14
  126. package/source/css/_common/scaffolding/scrollbar.styl +37 -37
  127. package/source/css/_common/scaffolding/tables.styl +50 -50
  128. package/source/css/_common/scaffolding/tip.styl +19 -19
  129. package/source/css/_common/scaffolding/toggles.styl +59 -59
  130. package/source/css/_iconfont.styl +455 -455
  131. package/source/css/_mixins.styl +148 -148
  132. package/source/css/_variables.styl +89 -89
  133. package/source/css/app.styl +25 -25
  134. package/source/css/mermaid.styl +5 -5
  135. package/source/css/page.styl +2 -2
  136. package/source/css/post.styl +5 -5
  137. package/source/css/scaffolding.styl +4 -4
  138. package/source/js/_app/components/cloudflare.ts +18 -18
  139. package/source/js/_app/components/comments.ts +88 -86
  140. package/source/js/_app/components/sidebar.ts +243 -243
  141. package/source/js/_app/components/tcomments.ts +53 -53
  142. package/source/js/_app/globals/globalVars.ts +84 -84
  143. package/source/js/_app/globals/handles.ts +124 -124
  144. package/source/js/_app/globals/themeColor.ts +62 -62
  145. package/source/js/_app/globals/thirdparty.ts +63 -63
  146. package/source/js/_app/globals/tools.ts +73 -73
  147. package/source/js/_app/library/anime.ts +121 -121
  148. package/source/js/_app/library/declare.d.ts +128 -126
  149. package/source/js/_app/library/proto.ts +70 -70
  150. package/source/js/_app/library/vue.ts +49 -49
  151. package/source/js/_app/page/common.ts +41 -41
  152. package/source/js/_app/page/imageviewer.ts +15 -15
  153. package/source/js/_app/page/post.ts +251 -248
  154. package/source/js/_app/page/search.ts +109 -109
  155. package/source/js/_app/page/tab.ts +59 -59
  156. package/source/js/_app/pjax/domInit.ts +102 -102
  157. package/source/js/_app/pjax/refresh.ts +117 -117
  158. package/source/js/_app/pjax/siteInit.ts +90 -90
  159. package/source/js/_app/player.ts +13 -13
  160. package/toolbox/compiler.mjs +49 -53
  161. package/toolbox/dev-version.mjs +14 -14
  162. package/toolbox/hoistdep.mjs +5 -5
  163. package/toolbox/lib.mjs +63 -63
  164. package/source/css/_common/components/highlight/highlight.styl +0 -357
  165. package/source/css/_common/components/highlight/operation.styl +0 -21
@@ -1,117 +1,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
- // @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
- 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
+ // @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,90 +1,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_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_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,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,53 +1,49 @@
1
- /*
2
- ShokaX ToolBox - Compiler
3
- compatibility: ShokaX v0.5.x-dev
4
- */
5
- import fs from 'fs/promises'
6
- import { buildSync } from 'esbuild'
7
- import { glob } from 'glob'
8
- import { build } from 'esbuild'
9
-
10
- const CONFIG = {
11
-
12
- }
13
-
14
- console.log('ShokaX ToolBox - Compiler')
15
- console.log('Start compiling...')
16
-
17
- const entryPoints = await glob('./scripts/**/*.ts');
18
- const jsons = await glob('./scripts/**/*.json');
19
-
20
- console.log('RUN THIS SCRIPT IN YOUR SHOKAX THEME ROOT DIRECTORY!')
21
- console.log('Using esbuild compiler...')
22
-
23
- await build({
24
- entryPoints: entryPoints,
25
- bundle: false,
26
- format: 'cjs',
27
- target: ['esnext'],
28
- platform: 'node',
29
- loader: { '.ts': 'ts' },
30
- outdir: 'scripts'
31
- })
32
-
33
- console.log('deleting ts and json files...')
34
-
35
- await Promise.all(
36
- entryPoints.map(async (entry) => {
37
- await fs.unlink(entry)
38
- })
39
- )
40
-
41
- await Promise.all(
42
- jsons.map(async (entry)=>{
43
- await fs.unlink(entry)
44
- })
45
- )
46
-
47
- console.log('Finished compiling.')
48
-
49
- console.log('Done.')
50
-
51
-
52
-
53
-
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.')