hexo-theme-solitude 1.1.3 → 1.2.1

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 (254) hide show
  1. package/LICENSE +674 -19
  2. package/_config.yml +243 -193
  3. package/languages/en-US.yml +1 -0
  4. package/languages/zh-CN.yml +8 -8
  5. package/layout/404.pug +24 -0
  6. package/layout/archive.pug +11 -0
  7. package/layout/category.pug +16 -0
  8. package/layout/includes/console.pug +42 -0
  9. package/layout/includes/footer.pug +71 -0
  10. package/layout/includes/head/config.pug +79 -0
  11. package/layout/includes/head/pwa.pug +59 -0
  12. package/layout/includes/head.pug +29 -0
  13. package/layout/includes/header.pug +4 -0
  14. package/layout/includes/inject/body.pug +68 -0
  15. package/layout/{partial/compoment/inject/head.ejs → includes/inject/head.pug} +59 -35
  16. package/layout/includes/layout.pug +35 -0
  17. package/layout/{partial/loading.ejs → includes/loading.pug} +19 -17
  18. package/layout/includes/mixins/articleSort.pug +14 -0
  19. package/layout/includes/mixins/pagination.pug +8 -0
  20. package/layout/includes/nav.pug +22 -0
  21. package/layout/includes/page/about.pug +10 -0
  22. package/layout/includes/page/categories.pug +8 -0
  23. package/layout/includes/page/default.pug +2 -0
  24. package/layout/includes/page/echarts.pug +7 -0
  25. package/layout/includes/page/equipment.pug +3 -0
  26. package/layout/includes/page/links.pug +35 -0
  27. package/layout/includes/page/moments.pug +5 -0
  28. package/layout/includes/page/rss.pug +22 -0
  29. package/layout/includes/page/says.pug +20 -0
  30. package/layout/includes/page/tags.pug +8 -0
  31. package/layout/includes/page/tlink.pug +9 -0
  32. package/layout/includes/recent-posts.pug +9 -0
  33. package/layout/includes/sidebar.pug +17 -0
  34. package/layout/includes/widgets/aside/aside.pug +18 -0
  35. package/layout/includes/widgets/aside/asideAllInfo.pug +8 -0
  36. package/layout/includes/widgets/aside/asideArchive.pug +9 -0
  37. package/layout/includes/widgets/aside/asideFlipCard.pug +5 -0
  38. package/layout/includes/widgets/aside/asideHistory.pug +8 -0
  39. package/layout/includes/widgets/aside/asideInfoCard.pug +22 -0
  40. package/layout/includes/widgets/aside/asideNewestPost.pug +16 -0
  41. package/layout/includes/widgets/aside/asidePower.pug +19 -0
  42. package/layout/includes/widgets/aside/asideSwitch.pug +26 -0
  43. package/layout/includes/widgets/aside/asideTag.pug +11 -0
  44. package/layout/includes/widgets/aside/asideToc.pug +5 -0
  45. package/layout/includes/widgets/aside/asideWebInfo.pug +40 -0
  46. package/layout/includes/widgets/aside/asideWelcome.pug +12 -0
  47. package/layout/includes/widgets/home/banner.pug +16 -0
  48. package/layout/includes/widgets/home/bbTimeList.pug +8 -0
  49. package/layout/includes/widgets/home/categoryBar.pug +10 -0
  50. package/layout/includes/widgets/home/categoryGroup.pug +9 -0
  51. package/layout/includes/widgets/home/hometop.pug +9 -0
  52. package/layout/includes/widgets/home/postList.pug +26 -0
  53. package/layout/includes/widgets/home/rencentPost.pug +26 -0
  54. package/layout/includes/widgets/home/topGroup.pug +27 -0
  55. package/layout/includes/widgets/nav/left.pug +10 -0
  56. package/layout/includes/widgets/nav/menu.pug +16 -0
  57. package/layout/includes/widgets/nav/right.pug +23 -0
  58. package/layout/includes/widgets/page/about/authorinfo.pug +12 -0
  59. package/layout/includes/widgets/page/about/award.pug +34 -0
  60. package/layout/includes/widgets/page/about/contentinfo.pug +38 -0
  61. package/layout/includes/widgets/page/about/hobbies.pug +33 -0
  62. package/layout/includes/widgets/page/about/motto.pug +19 -0
  63. package/layout/includes/widgets/page/about/other.pug +61 -0
  64. package/layout/includes/widgets/page/about/personalities.pug +16 -0
  65. package/layout/includes/widgets/page/about/skillsinfo.pug +41 -0
  66. package/layout/includes/widgets/page/banner.pug +14 -0
  67. package/layout/includes/widgets/page/equipment/content.pug +23 -0
  68. package/layout/includes/widgets/page/links/banner.pug +30 -0
  69. package/layout/includes/widgets/page/links/linksCard.pug +18 -0
  70. package/layout/includes/widgets/page/links/linksItem.pug +14 -0
  71. package/layout/includes/widgets/page/moments/angle.pug +24 -0
  72. package/layout/includes/widgets/page/moments/index.pug +18 -0
  73. package/layout/includes/widgets/page/says/saysBottom.pug +11 -0
  74. package/layout/includes/widgets/page/says/saysContent.pug +6 -0
  75. package/layout/includes/widgets/page/says/saysFunction.pug +10 -0
  76. package/layout/includes/widgets/page/says/saysMeta.pug +7 -0
  77. package/layout/includes/widgets/post/award.pug +48 -0
  78. package/layout/includes/widgets/post/copyright.pug +27 -0
  79. package/layout/includes/widgets/post/postMeta.pug +55 -0
  80. package/layout/includes/widgets/post/postNav.pug +25 -0
  81. package/layout/includes/widgets/post/wave.pug +9 -0
  82. package/layout/includes/widgets/randomlink.pug +32 -0
  83. package/layout/includes/widgets/rightside/index.pug +74 -0
  84. package/layout/includes/widgets/third-party/comments/comment.pug +14 -0
  85. package/layout/includes/widgets/third-party/comments/gitalk.pug +0 -0
  86. package/layout/{partial/compoment/third-party/comments/twikoo.ejs → includes/widgets/third-party/comments/twikoo.pug} +8 -9
  87. package/layout/includes/widgets/third-party/comments/valine.pug +0 -0
  88. package/layout/includes/widgets/third-party/music.pug +3 -0
  89. package/layout/includes/widgets/third-party/pjax.pug +30 -0
  90. package/layout/includes/widgets/third-party/search/algolia-search.pug +16 -0
  91. package/layout/includes/widgets/third-party/search/index.pug +7 -0
  92. package/layout/includes/widgets/third-party/search/local-search.pug +15 -0
  93. package/layout/index.pug +20 -0
  94. package/layout/page.pug +32 -0
  95. package/layout/post.pug +43 -0
  96. package/layout/tag.pug +19 -0
  97. package/package.json +4 -4
  98. package/scripts/event/page.js +20 -2
  99. package/scripts/filter/checkThemeConfig.js +0 -1
  100. package/scripts/filter/randomPosts.js +0 -1
  101. package/scripts/helper/{charts.js → echarts.js} +27 -28
  102. package/scripts/helper/stylus.js +23 -0
  103. package/scripts/tags/bvideo.js +1 -36
  104. package/source/css/_comment/index.styl +121 -0
  105. package/source/css/_comment/twikoo.styl +515 -0
  106. package/source/css/_extra/console.styl +354 -0
  107. package/source/css/_extra/rightmenu.styl +83 -0
  108. package/source/css/_global/animation.css +756 -0
  109. package/source/css/_global/function.styl +83 -0
  110. package/source/css/_global/index.styl +120 -0
  111. package/source/css/_global/var.styl +1 -0
  112. package/source/css/_layout/articleSort.styl +199 -0
  113. package/source/css/_layout/base.styl +392 -0
  114. package/source/css/_layout/footer.styl +359 -0
  115. package/source/css/_layout/header.styl +1331 -0
  116. package/source/css/_layout/index.styl +293 -0
  117. package/source/css/_layout/sidebar.styl +226 -0
  118. package/source/css/_mode/index.styl +52 -0
  119. package/source/css/_page/about.styl +944 -0
  120. package/source/css/_page/category.styl +141 -0
  121. package/source/css/_page/equipment.styl +108 -0
  122. package/source/css/_page/error.styl +161 -0
  123. package/source/css/_page/home.styl +58 -0
  124. package/source/css/_page/homeTop.styl +1035 -0
  125. package/source/css/_page/index.styl +22 -0
  126. package/source/css/_page/link.styl +433 -0
  127. package/source/css/_page/moment.styl +186 -0
  128. package/source/css/_page/rss.styl +87 -0
  129. package/source/css/_page/says.styl +353 -0
  130. package/source/css/_page/tag.styl +56 -0
  131. package/source/css/_post/commentBarrage.styl +149 -0
  132. package/source/css/_post/externalTags.styl +694 -0
  133. package/source/css/_post/highlight.styl +96 -0
  134. package/source/css/_post/index.styl +935 -0
  135. package/source/css/_post/pagination.styl +467 -0
  136. package/source/css/_post/postContent.styl +957 -0
  137. package/source/css/_post/relatedPost.styl +160 -0
  138. package/source/css/_post/reward.styl +217 -0
  139. package/source/css/_search/algolia-search.styl +206 -0
  140. package/source/css/_search/local-search.styl +112 -0
  141. package/source/css/_widgets/aside/allinfo.styl +134 -0
  142. package/source/css/_widgets/aside/flip.styl +68 -0
  143. package/source/css/_widgets/aside/history.styl +35 -0
  144. package/source/css/_widgets/aside/index.styl +156 -0
  145. package/source/css/_widgets/aside/info.styl +263 -0
  146. package/source/css/_widgets/aside/newPost.styl +55 -0
  147. package/source/css/_widgets/aside/power.styl +90 -0
  148. package/source/css/_widgets/aside/toc.styl +85 -0
  149. package/source/css/_widgets/aside/welcome.styl +14 -0
  150. package/source/css/_widgets/index.styl +3 -0
  151. package/source/css/index.styl +40 -0
  152. package/source/js/commentBarrage.js +8 -5
  153. package/source/js/extend/console/comment.js +60 -63
  154. package/source/js/extend/covercolor/local.js +1 -1
  155. package/source/js/extend/search/algolia-search.js +104 -111
  156. package/source/js/extend/search/local-search.js +7 -7
  157. package/source/js/main.js +655 -505
  158. package/source/js/utils.js +131 -137
  159. package/layout/404.ejs +0 -34
  160. package/layout/archive.ejs +0 -10
  161. package/layout/category.ejs +0 -18
  162. package/layout/index.ejs +0 -20
  163. package/layout/layout.ejs +0 -30
  164. package/layout/page/about.ejs +0 -15
  165. package/layout/page/categories.ejs +0 -12
  166. package/layout/page/circle.ejs +0 -5
  167. package/layout/page/echarts.ejs +0 -1
  168. package/layout/page/equipment.ejs +0 -2
  169. package/layout/page/links.ejs +0 -46
  170. package/layout/page/page.ejs +0 -3
  171. package/layout/page/rss.ejs +0 -39
  172. package/layout/page/says.ejs +0 -17
  173. package/layout/page/tags.ejs +0 -12
  174. package/layout/page/tlink.ejs +0 -11
  175. package/layout/page.ejs +0 -45
  176. package/layout/partial/body.ejs +0 -7
  177. package/layout/partial/compoment/about/authorinfo.ejs +0 -18
  178. package/layout/partial/compoment/about/award.ejs +0 -59
  179. package/layout/partial/compoment/about/contentinfo.ejs +0 -33
  180. package/layout/partial/compoment/about/hobbies.ejs +0 -53
  181. package/layout/partial/compoment/about/motto.ejs +0 -17
  182. package/layout/partial/compoment/about/other.ejs +0 -76
  183. package/layout/partial/compoment/about/personalities.ejs +0 -11
  184. package/layout/partial/compoment/about/skillsinfo.ejs +0 -62
  185. package/layout/partial/compoment/aside/aside.ejs +0 -28
  186. package/layout/partial/compoment/aside/asideAllInfo.ejs +0 -6
  187. package/layout/partial/compoment/aside/asideArchive.ejs +0 -11
  188. package/layout/partial/compoment/aside/asideFlipCard.ejs +0 -72
  189. package/layout/partial/compoment/aside/asideHistory.ejs +0 -49
  190. package/layout/partial/compoment/aside/asideInfoCard.ejs +0 -39
  191. package/layout/partial/compoment/aside/asideNewestPost.ejs +0 -31
  192. package/layout/partial/compoment/aside/asidePower.ejs +0 -31
  193. package/layout/partial/compoment/aside/asideSwitch.ejs +0 -41
  194. package/layout/partial/compoment/aside/asideTag.ejs +0 -5
  195. package/layout/partial/compoment/aside/asideToc.ejs +0 -11
  196. package/layout/partial/compoment/aside/asideWebInfo.ejs +0 -60
  197. package/layout/partial/compoment/aside/asideWelcome.ejs +0 -33
  198. package/layout/partial/compoment/circle/angle.ejs +0 -26
  199. package/layout/partial/compoment/circle/banner.ejs +0 -11
  200. package/layout/partial/compoment/circle/content.ejs +0 -19
  201. package/layout/partial/compoment/dorakika/rightmenu.ejs +0 -100
  202. package/layout/partial/compoment/equipment/list.ejs +0 -37
  203. package/layout/partial/compoment/home/homeCategoryBar.ejs +0 -11
  204. package/layout/partial/compoment/home/postList.ejs +0 -37
  205. package/layout/partial/compoment/hometop/bbTimeList.ejs +0 -15
  206. package/layout/partial/compoment/hometop/categoryGroup.ejs +0 -19
  207. package/layout/partial/compoment/hometop/groupTag.ejs +0 -30
  208. package/layout/partial/compoment/hometop/topGroup.ejs +0 -41
  209. package/layout/partial/compoment/inject/body.ejs +0 -70
  210. package/layout/partial/compoment/links/angle.ejs +0 -26
  211. package/layout/partial/compoment/links/banner.ejs +0 -42
  212. package/layout/partial/compoment/links/linksCard.ejs +0 -27
  213. package/layout/partial/compoment/links/linksItem.ejs +0 -21
  214. package/layout/partial/compoment/mixins/articleSort.ejs +0 -26
  215. package/layout/partial/compoment/mixins/pagination.ejs +0 -11
  216. package/layout/partial/compoment/nav/left.ejs +0 -22
  217. package/layout/partial/compoment/nav/menu.ejs +0 -25
  218. package/layout/partial/compoment/nav/right.ejs +0 -42
  219. package/layout/partial/compoment/post/award.ejs +0 -60
  220. package/layout/partial/compoment/post/copyright.ejs +0 -39
  221. package/layout/partial/compoment/post/postMeta.ejs +0 -85
  222. package/layout/partial/compoment/post/postNav.ejs +0 -41
  223. package/layout/partial/compoment/post/wave.ejs +0 -14
  224. package/layout/partial/compoment/says/banner.ejs +0 -10
  225. package/layout/partial/compoment/says/saysBottom.ejs +0 -18
  226. package/layout/partial/compoment/says/saysContent.ejs +0 -10
  227. package/layout/partial/compoment/says/saysFunction.ejs +0 -15
  228. package/layout/partial/compoment/third-party/comments/comment.ejs +0 -12
  229. package/layout/partial/compoment/third-party/comments/twikoo_k.ejs +0 -29
  230. package/layout/partial/compoment/third-party/music.ejs +0 -5
  231. package/layout/partial/compoment/third-party/pjax.ejs +0 -31
  232. package/layout/partial/compoment/third-party/search/algolia-search.ejs +0 -20
  233. package/layout/partial/compoment/third-party/search/index.ejs +0 -10
  234. package/layout/partial/compoment/third-party/search/local-search.ejs +0 -22
  235. package/layout/partial/compoment/tlink/banner.ejs +0 -10
  236. package/layout/partial/console.ejs +0 -68
  237. package/layout/partial/footer.ejs +0 -109
  238. package/layout/partial/head.ejs +0 -37
  239. package/layout/partial/header.ejs +0 -6
  240. package/layout/partial/hometop.ejs +0 -15
  241. package/layout/partial/nav.ejs +0 -34
  242. package/layout/partial/pwa.ejs +0 -40
  243. package/layout/partial/sidebar.ejs +0 -31
  244. package/layout/post.ejs +0 -52
  245. package/layout/tag.ejs +0 -19
  246. package/scripts/helper/randomLinks.js +0 -16
  247. package/scripts/helper/themeJsExport.js +0 -79
  248. package/source/css/commentBarrage.css +0 -174
  249. package/source/css/custom.css +0 -901
  250. package/source/css/main.css +0 -16285
  251. package/source/css/search/algolia-search.css +0 -141
  252. package/source/css/search/local-search.css +0 -138
  253. package/source/css/var.css +0 -189
  254. /package/source/js/{rightmenu.js → rightside.js} +0 -0
