hexo-theme-shokax 0.3.13 → 0.4.0-alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/_config.yml +16 -9
  2. package/layout/_mixin/comment.pug +4 -4
  3. package/layout/_partials/footer.pug +1 -1
  4. package/layout/_partials/head/head.pug +7 -1
  5. package/layout/_partials/header.pug +1 -1
  6. package/layout/_partials/layout.pug +0 -10
  7. package/layout/_partials/post/footer.pug +1 -2
  8. package/package.json +10 -5
  9. package/scripts/generaters/archive.js +1 -1
  10. package/scripts/generaters/script.js +64 -42
  11. package/scripts/helpers/asset.js +1 -1
  12. package/scripts/helpers/list_categories.js +0 -4
  13. package/scripts/plugin/lib/injects.js +1 -1
  14. package/source/js/_app/components/comments.ts +33 -0
  15. package/source/js/_app/components/sidebar.ts +239 -0
  16. package/source/js/_app/globals/globalVars.ts +99 -0
  17. package/source/js/_app/globals/handles.ts +123 -0
  18. package/source/js/_app/globals/themeColor.ts +64 -0
  19. package/source/js/_app/globals/thirdparty.ts +63 -0
  20. package/source/js/_app/globals/tools.ts +75 -0
  21. package/source/js/_app/library/anime.ts +110 -0
  22. package/source/js/_app/library/declare.d.ts +126 -0
  23. package/source/js/_app/library/dom.ts +26 -0
  24. package/source/js/_app/library/loadFile.ts +43 -0
  25. package/source/js/_app/library/proto.ts +141 -0
  26. package/source/js/_app/library/scriptPjax.ts +72 -0
  27. package/source/js/_app/library/storage.ts +12 -0
  28. package/source/js/_app/library/vue.ts +50 -0
  29. package/source/js/_app/page/common.ts +42 -0
  30. package/source/js/_app/page/fancybox.ts +71 -0
  31. package/source/js/_app/page/post.ts +266 -0
  32. package/source/js/_app/page/search.ts +135 -0
  33. package/source/js/_app/page/tab.ts +60 -0
  34. package/source/js/_app/pjax/domInit.ts +96 -0
  35. package/source/js/_app/pjax/refresh.ts +78 -0
  36. package/source/js/_app/pjax/siteInit.ts +72 -0
  37. package/source/js/_app/player.ts +799 -0
  38. package/source/assets/beian.webp +0 -0
  39. package/source/js/_app/components/sidebar.js +0 -209
  40. package/source/js/_app/fireworks.js +0 -10
  41. package/source/js/_app/globals/globalVars.js +0 -80
  42. package/source/js/_app/globals/handles.js +0 -98
  43. package/source/js/_app/globals/themeColor.js +0 -62
  44. package/source/js/_app/globals/thirdparty.js +0 -62
  45. package/source/js/_app/globals/tools.js +0 -66
  46. package/source/js/_app/library/anime.js +0 -106
  47. package/source/js/_app/library/dom.js +0 -34
  48. package/source/js/_app/library/loadFile.js +0 -36
  49. package/source/js/_app/library/proto.js +0 -163
  50. package/source/js/_app/library/scriptPjax.js +0 -70
  51. package/source/js/_app/library/storage.js +0 -12
  52. package/source/js/_app/library/vue.js +0 -53
  53. package/source/js/_app/page/comment.js +0 -23
  54. package/source/js/_app/page/common.js +0 -41
  55. package/source/js/_app/page/fancybox.js +0 -65
  56. package/source/js/_app/page/post.js +0 -244
  57. package/source/js/_app/page/search.js +0 -118
  58. package/source/js/_app/page/tab.js +0 -53
  59. package/source/js/_app/pjax/domInit.js +0 -76
  60. package/source/js/_app/pjax/refresh.js +0 -52
  61. package/source/js/_app/pjax/siteInit.js +0 -51
  62. package/source/js/_app/player.js +0 -771
@@ -0,0 +1,72 @@
1
+ import domInit from './domInit'
2
+ import { pjaxReload, siteRefresh } from './refresh'
3
+ import { cloudflareInit } from '../library/scriptPjax'
4
+ import { CONFIG, pjax, setPjax } 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 Pjax from 'theme-shokax-pjax'
9
+ import { initVue } from '../library/vue'
10
+ import { lazyLoad } from 'unlazy'
11
+
12
+ const siteInit = () => {
13
+ initVue()
14
+ domInit()
15
+
16
+ setPjax(new Pjax({
17
+ selectors: [
18
+ 'head title',
19
+ '.languages',
20
+ '.twikoo',
21
+ '.pjax',
22
+ '.leancloud-recent-comment',
23
+ 'script[data-config]'
24
+ ],
25
+ cacheBust: false
26
+ }))
27
+
28
+ CONFIG.quicklink.ignores = LOCAL.ignores
29
+ import('quicklink').then(({ listen }) => {
30
+ listen(CONFIG.quicklink)
31
+ })
32
+
33
+ autoDarkmode()
34
+
35
+ if (__shokax_VL__) {
36
+ visibilityListener()
37
+ }
38
+ themeColorListener()
39
+ if (__shokax_search__) {
40
+ import('../page/search').then(({ algoliaSearch }) => {
41
+ algoliaSearch(pjax)
42
+ })
43
+ }
44
+
45
+ if (__shokax_fireworks__) {
46
+ import('mouse-firework').then((firework) => {
47
+ firework.default(CONFIG.fireworks)
48
+ })
49
+ }
50
+ lazyLoad()
51
+
52
+ window.addEventListener('scroll', scrollHandle)
53
+
54
+ window.addEventListener('resize', resizeHandle)
55
+
56
+ window.addEventListener('pjax:send', pjaxReload)
57
+
58
+ window.addEventListener('pjax:success', siteRefresh) // 默认会传入一个event参数
59
+
60
+ window.addEventListener('beforeunload', () => {
61
+ pagePosition()
62
+ })
63
+ siteRefresh(1)
64
+ }
65
+
66
+ cloudflareInit()
67
+
68
+ window.addEventListener('DOMContentLoaded', siteInit, {
69
+ passive: true
70
+ })
71
+
72
+ 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;')