package/source/js/main.js CHANGED
@@ -1,103 +1,43 @@
1
- function set_fest() {
2
- let date = new Date();
3
- switch ((date.getMonth() + 1).toString() + '.' + date.getDate()) {
4
- case '1.8': // 周总理逝世
5
- case '9.9': // 毛主席逝世
6
- case '7.7': // 七七事变
7
- case '9.18': // 九一八事变
8
- case '12.13': // 南京大屠杀国家公祭日
9
- {
10
- // 创建一个<style>元素
11
- const styleElement = document.createElement('style');
12
- // 定义要添加的CSS样式
13
- const css = `
14
- html {
15
- -webkit-filter: grayscale(100%);
16
- -moz-filter: grayscale(100%);
17
- -ms-filter: grayscale(100%);
18
- -o-filter: grayscale(100%);
19
- filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
20
- _filter: none;
21
- }
22
- `;
23
- // 将CSS样式添加到<style>元素中
24
- styleElement.appendChild(document.createTextNode(css));
25
- // 将<style>元素添加到<head>标签中
26
- document.head.appendChild(styleElement);
27
- }
28
- break;
1
+ const adjustMenu = (change = false) => {
2
+ const $blogName = document.getElementById('site-name')
3
+ let blogNameWidth = $blogName && $blogName.offsetWidth
4
+ const $menusEle = document.querySelector('#menus .menus_items')
5
+ let menusWidth = $menusEle && $menusEle.offsetWidth
6
+ const $searchEle = document.querySelector('#search-button')
7
+ let searchWidth = $searchEle && $searchEle.offsetWidth
8
+ if (change) {
9
+ blogNameWidth = $blogName && $blogName.offsetWidth
10
+ menusWidth = $menusEle && $menusEle.offsetWidth
11
+ searchWidth = $searchEle && $searchEle.offsetWidth
29
12
  }
30
- }
13
+ const $nav = document.getElementById('nav')
14
+ let t
15
+ if (window.innerWidth < 768) t = true
16
+ else t = blogNameWidth + menusWidth + searchWidth > $nav.offsetWidth - 120
31
17
 
32
- function setFixed(el) {
33
- if (!el) return
34
- const currentTop = window.scrollY || document.documentElement.scrollTop
35
- if (currentTop > 0) {
36
- el.classList.add('nav-fixed')
18
+ if (t) {
19
+ $nav.classList.add('hide-menu')
37
20
  } else {
38
- el.classList.remove('nav-fixed')
21
+ $nav.classList.remove('hide-menu')
39
22
  }
40
23
  }
41
24
 
42
- function getTimeState() {
43
- var e = (new Date).getHours()
44
- , t = "";
45
- e >= 0 && e <= 5 ? t = "睡个好觉,保证精力充沛" : e > 5 && e <= 10 ? t = "一日之计在于晨" : e > 10 && e <= 14 ? t = "吃饱了才有力气干活" : e > 14 && e <= 18 ? t = "集中精力,攻克难关" : e > 18 && e <= 24 && (t = "不要太劳累了,早睡更健康")
46
- return t;
47
- }
48
-
49
- const scrollFn = function () {
50
- const innerHeight = window.innerHeight + 0
51
- const $header = document.getElementById('page-header')
52
- setFixed($header)
53
- if (document.body.scrollHeight <= innerHeight) {
54
- return
55
- }
56
- let initTop = 0
57
- window.addEventListener('scroll', utils.throttle(function (e) {
58
- const currentTop = window.scrollY || document.documentElement.scrollTop
59
- const isDown = scrollDirection(currentTop)
60
- if (currentTop > 0) {
61
- if (isDown) {
62
- if ($header.classList.contains('nav-visible')) $header.classList.remove(
63
- 'nav-visible')
64
- } else {
65
- if (!$header.classList.contains('nav-visible')) $header.classList.add(
66
- 'nav-visible')
67
- }
68
- $header.classList.add('nav-fixed')
69
- } else {
70
- if (currentTop === 0) {
71
- $header.classList.remove('nav-fixed', 'nav-visible')
72
- }
73
- }
74
- percent()
75
- }, 200))
76
-
77
- function scrollDirection(currentTop) {
78
- const result = currentTop > initTop
79
- initTop = currentTop
80
- return result
81
- }
25
+ // 初始化header
26
+ const initAdjust = () => {
27
+ adjustMenu()
28
+ document.getElementById('nav').classList.add('show')
82
29
  }
83
30
 
84
31
  /**
85
- * 滾動處理
32
+ * side menu
86
33
  */
87
-
88
34
  const sidebarFn = () => {
89
35
  const $toggleMenu = document.getElementById('toggle-menu')
90
36
  const $mobileSidebarMenus = document.getElementById('sidebar-menus')
91
37
  const $menuMask = document.getElementById('menu-mask')
92
- const $cookies_window = document.getElementById('cookies-window')
93
- const $header = document.getElementById('page-header')
94
38
  const $body = document.body
95
39
 
96
- if (!$toggleMenu) return
97
-
98
- let initTop = 0
99
- const isChatBtnHide = typeof chatBtnHide === 'function'
100
- const isChatBtnShow = typeof chatBtnShow === 'function'
40
+ const isOpen = () => $mobileSidebarMenus.classList.contains('open')
101
41
 
102
42
  function openMobileSidebar() {
103
43
  utils.sidebarPaddingR()
@@ -115,86 +55,108 @@ const sidebarFn = () => {
115
55
 
116
56
  $toggleMenu.addEventListener('click', openMobileSidebar)
117
57
 
118
- $menuMask.addEventListener('click', e => {
119
- if ($mobileSidebarMenus.classList.contains('open')) {
58
+ $menuMask.addEventListener('click', () => {
59
+ if (isOpen()) {
120
60
  closeMobileSidebar()
121
61
  }
122
62
  })
123
63
 
124
- window.addEventListener('resize', e => {
125
- if ($mobileSidebarMenus.classList.contains('open')) closeMobileSidebar()
64
+ window.addEventListener('resize', () => {
65
+ if (utils.isHidden($toggleMenu) && isOpen()) {
66
+ closeMobileSidebar()
67
+ }
126
68
  })
127
- window.addEventListener('scroll', e => {
128
- const currentTop = window.scrollY || document.documentElement.scrollTop
129
- const isDown = scrollDirection(currentTop)
69
+ }
70
+
71
+ /**
72
+ * 滚动处理
73
+ */
74
+ const scrollFn = function () {
75
+ const innerHeight = window.innerHeight;
76
+ const $header = document.getElementById('page-header');
77
+ if (!$header || document.body.scrollHeight <= innerHeight) return;
78
+
79
+ let initTop = 0;
80
+ window.addEventListener('scroll', utils.throttle(function (e) {
81
+ const currentTop = window.scrollY || document.documentElement.scrollTop;
82
+ const isDown = scrollDirection(currentTop);
83
+
130
84
  if (currentTop > 0) {
85
+ $header.classList.add('nav-fixed');
131
86
  if (isDown) {
132
- if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible')
133
- if (isChatBtnShow && isChatShow === true) {
134
- chatBtnHide()
135
- isChatShow = false
136
- }
87
+ if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible');
137
88
  } else {
138
- if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible')
139
- if (isChatBtnHide && isChatShow === false) {
140
- chatBtnShow()
141
- isChatShow = true
142
- }
89
+ if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible');
143
90
  }
144
- $header.classList.add('nav-fixed')
145
- $cookies_window.classList.add('cw-hide')
146
91
  } else {
147
- if (currentTop === 0) {
148
- $header.classList.remove('nav-fixed', 'nav-visible')
149
- }
92
+ $header.classList.remove('nav-fixed', 'nav-visible');
150
93
  }
151
- }, 200)
94
+ percent();
95
+ }, 200));
152
96
 
153
- // find the scroll direction
154
97
  function scrollDirection(currentTop) {
155
- const result = currentTop > initTop // true is down & false is up
156
- initTop = currentTop
157
- return result
98
+ const result = currentTop > initTop;
99
+ initTop = currentTop;
100
+ return result;
158
101
  }
159
102
  }
160
103
 
161
- const showTodayCard = () => {
162
- const el = document.getElementById('todayCard')
163
- if (el) {
164
- document.getElementsByClassName('topGroup')[0].addEventListener('mouseleave', () => {
165
- if (el.classList.contains('hide')) {
166
- el.classList.remove('hide')
167
- }
104
+ /**
105
+ * 滑动导航栏数字变化
106
+ */
107
+ const percent = () => {
108
+ let scrollTop = document.documentElement.scrollTop || window.pageYOffset
109
+ let totalHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight
110
+ let scrollPercent = Math.round(scrollTop / totalHeight * 100)
111
+ let percentElement = document.querySelector("#percent")
112
+ let viewportBottom = window.scrollY + document.documentElement.clientHeight
113
+ let remainingScroll = totalHeight - scrollTop
114
+
115
+ if ((document.getElementById("post-comment") || document.getElementById("footer")).offsetTop < viewportBottom || scrollPercent > 90) {
116
+ document.querySelector("#nav-totop").classList.add("long")
117
+ percentElement.innerHTML = "返回顶部"
118
+ } else {
119
+ document.querySelector("#nav-totop").classList.remove("long")
120
+ if (scrollPercent >= 0) {
121
+ percentElement.innerHTML = scrollPercent
122
+ }
123
+ }
124
+
125
+ let elementsToHide = document.querySelectorAll(".needEndHide")
126
+ if (remainingScroll < 100) {
127
+ elementsToHide.forEach(function (element) {
128
+ element.classList.add("hide")
129
+ })
130
+ } else {
131
+ elementsToHide.forEach(function (element) {
132
+ element.classList.remove("hide")
168
133
  })
169
134
  }
135
+
136
+ window.onscroll = percent
170
137
  }
171
138
 
172
- const setTimeState = () => {
173
- const el = document.getElementById('author-info__sayhi')
174
- if (el) {
175
- const timeNow = new Date(), hours = timeNow.getHours(), lang = GLOBALCONFIG.lang.sayhello;
176
- let text = '';
177
- if (hours >= 0 && hours <= 5) {
178
- text = lang.goodnight;
179
- } else if (hours > 5 && hours <= 10) {
180
- text = lang.morning;
181
- } else if (hours > 10 && hours <= 14) {
182
- text = lang.noon;
183
- } else if (hours > 14 && hours <= 18) {
184
- text = lang.afternoon;
185
- } else if (hours > 18 && hours <= 24) {
186
- text = lang.night;
187
- }
188
- el.innerText = text + lang.iam;
139
+
140
+ const showTodayCard = () => {
141
+ const el = document.getElementById('todayCard')
142
+ const topGroup = document.getElementsByClassName('topGroup')[0]
143
+
144
+ if (el && topGroup) {
145
+ topGroup.addEventListener('mouseleave', () => {
146
+ el.classList.remove('hide')
147
+ })
189
148
  }
190
- };
149
+ }
191
150
 
192
- const chageTimeFormate = () => {
193
- const timeElements = document.getElementsByTagName("time"), lang = GLOBALCONFIG.lang.time
194
- for (var i = 0; i < timeElements.length; i++) {
151
+ /**
152
+ * 修改时间格式
153
+ */
154
+ const changeTimeFormat = () => {
155
+ const timeElements = document.getElementsByTagName("time"), lang = GLOBAL_CONFIG.lang.time
156
+ for (let i = 0; i < timeElements.length; i++) {
195
157
  const datetime = timeElements[i].getAttribute("datetime"), timeObj = new Date(datetime),
196
158
  daysDiff = utils.timeDiff(timeObj, new Date())
197
- var timeString;
159
+ let timeString;
198
160
  if (daysDiff === 0) {
199
161
  timeString = lang.recent;
200
162
  } else if (daysDiff === 1) {
@@ -218,49 +180,24 @@ const chageTimeFormate = () => {
218
180
  * 文章页右下角下一篇
219
181
  */
220
182
  const initObserver = () => {
221
- let e = document.getElementById("post-comment");
222
- let t = document.getElementById("pagination");
183
+ let commentElement = document.getElementById("post-comment");
184
+ let paginationElement = document.getElementById("pagination");
223
185
 
224
186
  function handleIntersection(entries) {
225
187
  entries.forEach(function (entry) {
226
188
  if (entry.isIntersecting) {
227
- t.classList.add("show-window");
189
+ paginationElement.classList.add("show-window");
228
190
  document.querySelector(".comment-barrage").style.bottom = "-200px";
229
191
  } else {
230
- t.classList.remove("show-window");
192
+ paginationElement.classList.remove("show-window");
231
193
  document.querySelector(".comment-barrage").style.bottom = "0px";
232
194
  }
233
195
  });
234
196
  }
235
197
 
236
- if (e && t) {
198
+ if (commentElement && paginationElement) {
237
199
  let observer = new IntersectionObserver(handleIntersection);
238
- observer.observe(e);
239
- }
240
- }
241
-
242
- const percent = () => {
243
- let a = document.documentElement.scrollTop || window.pageYOffset,
244
- b = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight, // 整个网页高度
245
- result = Math.round(a / b * 100),
246
- btn = document.querySelector("#percent");
247
- const visibleBottom = window.scrollY + document.documentElement.clientHeight;
248
- const eventlistner = document.getElementById('post-tools') || document.getElementById('footer');
249
- const centerY = eventlistner.offsetTop + (eventlistner.offsetHeight / 2);
250
- if ((centerY > visibleBottom) || (result > 90)) {
251
- document.querySelector("#nav-totop").classList.add("long");
252
- btn.innerHTML = GLOBALCONFIG.lang.backtop;
253
- document.querySelectorAll(".needEndHide").forEach(item => {
254
- item.classList.add("hide")
255
- })
256
- } else {
257
- document.querySelector("#nav-totop").classList.remove("long");
258
- if (result >= 0) {
259
- btn.innerHTML = result;
260
- document.querySelectorAll(".needEndHide").forEach(item => {
261
- item.classList.remove("hide")
262
- })
263
- }
200
+ observer.observe(commentElement);
264
201
  }
265
202
  }
266
203
 
@@ -286,8 +223,7 @@ class toc {
286
223
  const $tocContent = document.getElementById('toc-content')
287
224
  const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6')
288
225
  let detectItem = ''
289
-
290
- function autoScroll(el) {
226
+ const autoScroll = (el) => {
291
227
  const activePosition = el.getBoundingClientRect().top
292
228
  const sidebarScrollTop = $tocContent.scrollTop
293
229
  if (activePosition > (document.documentElement.clientHeight - 100)) {
@@ -297,20 +233,16 @@ class toc {
297
233
  $tocContent.scrollTop = sidebarScrollTop - 150
298
234
  }
299
235
  }
300
-
301
- function findHeadPosition(top) {
236
+ const findHeadPosition = (top) => {
302
237
  if (top === 0) {
303
238
  return false
304
239
  }
305
-
306
240
  let currentIndex = ''
307
-
308
- list.forEach(function (ele, index) {
241
+ list.forEach((ele, index) => {
309
242
  if (top > utils.getEleTop(ele) - 80) {
310
243
  currentIndex = index
311
244
  }
312
245
  })
313
-
314
246
  if (detectItem === currentIndex) return
315
247
  detectItem = currentIndex
316
248
  document.querySelectorAll('.toc .active').forEach((i) => {
@@ -318,42 +250,36 @@ class toc {
318
250
  })
319
251
  const activeitem = toc[detectItem]
320
252
  if (activeitem) {
321
- let parent = toc[detectItem].parentNode
322
253
  activeitem.classList.add('active')
323
254
  autoScroll(activeitem)
324
- for (; !parent.matches('.toc'); parent = parent.parentNode) {
255
+ let parent = activeitem.parentNode
256
+ while (!parent.matches('.toc')) {
325
257
  if (parent.matches('li')) parent.classList.add('active')
258
+ parent = parent.parentNode
326
259
  }
327
260
  }
328
261
  }
329
-
330
- window.tocScrollFn = utils.throttle(function () {
262
+ window.tocScrollFn = utils.throttle(() => {
331
263
  const currentTop = window.scrollY || document.documentElement.scrollTop
332
264
  findHeadPosition(currentTop)
333
265
  }, 100)
334
-
335
266
  window.addEventListener('scroll', tocScrollFn)
336
267
  }
337
268
  }
338
269
 
339
270
  let lastSayHello = "";
271
+ let wleelw_musicPlaying = false
340
272
 
341
- class sco {
273
+ let sco = {
342
274
  /**
343
275
  * 个性定位
344
276
  */
345
- static card_welcome() {
346
- /**
347
- * 请求数据
348
- */
277
+ card_welcome: function () {
349
278
  ipLoacation = window.saveToLocal.get('ipLocation');
350
- if (ipLoacation) {
351
- // 使用 ipLocation
352
-
353
- } else {
279
+ if (!ipLoacation) {
354
280
  // 数据已过期或不存在
355
- var script = document.createElement('script');
356
- var url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
281
+ let script = document.createElement('script');
282
+ let url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
357
283
  script.src = url;
358
284
  window.QQmap = function (data) {
359
285
  ipLoacation = data;
@@ -365,95 +291,75 @@ class sco {
365
291
  document.body.appendChild(script);
366
292
  }
367
293
  showWelcome();
368
- }
369
-
294
+ },
370
295
  /**
371
296
  * 那年今日
372
- * @type {*}
373
297
  */
374
- static card_history() {
298
+ card_history: function () {
375
299
  if (document.getElementById('history-container')) {
300
+ async function fetchHistoryData() {
301
+ let myDate = new Date();
302
+ let myMonth = myDate.getMonth() + 1;
303
+ let getDate = myDate.getDate();
304
+ let getMonth = myMonth < 10 ? "0" + myMonth : "" + myMonth;
305
+ let getDay = getDate < 10 ? "0" + getDate : "" + getDate;
306
+ let getMonthDate = "S" + getMonth + getDay;
307
+ let history_data_url = `https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/${getMonth}.json`;
308
+
309
+ let response = await fetch(history_data_url);
310
+ let data = await response.json();
311
+ return data[getMonthDate];
312
+ }
313
+
376
314
  function append(parent, text) {
377
- if (typeof text === 'string') {
378
- let temp = document.createElement('div');
379
- temp.innerHTML = text;
380
- // 防止元素太多 进行提速
381
- let frag = document.createDocumentFragment();
382
- while (temp.firstChild) {
383
- frag.appendChild(temp.firstChild);
384
- }
385
- parent.appendChild(frag);
386
- } else {
387
- parent.appendChild(text);
315
+ let temp = document.createElement('div');
316
+ temp.innerHTML = text;
317
+ let frag = document.createDocumentFragment();
318
+ while (temp.firstChild) {
319
+ frag.appendChild(temp.firstChild);
388
320
  }
321
+ parent.appendChild(frag);
389
322
  }
390
323
 
391
- let history_data = sco.history_get_data()
392
- fetch(history_data[0])
393
- .then(data => data.json())
394
- .then(data => {
395
- let html_item = ''
396
- for (let item of data[history_data[1]]) {
397
- html_item += '<div class="swiper-slide history_slide"><span class="history_slide_time">A.D.' +
398
- item.year + '</span>' + '<span class="history_slide_link">' + item.title + '</span></div>'
399
-
400
- }
401
- var history_container_wrapper = document.getElementById('history_container_wrapper')
402
- append(history_container_wrapper, html_item);
403
- var swiper_history = new Swiper('.history_swiper-container', {
404
- passiveListeners: true,
405
- spaceBetween: 30,
406
- effect: 'coverflow',
407
- coverflowEffect: {
408
- rotate: 30,
409
- slideShadows: false,
410
- },
411
- loop: true,
412
- direction: 'vertical',
413
- autoplay: {
414
- disableOnInteraction: true,
415
- delay: 5000
416
- },
417
-
418
- mousewheel: false,
419
- // autoHeight: true,
420
-
421
- });
422
-
423
- let history_comtainer = document.getElementById('history-container');
424
- history_comtainer.onmouseenter = function () {
425
- swiper_history.autoplay.stop();
426
- };
427
- history_comtainer.onmouseleave = function () {
428
- swiper_history.autoplay.start();
429
- }
430
- })
431
- }
432
- }
433
-
434
- static history_get_data() {
435
- let myDate = new Date();
436
- let myMonth = myDate.getMonth() + 1;
437
- let getMonth;
438
- if (myMonth < 10) {
439
- getMonth = "0" + String(myMonth);
440
- } else {
441
- getMonth = String(myMonth);
442
- }
443
- let getDate = String(myDate.getDate());
444
- if (getDate < 10) {
445
- getDate = "0" + String(getDate);
446
- } else {
447
- getDate = String(getDate);
324
+ fetchHistoryData().then(data => {
325
+ let html_item = data.map(item => `
326
+ <div class="swiper-slide history_slide">
327
+ <span class="history_slide_time">A.D.${item.year}</span>
328
+ <span class="history_slide_link">${item.title}</span>
329
+ </div>
330
+ `).join('');
331
+ let history_container_wrapper = document.getElementById('history_container_wrapper');
332
+ append(history_container_wrapper, html_item);
333
+ let swiper_history = new Swiper('.history_swiper-container', {
334
+ passiveListeners: true,
335
+ spaceBetween: 30,
336
+ effect: 'coverflow',
337
+ coverflowEffect: {
338
+ rotate: 30,
339
+ slideShadows: false,
340
+ },
341
+ loop: true,
342
+ direction: 'vertical',
343
+ autoplay: {
344
+ disableOnInteraction: true,
345
+ delay: 5000
346
+ },
347
+ mousewheel: false,
348
+ });
349
+ let history_container = document.getElementById('history-container');
350
+ history_container.onmouseenter = function () {
351
+ swiper_history.autoplay.stop();
352
+ };
353
+ history_container.onmouseleave = function () {
354
+ swiper_history.autoplay.start();
355
+ }
356
+ });
448
357
  }
449
- let getMonthDate = "S" + getMonth + getDate;
450
- return ["https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/" + getMonth + ".json", getMonthDate]
451
- }
452
-
453
- /*
454
- * 隐藏协议提醒助手
358
+ },
359
+ /**
360
+ * 隐藏协议小助手
455
361
  */
456
- static hideCookie() {
362
+ hideCookie: function () {
457
363
  setTimeout(() => {
458
364
  const cookiesWindow = document.getElementById("cookies-window");
459
365
  if (cookiesWindow) {
@@ -463,29 +369,33 @@ class sco {
463
369
  }, 1000);
464
370
  }
465
371
  }, 3000);
466
- }
467
-
468
- static scrollTo(e) {
469
- const t = document.getElementById(e);
470
- if (t) {
471
- const e = t.getBoundingClientRect().top + window.pageYOffset - 80
472
- , o = window.pageYOffset
473
- , n = e - o;
474
- let a = null;
475
- window.requestAnimationFrame((function e(t) {
476
- a || (a = t);
477
- const l = t - a
478
- , i = (c = Math.min(l / 0, 1)) < .5 ? 2 * c * c : (4 - 2 * c) * c - 1;
479
- var c;
480
- window.scrollTo(0, o + n * i),
481
- l < 600 && window.requestAnimationFrame(e)
482
- }
483
- ))
372
+ },
373
+ /**
374
+ * 平滑滚动处理
375
+ * @param elementId
376
+ */
377
+ scrollTo: function (elementId) {
378
+ const targetElement = document.getElementById(elementId);
379
+ if (targetElement) {
380
+ const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - 80;
381
+ const startPosition = window.pageYOffset;
382
+ const distanceToScroll = targetPosition - startPosition;
383
+ let animationStartTime = null;
384
+ window.requestAnimationFrame((function smoothScroll(currentTime) {
385
+ animationStartTime = animationStartTime || currentTime;
386
+ const elapsedTime = currentTime - animationStartTime;
387
+ const progressRatio = Math.min(elapsedTime / 0, 1);
388
+ const easing = progressRatio < .5 ? 2 * progressRatio * progressRatio : (4 - 2 * progressRatio) * progressRatio - 1;
389
+ window.scrollTo(0, startPosition + distanceToScroll * easing);
390
+ elapsedTime < 600 && window.requestAnimationFrame(smoothScroll);
391
+ }));
484
392
  }
485
- }
486
-
487
- static switchCommentBarrage() {
488
- var commentBarrageElement = document.querySelector(".comment-barrage");
393
+ },
394
+ /**
395
+ * 控制台热评隐藏显示切换
396
+ */
397
+ switchCommentBarrage: function () {
398
+ let commentBarrageElement = document.querySelector(".comment-barrage");
489
399
  if (commentBarrageElement) {
490
400
  if (window.getComputedStyle(commentBarrageElement).display === "flex") {
491
401
  commentBarrageElement.style.display = "none";
@@ -499,77 +409,88 @@ class sco {
499
409
  localStorage.setItem("commentBarrageSwitch", "false");
500
410
  }
501
411
  }
502
- }
503
-
504
- static switchHideAside() {
505
- const e = document.documentElement.classList;
506
- e.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 2) : saveToLocal.set("aside-status", "hide", 2),
507
- e.toggle("hide-aside"),
508
- e.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
509
- }
510
-
511
- static initConsoleState() {
412
+ },
413
+ /**
414
+ * 控制台侧边栏隐藏显示切换
415
+ */
416
+ switchHideAside: function () {
417
+ const htmlClassList = document.documentElement.classList;
418
+ htmlClassList.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 1) : saveToLocal.set("aside-status", "hide", 1)
419
+ htmlClassList.toggle("hide-aside");
420
+ htmlClassList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on");
421
+ },
422
+ initConsoleState: function () {
512
423
  document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
513
- }
514
-
515
- static sayhi() {
516
- document.querySelector("#author-info__sayhi") && (document.getElementById("author-info__sayhi").innerHTML = getTimeState())
517
- }
518
-
519
- static changeSayHelloText() {
520
- const e = ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"]
521
- , t = document.getElementById("author-info__sayhi");
522
- let o = e[Math.floor(Math.random() * e.length)];
523
- for (; o === lastSayHello;)
524
- o = e[Math.floor(Math.random() * e.length)];
525
- t.textContent = o,
526
- lastSayHello = o
527
- }
528
-
529
- static switchDarkMode() {
530
- const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' :
424
+ },
425
+ /**
426
+ * 个人信息顶部
427
+ */
428
+ changeSayHelloText: function () {
429
+ const greetings = ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"];
430
+ const greetingElement = document.getElementById("author-info__sayhi");
431
+ let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
432
+ while (randomGreeting === lastSayHello) {
433
+ randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
434
+ }
435
+ greetingElement.textContent = randomGreeting;
436
+ lastSayHello = randomGreeting;
437
+ },
438
+ /**
439
+ * 昼夜切换
440
+ */
441
+ switchDarkMode: function () {
442
+ let nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' :
531
443
  'light'
532
444
  if (nowMode === 'light') {
533
445
  document.documentElement.setAttribute('data-theme', 'dark')
534
446
  saveToLocal.set('theme', 'dark', 0.04);
535
- utils.snackbarShow(GLOBALCONFIG.lang.theme.dark, false, 2000)
447
+ utils.snackbarShow(GLOBAL_CONFIG.lang.theme.dark, false, 2000)
536
448
  document.querySelector(".menu-darkmode-text").textContent = "深色模式";
537
449
  } else {
538
450
  document.documentElement.setAttribute('data-theme', 'light')
539
451
  saveToLocal.set('theme', 'light', 0.04);
540
- utils.snackbarShow(GLOBALCONFIG.lang.theme.light, false, 2000)
452
+ utils.snackbarShow(GLOBAL_CONFIG.lang.theme.light, false, 2000)
541
453
  document.querySelector(".menu-darkmode-text").textContent = "浅色模式";
542
454
  }
543
- }
544
-
545
- static hideTodayCard() {
455
+ },
456
+ hideTodayCard: function () {
546
457
  document.getElementById('todayCard').classList.add('hide')
547
- }
548
-
549
- static toTop() {
458
+ },
459
+ /**
460
+ * 返回顶部
461
+ */
462
+ toTop: function () {
550
463
  utils.scrollToDest(0)
551
- }
552
-
553
- static showConsole() {
554
- const el = document.getElementById('console')
464
+ },
465
+ /**
466
+ * 显示控制台
467
+ */
468
+ showConsole: function () {
469
+ let el = document.getElementById('console')
555
470
  if (!el.classList.contains('show')) {
556
471
  el.classList.add('show')
557
472
  }
558
- }
559
-
560
- static hideConsole() {
473
+ },
474
+ /**
475
+ * 隐藏控制台
476
+ */
477
+ hideConsole: function () {
561
478
  const el = document.getElementById('console')
562
479
  if (el.classList.contains('show')) {
563
480
  el.classList.remove('show')
564
481
  }
565
- }
566
-
567
- static lightbox(el) {
482
+ },
483
+ /**
484
+ * 灯箱使用
485
+ */
486
+ lightbox: function () {
568
487
  window.ViewImage && window.ViewImage.init("#article-container img:not(.flink-avatar), .bber-content-img img, #album_detail img, #equipment img, #twikoo .tk-content img:not(.tk-owo-emotion)");
569
- }
570
-
571
- static initTheme() {
572
- const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
488
+ },
489
+ /**
490
+ * 初始化
491
+ */
492
+ initTheme: function () {
493
+ let isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
573
494
  try {
574
495
  const cachedMode = saveToLocal.get('theme');
575
496
  if (cachedMode === undefined) {
@@ -587,36 +508,45 @@ class sco {
587
508
  saveToLocal.set('theme', 'light', 0.5)
588
509
  }
589
510
  }
590
- }
591
-
592
- static reflashEssayWaterFall() {
511
+ },
512
+ /**
513
+ *
514
+ */
515
+ reflashEssayWaterFall: function () {
593
516
  if (document.getElementById('waterfall')) {
594
517
  setTimeout(function () {
595
518
  waterfall('#waterfall');
596
519
  document.getElementById("waterfall").classList.add('show');
597
520
  }, 500);
598
521
  }
599
- }
600
-
601
- static addRuntime() {
602
- const el = document.getElementById('runtimeshow')
603
- if (el && GLOBALCONFIG.runtime) {
604
- el.innerText = utils.timeDiff(new Date(GLOBALCONFIG.runtime), new Date()) + GLOBALCONFIG.lang.time.runtime
522
+ },
523
+ /**
524
+ * 更新站点运行时间
525
+ */
526
+ addRuntime: function () {
527
+ let el = document.getElementById('runtimeshow')
528
+ if (el && GLOBAL_CONFIG.runtime) {
529
+ el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.runtime
605
530
  }
606
- }
607
-
608
- static lazyloadImg() {
531
+ },
532
+ /**
533
+ * 懒加载图片
534
+ */
535
+ lazyloadImg: function () {
609
536
  window.lazyLoadInstance = new LazyLoad({
610
537
  elements_selector: 'img',
611
538
  threshold: 0,
612
539
  data_src: 'lazy-src',
613
540
  callback_error: (img) => {
614
- img.setAttribute("src", GLOBALCONFIG.lazyload.error);
541
+ img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
615
542
  }
616
543
  })
617
- }
618
-
619
- static toTalk(txt) {
544
+ },
545
+ /**
546
+ * 跳转到输评论
547
+ * @param txt
548
+ */
549
+ toTalk: function (txt) {
620
550
  const input = document.querySelector('.el-textarea__inner');
621
551
  const evt = new Event('input', {bubbles: true, cancelable: true});
622
552
  const inputValue = txt.replace(/\n/g, '\n> ');
@@ -629,11 +559,13 @@ class sco {
629
559
  if (commentTips) {
630
560
  commentTips.classList.add("show");
631
561
  }
632
- }
633
-
634
- static initbbtalk() {
562
+ },
563
+ /**
564
+ * 初始化即刻mini
565
+ */
566
+ initbbtalk: function () {
635
567
  if (document.querySelector('#bber-talk')) {
636
- var swiper = new Swiper('.swiper-container', {
568
+ let swiper = new Swiper('.swiper-container', {
637
569
  direction: 'vertical',
638
570
  loop: true,
639
571
  autoplay: {
@@ -642,10 +574,12 @@ class sco {
642
574
  },
643
575
  });
644
576
  }
645
- }
646
-
647
- static addPhotoFigcaption() {
648
- const images = document.querySelectorAll('#article-container img');
577
+ },
578
+ /**
579
+ * 图片添加水印
580
+ */
581
+ addPhotoFigcaption: function () {
582
+ let images = document.querySelectorAll('#article-container img');
649
583
  images.forEach((image) => {
650
584
  const imageParent = image.parentNode;
651
585
  const captionText = image.getAttribute('alt');
@@ -658,145 +592,360 @@ class sco {
658
592
  imageParent.insertBefore(captionElement, image.nextSibling);
659
593
  }
660
594
  });
661
- }
662
-
663
- /*
664
- * 图片加水印
595
+ },
596
+ /**
597
+ * 下载图片并添加水印
665
598
  */
666
- static downloadImage(e, t) {
599
+ downloadImage: async function (url, filename) {
667
600
  rm.hideRightMenu();
668
- if (0 == rm.downloadimging) {
669
- rm.downloadimging = !0;
670
- utils.snackbarShow("正在下载中,请稍后", !1, 1e4);
671
- setTimeout((function () {
672
- let o = new Image;
673
- o.setAttribute("crossOrigin", "anonymous");
674
- o.onload = function () {
675
- let e = document.createElement("canvas");
676
- e.width = o.width;
677
- e.height = o.height;
678
- e.getContext("2d").drawImage(o, 0, 0, o.width, o.height);
679
- let n = e.toDataURL("image/png");
680
- let a = document.createElement("a");
681
- let l = new MouseEvent("click");
682
- a.download = t || "photo";
683
- a.href = n;
684
- a.dispatchEvent(l);
685
- };
686
- o.src = e;
687
- utils.snackbarShow("图片已添加盲水印,请遵守版权协议");
688
- rm.downloadimging = !1;
689
- }), "10000");
690
- } else {
601
+ if (rm.downloadimging) {
691
602
  utils.snackbarShow("有正在进行中的下载,请稍后再试");
603
+ return;
692
604
  }
693
- }
694
-
695
-
696
- static musicToggle() {
697
- const $music = document.querySelector('#nav-music'),
698
- $meting = document.querySelector('meting-js'),
699
- $console = document.getElementById('consoleMusic')
605
+ try {
606
+ rm.downloadimging = true;
607
+ utils.snackbarShow("正在下载中,请稍后", false, 10000);
608
+ await new Promise(resolve => setTimeout(resolve, 10000));
609
+ const img = new Image();
610
+ img.setAttribute("crossOrigin", "anonymous");
611
+ img.onload = function () {
612
+ const canvas = document.createElement("canvas");
613
+ const ctx = canvas.getContext("2d");
614
+ canvas.width = img.width;
615
+ canvas.height = img.height;
616
+ ctx.drawImage(img, 0, 0, img.width, img.height);
617
+ ctx.font = "30px Arial";
618
+ ctx.fillText(window.location.href, 10, img.height - 10);
619
+ const dataUrl = canvas.toDataURL("image/png");
620
+ const link = document.createElement("a");
621
+ const event = new MouseEvent("click");
622
+ link.download = filename || "photo";
623
+ link.href = dataUrl;
624
+ link.dispatchEvent(event);
625
+ utils.snackbarShow("图片已添加盲水印,请遵守版权协议");
626
+ rm.downloadimging = false;
627
+ };
628
+ img.src = url;
629
+ } catch (error) {
630
+ console.error(error);
631
+ utils.snackbarShow("下载图片时出错");
632
+ rm.downloadimging = false;
633
+ }
634
+ },
635
+ /**
636
+ * 音乐播放暂停
637
+ */
638
+ musicToggle: function () {
639
+ const $music = document.querySelector('#nav-music');
640
+ const $meting = document.querySelector('meting-js');
641
+ const $console = document.getElementById('consoleMusic');
642
+ const $toggleButton = document.getElementById('menu-music-toggle');
643
+ wleelw_musicPlaying = !wleelw_musicPlaying;
644
+ $music.classList.toggle("playing", wleelw_musicPlaying);
645
+ $console.classList.toggle("on", wleelw_musicPlaying);
700
646
  if (wleelw_musicPlaying) {
701
- $music.classList.remove("playing")
702
- $console.classList.remove("on")
703
- wleelw_musicPlaying = false;
704
- $meting.aplayer.pause();
705
- document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-play-fill"></i><span>播放音乐</span>`
706
- } else {
707
- $music.classList.add("playing")
708
- $console.classList.add("on")
709
- wleelw_musicPlaying = true;
710
647
  $meting.aplayer.play();
711
- document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-pause-fill"></i><span>暂停音乐</span>`
648
+ $toggleButton.innerHTML = `<i class="scoicon sco-pause-fill"></i><span>暂停音乐</span>`;
649
+ } else {
650
+ $meting.aplayer.pause();
651
+ $toggleButton.innerHTML = `<i class="scoicon sco-play-fill"></i><span>播放音乐</span>`;
712
652
  }
713
- rm.hideRightMenu()
714
- }
715
-
716
- static musicSkipBack() {
653
+ rm.hideRightMenu();
654
+ },
655
+ /**
656
+ * 音乐上一首
657
+ */
658
+ musicSkipBack: function () {
717
659
  document.querySelector('meting-js').aplayer.skipBack()
718
660
  rm.hideRightMenu()
719
- }
720
-
721
- static musicSkipForward() {
661
+ },
662
+ /**
663
+ * 音乐下一首
664
+ */
665
+ musicSkipForward: function () {
722
666
  document.querySelector('meting-js').aplayer.skipForward()
723
667
  rm.hideRightMenu()
724
- }
668
+ },
669
+ /**
670
+ * 获取歌曲名称
671
+ */
672
+ musicGetName: function () {
673
+ const titles = Array.from(document.querySelectorAll('.aplayer-title')).map(e => e.innerText);
674
+ return titles[0];
675
+ },
676
+ /**
677
+ * 跳转到评论
678
+ */
679
+ scrollToComment: function () {
680
+ utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
681
+ },
682
+ /**
683
+ * 一些日子灰色页面
684
+ */
685
+ setFest: function () {
686
+ const date = new Date();
687
+ const currentDate = `${date.getMonth() + 1}.${date.getDate()}`;
725
688
 
726
- static musicGetName() {
727
- var e = document.querySelectorAll('.aplayer-title');
728
- var t = [];
729
- for (var o = e.length - 1; o >= 0; o--) {
730
- t[o] = e[o].innerText;
689
+ const specialDates = ['1.8', '9.9', '7.7', '9.18', '12.13'];
690
+
691
+ if (specialDates.includes(currentDate)) {
692
+ const css = `
693
+ html {
694
+ filter: grayscale(100%);
731
695
  }
732
- return t[0];
733
- }
696
+ `;
734
697
 
735
- static scrollToComment() {
736
- utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
698
+ const styleElement = document.createElement('style');
699
+ styleElement.textContent = css;
700
+ document.head.appendChild(styleElement);
701
+ }
702
+ },
703
+ /**
704
+ * 个人信息顶部文字更新
705
+ */
706
+ setTimeState: function () {
707
+ const el = document.getElementById('author-info__sayhi');
708
+ if (el) {
709
+ const timeNow = new Date();
710
+ const hours = timeNow.getHours();
711
+ const lang = GLOBAL_CONFIG.lang.sayhello;
712
+ const greetings = [
713
+ {start: 0, end: 5, text: lang.goodnight},
714
+ {start: 6, end: 10, text: lang.morning},
715
+ {start: 11, end: 14, text: lang.noon},
716
+ {start: 15, end: 18, text: lang.afternoon},
717
+ {start: 19, end: 24, text: lang.night},
718
+ ];
719
+ for (let greeting of greetings) {
720
+ if (hours >= greeting.start && hours <= greeting.end) {
721
+ el.innerText = greeting.text;
722
+ break;
723
+ }
724
+ }
725
+ }
726
+ },
727
+ /**
728
+ * tagPageActive
729
+ */
730
+ tagPageActive: function () {
731
+ const currentPath = window.location.pathname;
732
+ const decodedPath = decodeURIComponent(currentPath);
733
+
734
+ const isTagPage = /\/tags\/.*?\//.test(decodedPath);
735
+ if (isTagPage) {
736
+ const tag = decodedPath.split("/").slice(-2, -1)[0];
737
+
738
+ const tagPageTagsElement = document.getElementById("#tag-page-tags");
739
+ if (tagPageTagsElement) {
740
+ const allLinks = document.querySelectorAll("a");
741
+ allLinks.forEach(link => {
742
+ link.classList.remove("select");
743
+ });
744
+
745
+ const tagElement = document.getElementById(tag);
746
+ if (tagElement) {
747
+ tagElement.classList.add("select");
748
+ }
749
+ }
750
+ }
751
+ },
752
+ /**
753
+ * categoryBarActive
754
+ */
755
+ categoriesBarActive: function () {
756
+ const categoryBar = document.querySelector("#category-bar");
757
+ const currentPath = window.location.pathname;
758
+ const decodedPath = decodeURIComponent(currentPath);
759
+
760
+ if (categoryBar) {
761
+ const categoryBarItems = document.querySelectorAll(".category-bar-item");
762
+ categoryBarItems.forEach(item => {
763
+ item.classList.remove("select");
764
+ });
765
+ }
766
+ if (decodedPath === "/") {
767
+ if (categoryBar) {
768
+ const homeItem = document.getElementById("category-bar-home");
769
+ homeItem.classList.add("select");
770
+ }
771
+ } else {
772
+ if (/\/categories\/.*?\//.test(decodedPath)) {
773
+ let category = decodedPath.split("/").slice(-2, -1)[0];
774
+ category = category.charAt(0).toUpperCase() + category.slice(1);
775
+ if (categoryBar) {
776
+ const categoryItem = document.getElementById(category);
777
+ if (categoryItem) {
778
+ categoryItem.classList.add("select");
779
+ }
780
+ }
781
+ }
782
+ }
783
+ },
784
+ /**
785
+ * categoryBarRightButton
786
+ */
787
+ scrollCategoryBarToRight: function () {
788
+ let timeoutId;
789
+ let scrollBar = document.getElementById("category-bar-items");
790
+ let nextElement = document.getElementById("category-bar-next");
791
+ let scrollBarWidth = scrollBar.clientWidth;
792
+ if (scrollBar) {
793
+ if (scrollBar.scrollLeft + scrollBar.clientWidth >= scrollBar.scrollWidth - 8) {
794
+ scrollBar.scroll({
795
+ left: 0,
796
+ behavior: "smooth"
797
+ });
798
+ } else {
799
+ scrollBar.scrollBy({
800
+ left: scrollBarWidth,
801
+ behavior: "smooth"
802
+ });
803
+ }
804
+ scrollBar.addEventListener("scroll", function onScroll() {
805
+ clearTimeout(timeoutId);
806
+ timeoutId = setTimeout(function () {
807
+ if (scrollBar.scrollLeft + scrollBar.clientWidth >= scrollBar.scrollWidth - 8) {
808
+ nextElement.style.transform = "rotate(180deg)";
809
+ } else {
810
+ nextElement.style.transform = "";
811
+ }
812
+ scrollBar.removeEventListener("scroll", onScroll);
813
+ }, 150);
814
+ });
815
+ }
816
+ },
817
+ /**
818
+ * 打开侧边栏标签隐藏
819
+ */
820
+ openAllTags: function () {
821
+ let tagCloudElements = document.querySelectorAll(".card-allinfo .card-tag-cloud");
822
+ tagCloudElements.forEach(function (tagCloudElement) {
823
+ tagCloudElement.classList.add("all-tags");
824
+ });
825
+ let moreTagsButton = document.getElementById("more-tags-btn");
826
+ if (moreTagsButton) {
827
+ moreTagsButton.parentNode.removeChild(moreTagsButton);
828
+ }
829
+ },
830
+ /**
831
+ * 监听底部分页输入框
832
+ */
833
+ listenToPageInputPress: function () {
834
+ const pageText = document.getElementById("toPageText");
835
+ const pageButton = document.getElementById("toPageButton");
836
+
837
+ if (!pageText) return;
838
+
839
+ const pageNumbers = document.querySelectorAll(".page-number");
840
+ const lastPageNumber = +pageNumbers[pageNumbers.length - 1].textContent;
841
+
842
+ if (lastPageNumber === 1) {
843
+ const toPageGroup = document.querySelector(".toPageGroup");
844
+ if (toPageGroup) toPageGroup.remove();
845
+ }
846
+
847
+ pageText.addEventListener("keydown", (event) => {
848
+ if (event.keyCode === 13) {
849
+ heo.toPage();
850
+ pjax.loadUrl(pageButton.href);
851
+ }
852
+ });
853
+
854
+ pageText.addEventListener("input", () => {
855
+ if (pageText.value === "" || pageText.value === "0") {
856
+ pageButton.classList.remove("haveValue");
857
+ } else {
858
+ pageButton.classList.add("haveValue");
859
+ }
860
+
861
+ const pageNumbers = document.querySelectorAll(".page-number");
862
+ const lastPageNumber = +pageNumbers[pageNumbers.length - 1].textContent;
863
+
864
+ if (+pageText.value > lastPageNumber) {
865
+ pageText.value = lastPageNumber;
866
+ }
867
+ });
868
+ },
869
+ /**
870
+ * 初始化Nav背景
871
+ */
872
+ addNavBackgroundInit: function () {
873
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
874
+ if (scrollTop !== 0) {
875
+ var pageHeader = document.getElementById("page-header");
876
+ if (pageHeader) {
877
+ pageHeader.classList.add("nav-fixed", "nav-visible");
878
+ }
879
+ var cookiesWindow = document.getElementById("cookies-window");
880
+ if (cookiesWindow) {
881
+ cookiesWindow.style.display = 'none';
882
+ }
883
+ }
737
884
  }
738
885
  }
739
886
 
887
+ /*
888
+ * 代码高亮显示
889
+ */
740
890
  class hightlight {
741
891
  static createEle(langEl, item) {
742
- const fragment = document.createDocumentFragment()
743
- const highlightCopyEle = '<i class="scoicon sco-copy-fill"></i>'
744
- const highlightExpandEle = '<i class="scoicon sco-arrow-down expand" style="font-size: 16px"></i>'
745
-
746
- const hlTools = document.createElement('div')
747
- hlTools.className = `highlight-tools`
748
- hlTools.innerHTML = highlightExpandEle + langEl + highlightCopyEle
749
- let expand = true
750
- hlTools.children[0].addEventListener('click', (e) => {
751
- if (expand) {
752
- hlTools.children[0].classList.add('closed')
753
- $table.setAttribute('style', 'display:none')
754
- if ($expand.length !== 0) {
755
- $expand[0].setAttribute('style', 'display:none')
756
- }
757
- } else {
758
- hlTools.children[0].classList.remove('closed')
759
- $table.setAttribute('style', 'display:block')
760
- if ($expand.length !== 0) {
761
- $expand[0].setAttribute('style', 'display:block')
762
- }
763
- if (itemHeight < 200) {
764
- $table.setAttribute('style', 'height: auto')
765
- } else {
766
- $table.setAttribute('style', 'height:200px')
767
- ele.classList.remove("expand-done")
892
+ const fragment = document.createDocumentFragment();
893
+ const highlightCopyEle = '<i class="scoicon sco-copy-fill"></i>';
894
+ const highlightExpandEle = '<i class="scoicon sco-arrow-down expand" style="font-size: 16px"></i>';
895
+
896
+ const hlTools = document.createElement('div');
897
+ hlTools.className = 'highlight-tools';
898
+ hlTools.innerHTML = `${highlightExpandEle}${langEl}${highlightCopyEle}`;
899
+
900
+ const itemHeight = item.clientHeight;
901
+ const $table = item.querySelector('table');
902
+ const $expand = item.getElementsByClassName('code-expand-btn');
903
+
904
+ let expand = true;
905
+ hlTools.children[0].addEventListener('click', () => {
906
+ expand = !expand;
907
+ hlTools.children[0].classList.toggle('closed');
908
+ $table.style.display = expand ? 'none' : 'block';
909
+ if ($expand.length !== 0) {
910
+ $expand[0].style.display = expand ? 'none' : 'block';
911
+ }
912
+ if (!expand) {
913
+ $table.style.height = itemHeight < 200 ? 'auto' : '200px';
914
+ if (itemHeight >= 200) {
915
+ item.classList.remove("expand-done");
768
916
  }
769
917
  }
770
- expand = !expand
771
- })
772
- hlTools.children[2].addEventListener('click', (e) => {
773
- utils.copy($table.querySelector('.code').innerText)
774
- })
775
- const ele = document.createElement('div')
776
- fragment.appendChild(hlTools)
777
- const itemHeight = item.clientHeight, $table = item.querySelector('table'),
778
- $expand = item.getElementsByClassName('code-expand-btn')
779
- if (GLOBALCONFIG.hightlight.limit && itemHeight > GLOBALCONFIG.hightlight.limit + 30) {
780
- $table.setAttribute('style', `height: ${GLOBALCONFIG.hightlight.limit}px`)
781
- ele.className = 'code-expand-btn'
782
- ele.innerHTML = '<i class="scoicon sco-show-line" style="font-size: 1.2rem"></i>'
918
+ });
919
+
920
+ hlTools.children[2].addEventListener('click', () => {
921
+ utils.copy($table.querySelector('.code').innerText);
922
+ });
923
+
924
+ fragment.appendChild(hlTools);
925
+
926
+ if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit + 30) {
927
+ $table.style.height = `${GLOBAL_CONFIG.hightlight.limit}px`;
928
+ const ele = document.createElement('div');
929
+ ele.className = 'code-expand-btn';
930
+ ele.innerHTML = '<i class="scoicon sco-show-line" style="font-size: 1.2rem"></i>';
783
931
  ele.addEventListener('click', (e) => {
784
- $table.setAttribute('style', `height: ${itemHeight}px`)
785
- e.target.className !== 'code-expand-btn' ? e.target.parentNode.classList.add('expand-done') : e.target.classList.add('expand-done')
786
- })
787
- fragment.appendChild(ele)
932
+ $table.style.height = `${itemHeight}px`;
933
+ const target = e.target.className !== 'code-expand-btn' ? e.target.parentNode : e.target;
934
+ target.classList.add('expand-done');
935
+ });
936
+ fragment.appendChild(ele);
788
937
  }
789
- item.insertBefore(fragment, item.firstChild)
938
+ item.insertBefore(fragment, item.firstChild);
790
939
  }
791
940
 
792
941
  static init() {
793
- const $figureHighlight = document.querySelectorAll('figure.highlight'), that = this
794
- $figureHighlight.forEach(function (item) {
795
- let langName = item.getAttribute('class').split(' ')[1]
796
- if (langName === 'plaintext' || langName === undefined) langName = 'Code'
797
- const highlightLangEle = `<div class="code-lang">${langName.toUpperCase()}</div>`
798
- that.createEle(highlightLangEle, item)
799
- })
942
+ const $figureHighlight = document.querySelectorAll('figure.highlight');
943
+ $figureHighlight.forEach(item => {
944
+ let langName = item.classList[1] || 'Code';
945
+ if (langName === 'plaintext') langName = 'Code';
946
+ const highlightLangEle = `<div class="code-lang">${langName.toUpperCase()}</div>`;
947
+ this.createEle(highlightLangEle, item);
948
+ });
800
949
  }
801
950
  }
802
951
 
@@ -836,47 +985,48 @@ class tabs {
836
985
  }
837
986
  }
838
987
 
839
-
840
988
  window.refreshFn = () => {
989
+ if (PAGE_CONFIG.page === "404") return;
990
+ initAdjust()
841
991
  scrollFn()
842
992
  sidebarFn()
843
- setTimeState()
844
- GLOBALCONFIG.comment.enable && newestCommentInit()
845
- chageTimeFormate()
993
+ changeTimeFormat()
846
994
  initObserver()
847
995
  sco.addRuntime()
848
996
  sco.hideCookie()
849
997
  sco.addPhotoFigcaption()
850
- sco.sayhi()
851
- addRightMenuClickEvent()
852
- GLOBALCONFIG.lazyload.enable && sco.lazyloadImg()
853
- GLOBALCONFIG.lightbox && sco.lightbox('')
854
- GLOBALCONFIG.randomlinks && randomLinksList()
855
- PAGECONFIG.toc && toc.init()
856
- if (PAGECONFIG.is_post || PAGECONFIG.is_page) {
857
- GLOBALCONFIG.hightlight.enable && hightlight.init()
998
+ sco.setFest()
999
+ sco.setTimeState()
1000
+ sco.tagPageActive()
1001
+ sco.categoriesBarActive()
1002
+ sco.listenToPageInputPress()
1003
+ sco.addNavBackgroundInit()
1004
+ GLOBAL_CONFIG.rightside.enable && addRightMenuClickEvent()
1005
+ GLOBAL_CONFIG.lazyload.enable && sco.lazyloadImg()
1006
+ GLOBAL_CONFIG.lightbox && sco.lightbox('')
1007
+ GLOBAL_CONFIG.randomlinks && randomLinksList()
1008
+ GLOBAL_CONFIG.comment.enable && newestCommentInit()
1009
+ if (PAGE_CONFIG.comment) {
1010
+ initComment()
1011
+ }
1012
+ PAGE_CONFIG.toc && toc.init()
1013
+ if (PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) {
1014
+ GLOBAL_CONFIG.hightlight.enable && hightlight.init()
858
1015
  tabs.init()
859
1016
  }
860
- PAGECONFIG.comment && initComment()
861
- if (PAGECONFIG.is_home) {
1017
+ if (PAGE_CONFIG.is_home) {
862
1018
  showTodayCard()
863
1019
  sco.initbbtalk()
864
1020
  }
865
- if (PAGECONFIG.is_page && PAGECONFIG.page === 'says') sco.reflashEssayWaterFall()
866
- if (PAGECONFIG.is_page) {
867
- if (document.getElementById('album_detail')) sco.reflashEssayWaterFall()
868
- }
869
- GLOBALCONFIG.covercolor && coverColor();
870
- set_fest()
1021
+ GLOBAL_CONFIG.covercolor && coverColor();
871
1022
  sco.initConsoleState()
872
1023
  if (document.getElementById('history-baidu')) sco.card_history() // 那年今日
873
1024
  if (document.getElementById('welcome-info')) sco.card_welcome() // 个性定位
874
- if (GLOBALCONFIG.comment.enable) initializeCommentBarrage() // 热评
1025
+ if (GLOBAL_CONFIG.comment.type === "twikoo" && PAGE_CONFIG.comment) initializeCommentBarrage() // 热评
875
1026
  }
876
1027
 
877
1028
  sco.initTheme()
878
1029
 
879
- let wleelw_musicPlaying = false
880
1030
  document.addEventListener('DOMContentLoaded', function () {
881
1031
  window.refreshFn()
882
1032
  })