hexo-theme-solitude 1.3.1 → 1.4.0

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 (261) hide show
  1. package/.github/FUNDING.yml +13 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.yml +107 -0
  3. package/.github/ISSUE_TEMPLATE/config.yml +13 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.yml +14 -0
  5. package/.github/workflows/npm-publish.yml +21 -0
  6. package/CONTRIBUTING.md +0 -0
  7. package/LICENSE +0 -0
  8. package/README.md +60 -43
  9. package/README_EN.md +60 -42
  10. package/_config.yml +606 -451
  11. package/languages/en-US.yml +3 -23
  12. package/languages/zh-CN.yml +3 -23
  13. package/layout/404.pug +0 -0
  14. package/layout/archive.pug +0 -0
  15. package/layout/category.pug +0 -0
  16. package/layout/includes/body/mode.pug +1 -6
  17. package/layout/includes/console.pug +3 -3
  18. package/layout/includes/footer.pug +16 -15
  19. package/layout/includes/head/config.pug +38 -30
  20. package/layout/includes/head/opengraph.pug +0 -0
  21. package/layout/includes/head/pwa.pug +5 -44
  22. package/layout/includes/head.pug +3 -1
  23. package/layout/includes/header.pug +0 -0
  24. package/layout/includes/inject/body.pug +114 -65
  25. package/layout/includes/inject/head.pug +11 -46
  26. package/layout/includes/layout.pug +1 -2
  27. package/layout/includes/loading.pug +0 -0
  28. package/layout/includes/mixins/articleSort.pug +0 -0
  29. package/layout/includes/mixins/pagination.pug +0 -0
  30. package/layout/includes/nav.pug +1 -1
  31. package/layout/includes/page/about.pug +1 -1
  32. package/layout/includes/page/categories.pug +0 -0
  33. package/layout/includes/page/default.pug +0 -0
  34. package/layout/includes/page/equipment.pug +0 -0
  35. package/layout/includes/page/links.pug +2 -2
  36. package/layout/includes/page/music.pug +0 -0
  37. package/layout/includes/page/not_configured.pug +0 -0
  38. package/layout/includes/page/rss.pug +3 -3
  39. package/layout/includes/page/says.pug +15 -15
  40. package/layout/includes/page/tags.pug +0 -0
  41. package/layout/includes/page/tlink.pug +1 -0
  42. package/layout/includes/recent-posts.pug +0 -0
  43. package/layout/includes/sidebar.pug +0 -0
  44. package/layout/includes/widgets/aside/aside.pug +6 -6
  45. package/layout/includes/widgets/aside/asideAllInfo.pug +0 -0
  46. package/layout/includes/widgets/aside/asideArchive.pug +0 -0
  47. package/layout/includes/widgets/aside/asideCustom.pug +1 -1
  48. package/layout/includes/widgets/aside/asideFlipCard.pug +0 -0
  49. package/layout/includes/widgets/aside/asideInfoCard.pug +3 -3
  50. package/layout/includes/widgets/aside/asideNewestPost.pug +0 -0
  51. package/layout/includes/widgets/aside/asideSwitch.pug +0 -4
  52. package/layout/includes/widgets/aside/asideTag.pug +1 -1
  53. package/layout/includes/widgets/aside/asideToc.pug +0 -0
  54. package/layout/includes/widgets/aside/asideWebInfo.pug +2 -2
  55. package/layout/includes/widgets/home/banner.pug +0 -0
  56. package/layout/includes/widgets/home/bb/json.pug +22 -0
  57. package/layout/includes/widgets/home/bb/local.pug +17 -0
  58. package/layout/includes/widgets/home/bb/memos.pug +25 -0
  59. package/layout/includes/widgets/home/bbTimeList.pug +11 -7
  60. package/layout/includes/widgets/home/categoryBar.pug +0 -0
  61. package/layout/includes/widgets/home/categoryGroup.pug +1 -1
  62. package/layout/includes/widgets/home/hometop.pug +0 -0
  63. package/layout/includes/widgets/home/postList.pug +0 -0
  64. package/layout/includes/widgets/home/topGroup.pug +0 -0
  65. package/layout/includes/widgets/nav/left.pug +0 -0
  66. package/layout/includes/widgets/nav/menu.pug +1 -1
  67. package/layout/includes/widgets/nav/right.pug +6 -5
  68. package/layout/includes/widgets/page/about/authorinfo.pug +10 -9
  69. package/layout/includes/widgets/page/about/award.pug +0 -0
  70. package/layout/includes/widgets/page/about/contentinfo.pug +35 -34
  71. package/layout/includes/widgets/page/about/hobbies.pug +21 -17
  72. package/layout/includes/widgets/page/about/motto.pug +17 -16
  73. package/layout/includes/widgets/page/about/other.pug +16 -16
  74. package/layout/includes/widgets/page/about/personalities.pug +15 -14
  75. package/layout/includes/widgets/page/about/skillsinfo.pug +37 -36
  76. package/layout/includes/widgets/page/about/tenyear.pug +0 -0
  77. package/layout/includes/widgets/page/banner.pug +9 -3
  78. package/layout/includes/widgets/page/equipment/content.pug +0 -0
  79. package/layout/includes/widgets/page/links/banner.pug +14 -12
  80. package/layout/includes/widgets/page/links/linksCard.pug +4 -6
  81. package/layout/includes/widgets/page/links/linksDiscn.pug +8 -0
  82. package/layout/includes/widgets/page/links/linksItem.pug +4 -6
  83. package/layout/includes/widgets/page/says/json.pug +80 -0
  84. package/layout/includes/widgets/page/says/local.pug +48 -0
  85. package/layout/includes/widgets/page/says/memos.pug +109 -0
  86. package/layout/includes/widgets/post/award.pug +0 -0
  87. package/layout/includes/widgets/post/copyright.pug +2 -2
  88. package/layout/includes/widgets/post/post-ai.pug +12 -0
  89. package/layout/includes/widgets/post/postMeta.pug +2 -2
  90. package/layout/includes/widgets/post/postNav.pug +0 -0
  91. package/layout/includes/widgets/post/wave.pug +0 -0
  92. package/layout/includes/widgets/randomlink.pug +1 -1
  93. package/layout/includes/widgets/rightside/index.pug +6 -5
  94. package/layout/includes/widgets/third-party/comments/comment.pug +1 -5
  95. package/layout/includes/widgets/third-party/comments/twikoo.pug +1 -1
  96. package/layout/includes/widgets/third-party/comments/waline.pug +9 -11
  97. package/layout/includes/widgets/third-party/music.pug +1 -1
  98. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -0
  99. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +70 -0
  100. package/layout/includes/widgets/third-party/news-comment/waline.pug +64 -0
  101. package/layout/includes/widgets/third-party/pjax.pug +0 -0
  102. package/layout/includes/widgets/third-party/search/algolia-search.pug +0 -0
  103. package/layout/includes/widgets/third-party/search/index.pug +8 -7
  104. package/layout/includes/widgets/third-party/search/local-search.pug +0 -0
  105. package/layout/index.pug +3 -3
  106. package/layout/page.pug +0 -4
  107. package/layout/post.pug +2 -2
  108. package/layout/tag.pug +0 -0
  109. package/package.json +18 -9
  110. package/plugins.yml +109 -0
  111. package/scripts/event/cdn.js +129 -0
  112. package/scripts/event/init.js +0 -0
  113. package/scripts/event/page.js +1 -21
  114. package/scripts/event/welcome.js +1 -1
  115. package/scripts/filter/checkThemeConfig.js +0 -0
  116. package/scripts/filter/default.js +0 -0
  117. package/scripts/filter/lazyload.js +1 -1
  118. package/scripts/filter/randomPosts.js +0 -0
  119. package/scripts/helper/cdn.js +0 -0
  120. package/scripts/helper/getArchiveLength.js +0 -0
  121. package/scripts/helper/page.js +0 -0
  122. package/scripts/helper/related_post.js +0 -0
  123. package/scripts/helper/stylus.js +0 -0
  124. package/scripts/tags/button.js +0 -0
  125. package/scripts/tags/bvideo.js +0 -0
  126. package/scripts/tags/card.js +0 -0
  127. package/scripts/tags/checkbox.js +0 -0
  128. package/scripts/tags/fold.js +0 -0
  129. package/scripts/tags/image.js +0 -0
  130. package/scripts/tags/inline-image.js +0 -0
  131. package/scripts/tags/label.js +0 -0
  132. package/scripts/tags/link.js +0 -0
  133. package/scripts/tags/media.js +0 -0
  134. package/scripts/tags/note.js +0 -0
  135. package/scripts/tags/span.js +0 -0
  136. package/scripts/tags/tabs.js +0 -0
  137. package/scripts/tags/timeline.js +0 -0
  138. package/scripts/tags/u.js +0 -0
  139. package/source/css/_global/animation.css +0 -0
  140. package/source/css/_global/function.styl +42 -42
  141. package/source/css/_global/index.styl +1 -1
  142. package/source/css/_global/var.styl +0 -0
  143. package/source/css/_layout/basic.styl +10 -12
  144. package/source/css/_layout/header.styl +7 -2
  145. package/source/css/_layout/index.styl +59 -5
  146. package/source/css/_mode/index.styl +1 -17
  147. package/source/css/_page/_home/category-bar.styl +0 -0
  148. package/source/css/_page/_home/home-top.styl +10 -31
  149. package/source/css/_page/_home/index.styl +0 -0
  150. package/source/css/_page/_home/pagination.styl +3 -0
  151. package/source/css/_page/_home/recent-post.styl +10 -3
  152. package/source/css/_page/about/index.styl +0 -0
  153. package/source/css/_page/about/tenyear.styl +0 -0
  154. package/source/css/_page/about.styl +9 -0
  155. package/source/css/_page/category.styl +0 -0
  156. package/source/css/_page/douban.styl +0 -1
  157. package/source/css/_page/equipment.styl +0 -0
  158. package/source/css/_page/error.styl +0 -0
  159. package/source/css/_page/home.styl +0 -0
  160. package/source/css/_page/index.styl +2 -3
  161. package/source/css/_page/links.styl +84 -49
  162. package/source/css/_page/moment.styl +0 -0
  163. package/source/css/_page/music.styl +0 -0
  164. package/source/css/_page/rss.styl +0 -0
  165. package/source/css/_page/says.styl +10 -0
  166. package/source/css/_page/tag.styl +0 -0
  167. package/source/css/_widgets/_aside/allinfo.styl +34 -0
  168. package/source/css/_widgets/_aside/flip.styl +0 -0
  169. package/source/css/_widgets/_aside/index.styl +1 -7
  170. package/source/css/_widgets/_aside/info.styl +0 -0
  171. package/source/css/_widgets/_aside/newPost.styl +0 -0
  172. package/source/css/_widgets/_aside/toc.styl +0 -0
  173. package/source/css/_widgets/_aside/welcome.styl +0 -0
  174. package/source/css/_widgets/_comment/index.styl +0 -0
  175. package/source/css/_widgets/_comment/twikoo.styl +0 -2
  176. package/source/css/_widgets/_comment/waline.styl +0 -0
  177. package/source/css/_widgets/_extra/console.styl +0 -0
  178. package/source/css/_widgets/_extra/fullpage.styl +0 -0
  179. package/source/css/_widgets/_extra/music.styl +1 -1
  180. package/source/css/_widgets/_extra/pace.styl +0 -0
  181. package/source/css/_widgets/_extra/rightmenu.styl +0 -0
  182. package/source/css/_widgets/_mixins/article-sort.styl +0 -0
  183. package/source/css/_widgets/_mixins/footer.styl +1 -2
  184. package/source/css/_widgets/_mixins/other.styl +0 -4
  185. package/source/css/_widgets/_mixins/sidebar.styl +0 -0
  186. package/source/css/_widgets/_post/_highlight/diff.styl +0 -0
  187. package/source/css/_widgets/_post/_highlight/index.styl +0 -1
  188. package/source/css/_widgets/_post/_highlight/theme/default.styl +0 -0
  189. package/source/css/_widgets/_post/_highlight/theme/mac.styl +0 -0
  190. package/source/css/_widgets/_post/_highlight/theme.styl +0 -0
  191. package/source/css/_widgets/_post/commentBarrage.styl +0 -0
  192. package/source/css/_widgets/_post/content.styl +42 -11
  193. package/source/css/_widgets/_post/copyright.styl +0 -0
  194. package/source/css/_widgets/_post/index.styl +1 -1
  195. package/source/css/_widgets/_post/meta.styl +0 -3
  196. package/source/css/_widgets/_post/pagination.styl +1 -1
  197. package/source/css/_widgets/_post/postAI.styl +0 -0
  198. package/source/css/_widgets/_post/relatedPost.styl +0 -0
  199. package/source/css/_widgets/_post/tools.styl +0 -0
  200. package/source/css/_widgets/_search/algolia-search.styl +0 -0
  201. package/source/css/_widgets/_search/local-search.styl +0 -0
  202. package/source/css/_widgets/_tags/button.styl +0 -0
  203. package/source/css/_widgets/_tags/bvideo.styl +0 -0
  204. package/source/css/_widgets/_tags/card.styl +0 -0
  205. package/source/css/_widgets/_tags/checkbox.styl +0 -0
  206. package/source/css/_widgets/_tags/fold.styl +0 -0
  207. package/source/css/_widgets/_tags/image.styl +0 -0
  208. package/source/css/_widgets/_tags/index.styl +0 -0
  209. package/source/css/_widgets/_tags/inline-image.styl +0 -0
  210. package/source/css/_widgets/_tags/label.styl +0 -0
  211. package/source/css/_widgets/_tags/link.styl +4 -2
  212. package/source/css/_widgets/_tags/note.styl +0 -0
  213. package/source/css/_widgets/_tags/span.styl +0 -0
  214. package/source/css/_widgets/_tags/tabs.styl +0 -0
  215. package/source/css/_widgets/_tags/timeline.styl +0 -1
  216. package/source/css/_widgets/index.styl +4 -4
  217. package/source/css/index.styl +0 -0
  218. package/source/img/avatar.png +0 -0
  219. package/source/img/default.png +0 -0
  220. package/source/img/error_load.png +0 -0
  221. package/source/js/{extend/comment/twikoo/commentBarrage.js → comment/twikoo_commentBarrage.js} +0 -0
  222. package/source/js/{extend/comment/waline/commentBarrage.js → comment/waline_commentBarrage.js} +0 -0
  223. package/source/js/covercolor/api.js +95 -0
  224. package/source/js/covercolor/local.js +154 -0
  225. package/source/js/main.js +28 -235
  226. package/source/js/music.js +0 -0
  227. package/source/js/rightside.js +404 -0
  228. package/source/js/{extend/search/algolia-search.js → search/algolia.js} +10 -0
  229. package/source/js/{extend/search/local-search.js → search/local.js} +24 -2
  230. package/source/js/utils.js +75 -1
  231. package/layout/includes/head/fest.pug +0 -22
  232. package/layout/includes/page/echarts.pug +0 -7
  233. package/layout/includes/page/moments.pug +0 -4
  234. package/layout/includes/widgets/aside/asideHistory.pug +0 -8
  235. package/layout/includes/widgets/aside/asideWelcome.pug +0 -12
  236. package/layout/includes/widgets/page/moments/angle.pug +0 -19
  237. package/layout/includes/widgets/page/moments/index.pug +0 -23
  238. package/layout/includes/widgets/page/says/saysBottom.pug +0 -11
  239. package/layout/includes/widgets/page/says/saysContent.pug +0 -6
  240. package/layout/includes/widgets/page/says/saysFunction.pug +0 -10
  241. package/layout/includes/widgets/page/says/saysMeta.pug +0 -7
  242. package/layout/includes/widgets/third-party/ai/index.pug +0 -12
  243. package/layout/includes/widgets/third-party/comments/gitalk.pug +0 -0
  244. package/layout/includes/widgets/third-party/comments/valine.pug +0 -0
  245. package/scripts/helper/echarts.js +0 -407
  246. package/source/css/_widgets/_aside/history.styl +0 -42
  247. package/source/js/extend/comment/twikoo/twikoo.js +0 -67
  248. package/source/js/extend/comment/waline/waline.js +0 -60
  249. package/source/lib/bundle.min.js +0 -27
  250. package/source/lib/circle.min.js +0 -1
  251. package/source/lib/cover-color.min.js +0 -7
  252. package/source/lib/friends_post.js +0 -4
  253. package/source/lib/lazyload.min.js +0 -1
  254. package/source/lib/rightside.min.js +0 -1
  255. package/source/lib/snackbar.min.css +0 -1
  256. package/source/lib/snackbar.min.js +0 -9
  257. package/source/lib/txmap.min.js +0 -1
  258. package/source/lib/universe.min.js +0 -1
  259. package/source/lib/view-image.min.js +0 -6
  260. package/source/lib/waterfall.min.js +0 -1
  261. /package/source/{lib → js}/sco-ai.min.js +0 -0
package/source/js/main.js CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * side menu
3
- */
4
1
  const sidebarFn = () => {
5
2
  const $toggleMenu = document.getElementById('toggle-menu')
6
3
  const $mobileSidebarMenus = document.getElementById('sidebar-menus')
@@ -36,9 +33,6 @@ const sidebarFn = () => {
36
33
  })
37
34
  }
38
35
 
39
- /**
40
- * 滚动处理
41
- */
42
36
  const scrollFn = function () {
43
37
  const innerHeight = window.innerHeight;
44
38
  const $header = document.getElementById('page-header');
@@ -70,9 +64,6 @@ const scrollFn = function () {
70
64
  }
71
65
  }
72
66
 
73
- /**
74
- * 滑动导航栏数字变化
75
- */
76
67
  const percent = () => {
77
68
  let scrollTop = document.documentElement.scrollTop || window.pageYOffset
78
69
  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
@@ -117,9 +108,6 @@ const showTodayCard = () => {
117
108
  }
118
109
  }
119
110
 
120
- /**
121
- * 修改时间格式
122
- */
123
111
  const changeTimeFormat = () => {
124
112
  const timeElements = document.getElementsByTagName("time"), lang = GLOBAL_CONFIG.lang.time
125
113
  for (let i = 0; i < timeElements.length; i++) {
@@ -145,9 +133,6 @@ const changeTimeFormat = () => {
145
133
  }
146
134
  }
147
135
 
148
- /*
149
- * 文章页右下角下一篇
150
- */
151
136
  const initObserver = () => {
152
137
  let commentElement = document.getElementById("post-comment");
153
138
  let paginationElement = document.getElementById("pagination");
@@ -192,6 +177,7 @@ class toc {
192
177
  const $tocContent = document.getElementById('toc-content')
193
178
  const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6')
194
179
  let detectItem = ''
180
+
195
181
  function autoScroll(el) {
196
182
  const activePosition = el.getBoundingClientRect().top
197
183
  const sidebarScrollTop = $tocContent.scrollTop
@@ -202,6 +188,7 @@ class toc {
202
188
  $tocContent.scrollTop = sidebarScrollTop - 150
203
189
  }
204
190
  }
191
+
205
192
  function findHeadPosition(top) {
206
193
  if (top === 0) {
207
194
  return false
@@ -230,6 +217,7 @@ class toc {
230
217
  }
231
218
  }
232
219
  }
220
+
233
221
  window.tocScrollFn = utils.throttle(function () {
234
222
  const currentTop = window.scrollY || document.documentElement.scrollTop
235
223
  findHeadPosition(currentTop)
@@ -243,94 +231,6 @@ let lastSayHello = "";
243
231
  let wleelw_musicPlaying = false
244
232
 
245
233
  let sco = {
246
- /**
247
- * 个性定位
248
- */
249
- card_welcome: function () {
250
- ipLoacation = window.saveToLocal.get('ipLocation');
251
- if (!ipLoacation) {
252
- // 数据已过期或不存在
253
- let script = document.createElement('script');
254
- let url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
255
- script.src = url;
256
- window.QQmap = function (data) {
257
- ipLoacation = data;
258
- // 将数据保存到 localStorage,过期时间设置为 1 天
259
- window.saveToLocal.set('ipLocation', ipLoacation, 1);
260
- document.body.removeChild(script);
261
- delete window.QQmap;
262
- };
263
- document.body.appendChild(script);
264
- }
265
- showWelcome();
266
- },
267
- /**
268
- * 那年今日
269
- */
270
- card_history: function () {
271
- if (document.getElementById('history-container')) {
272
- async function fetchHistoryData() {
273
- let myDate = new Date();
274
- let myMonth = myDate.getMonth() + 1;
275
- let getDate = myDate.getDate();
276
- let getMonth = myMonth < 10 ? "0" + myMonth : "" + myMonth;
277
- let getDay = getDate < 10 ? "0" + getDate : "" + getDate;
278
- let getMonthDate = "S" + getMonth + getDay;
279
- let history_data_url = `https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/${getMonth}.json`;
280
-
281
- let response = await fetch(history_data_url);
282
- let data = await response.json();
283
- return data[getMonthDate];
284
- }
285
-
286
- function append(parent, text) {
287
- let temp = document.createElement('div');
288
- temp.innerHTML = text;
289
- let frag = document.createDocumentFragment();
290
- while (temp.firstChild) {
291
- frag.appendChild(temp.firstChild);
292
- }
293
- parent.appendChild(frag);
294
- }
295
-
296
- fetchHistoryData().then(data => {
297
- let html_item = data.map(item => `
298
- <div class="swiper-slide history_slide">
299
- <span class="history_slide_time">A.D.${item.year}</span>
300
- <span class="history_slide_link">${item.title}</span>
301
- </div>
302
- `).join('');
303
- let history_container_wrapper = document.getElementById('history_container_wrapper');
304
- append(history_container_wrapper, html_item);
305
- let swiper_history = new Swiper('.history_swiper-container', {
306
- passiveListeners: true,
307
- spaceBetween: 30,
308
- effect: 'coverflow',
309
- coverflowEffect: {
310
- rotate: 30,
311
- slideShadows: false,
312
- },
313
- loop: true,
314
- direction: 'vertical',
315
- autoplay: {
316
- disableOnInteraction: true,
317
- delay: 5000
318
- },
319
- mousewheel: false,
320
- });
321
- let history_container = document.getElementById('history-container');
322
- history_container.onmouseenter = function () {
323
- swiper_history.autoplay.stop();
324
- };
325
- history_container.onmouseleave = function () {
326
- swiper_history.autoplay.start();
327
- }
328
- });
329
- }
330
- },
331
- /**
332
- * 隐藏协议小助手
333
- */
334
234
  hideCookie: function () {
335
235
  setTimeout(() => {
336
236
  const cookiesWindow = document.getElementById("cookies-window");
@@ -342,10 +242,6 @@ let sco = {
342
242
  }
343
243
  }, 3000);
344
244
  },
345
- /**
346
- * 平滑滚动处理
347
- * @param elementId
348
- */
349
245
  scrollTo: function (elementId) {
350
246
  const targetElement = document.getElementById(elementId);
351
247
  if (targetElement) {
@@ -363,9 +259,6 @@ let sco = {
363
259
  }));
364
260
  }
365
261
  },
366
- /**
367
- * 控制台热评隐藏显示切换
368
- */
369
262
  switchCommentBarrage: function () {
370
263
  let commentBarrageElement = document.querySelector(".comment-barrage");
371
264
  if (commentBarrageElement) {
@@ -382,9 +275,6 @@ let sco = {
382
275
  }
383
276
  }
384
277
  },
385
- /**
386
- * 控制台侧边栏隐藏显示切换
387
- */
388
278
  switchHideAside: function () {
389
279
  const htmlClassList = document.documentElement.classList;
390
280
  htmlClassList.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 1) : saveToLocal.set("aside-status", "hide", 1)
@@ -394,11 +284,8 @@ let sco = {
394
284
  initConsoleState: function () {
395
285
  document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
396
286
  },
397
- /**
398
- * 个人信息顶部
399
- */
400
287
  changeSayHelloText: function () {
401
- const greetings = ["🤖️ 数码科技爱好者", "🔍 分享与热心帮助", "🏠 智能家居小能手", "🔨 设计开发一条龙", "🤝 专修交互与设计", "🏃 脚踏实地行动派", "🧱 团队小组发动机", "💢 壮汉人狠话不多"];
288
+ const greetings = GLOBAL_CONFIG.aside.sayhello2;
402
289
  const greetingElement = document.getElementById("author-info__sayhi");
403
290
  let randomGreeting = greetings[Math.floor(Math.random() * greetings.length)];
404
291
  while (randomGreeting === lastSayHello) {
@@ -407,9 +294,6 @@ let sco = {
407
294
  greetingElement.textContent = randomGreeting;
408
295
  lastSayHello = randomGreeting;
409
296
  },
410
- /**
411
- * 昼夜切换
412
- */
413
297
  switchDarkMode: function () {
414
298
  let nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' :
415
299
  'light'
@@ -417,50 +301,32 @@ let sco = {
417
301
  document.documentElement.setAttribute('data-theme', 'dark')
418
302
  saveToLocal.set('theme', 'dark', 0.02);
419
303
  utils.snackbarShow(GLOBAL_CONFIG.lang.theme.dark, false, 2000)
420
- document.querySelector(".menu-darkmode-text").textContent = "深色模式";
304
+ GLOBAL_CONFIG.rightside && (document.querySelector(".menu-darkmode-text").textContent = "浅色模式");
421
305
  } else {
422
306
  document.documentElement.setAttribute('data-theme', 'light')
423
307
  saveToLocal.set('theme', 'light', 0.02);
424
308
  utils.snackbarShow(GLOBAL_CONFIG.lang.theme.light, false, 2000)
425
- document.querySelector(".menu-darkmode-text").textContent = "浅色模式";
309
+ GLOBAL_CONFIG.rightside && (document.querySelector(".menu-darkmode-text").textContent = "深色模式");
426
310
  }
427
311
  },
428
312
  hideTodayCard: function () {
429
313
  document.getElementById('todayCard').classList.add('hide')
430
314
  },
431
- /**
432
- * 返回顶部
433
- */
434
315
  toTop: function () {
435
316
  utils.scrollToDest(0)
436
317
  },
437
- /**
438
- * 显示控制台
439
- */
440
318
  showConsole: function () {
441
319
  let el = document.getElementById('console')
442
320
  if (!el.classList.contains('show')) {
443
321
  el.classList.add('show')
444
322
  }
445
323
  },
446
- /**
447
- * 隐藏控制台
448
- */
449
324
  hideConsole: function () {
450
325
  const el = document.getElementById('console')
451
326
  if (el.classList.contains('show')) {
452
327
  el.classList.remove('show')
453
328
  }
454
329
  },
455
- /**
456
- * 灯箱使用
457
- */
458
- lightbox: function () {
459
- 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)");
460
- },
461
- /**
462
- *
463
- */
464
330
  reflashEssayWaterFall: function () {
465
331
  if (document.getElementById('waterfall')) {
466
332
  setTimeout(function () {
@@ -469,38 +335,18 @@ let sco = {
469
335
  }, 500);
470
336
  }
471
337
  },
472
- /**
473
- * 更新站点运行时间
474
- */
475
338
  addRuntime: function () {
476
339
  let el = document.getElementById('runtimeshow')
477
340
  if (el && GLOBAL_CONFIG.runtime) {
478
341
  el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.runtime
479
342
  }
480
343
  },
481
- /**
482
- * 懒加载图片
483
- */
484
- lazyloadImg: function () {
485
- window.lazyLoadInstance = new LazyLoad({
486
- elements_selector: 'img',
487
- threshold: 0,
488
- data_src: 'lazy-src',
489
- callback_error: (img) => {
490
- img.setAttribute("src", GLOBAL_CONFIG.lazyload.error);
491
- }
492
- })
493
- },
494
- /**
495
- * 跳转到输评论
496
- * @param txt
497
- */
498
344
  toTalk: function (txt) {
499
345
  const inputs = ["#wl-edit", ".el-textarea__inner"]
500
346
  for (let i = 0; i < inputs.length; i++) {
501
347
  let el = document.querySelector(inputs[i])
502
348
  if (el != null) {
503
- el.dispatchEvent(new Event('input', { bubble: true, cancelable: true }))
349
+ el.dispatchEvent(new Event('input', {bubble: true, cancelable: true}))
504
350
  el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n'
505
351
  utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
506
352
  el.focus()
@@ -512,9 +358,6 @@ let sco = {
512
358
  commentTips.classList.add("show");
513
359
  }
514
360
  },
515
- /**
516
- * 初始化即刻mini
517
- */
518
361
  initbbtalk: function () {
519
362
  if (document.querySelector('#bber-talk')) {
520
363
  let swiper = new Swiper('.swiper-container', {
@@ -527,9 +370,6 @@ let sco = {
527
370
  });
528
371
  }
529
372
  },
530
- /**
531
- * 图片添加底部展示信息
532
- */
533
373
  addPhotoFigcaption: function () {
534
374
  let images = document.querySelectorAll('#article-container img');
535
375
  images.forEach((image) => {
@@ -545,9 +385,6 @@ let sco = {
545
385
  }
546
386
  });
547
387
  },
548
- /**
549
- * 下载图片并添加水印
550
- */
551
388
  downloadImage: function (imageUrl, filename = 'photo') {
552
389
  if (rm.downloadimging) {
553
390
  utils.snackbarShow("有正在进行中的下载,请稍后再试");
@@ -580,10 +417,6 @@ let sco = {
580
417
  };
581
418
  img.src = imageUrl;
582
419
  },
583
-
584
- /**
585
- * 音乐播放暂停
586
- */
587
420
  musicToggle: function () {
588
421
  const $music = document.querySelector('#nav-music');
589
422
  const $meting = document.querySelector('meting-js');
@@ -601,48 +434,33 @@ let sco = {
601
434
  }
602
435
  rm.hideRightMenu();
603
436
  },
604
- /**
605
- * 音乐上一首
606
- */
607
437
  musicSkipBack: function () {
608
438
  document.querySelector('meting-js').aplayer.skipBack()
609
439
  rm.hideRightMenu()
610
440
  },
611
- /**
612
- * 音乐下一首
613
- */
614
441
  musicSkipForward: function () {
615
442
  document.querySelector('meting-js').aplayer.skipForward()
616
443
  rm.hideRightMenu()
617
444
  },
618
- /**
619
- * 获取歌曲名称
620
- */
621
445
  musicGetName: function () {
622
446
  const titles = Array.from(document.querySelectorAll('.aplayer-title')).map(e => e.innerText);
623
447
  return titles[0];
624
448
  },
625
- /**
626
- * 跳转到评论
627
- */
628
449
  scrollToComment: function () {
629
450
  utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300)
630
451
  },
631
- /**
632
- * 个人信息顶部文字更新
633
- */
634
452
  setTimeState: function () {
635
453
  const el = document.getElementById('author-info__sayhi');
636
454
  if (el) {
637
455
  const timeNow = new Date();
638
456
  const hours = timeNow.getHours();
639
- const lang = GLOBAL_CONFIG.lang.sayhello;
457
+ const lang = GLOBAL_CONFIG.aside.sayhello;
640
458
  const greetings = [
641
- { start: 0, end: 5, text: lang.goodnight },
642
- { start: 6, end: 10, text: lang.morning },
643
- { start: 11, end: 14, text: lang.noon },
644
- { start: 15, end: 18, text: lang.afternoon },
645
- { start: 19, end: 24, text: lang.night },
459
+ {start: 0, end: 5, text: lang.goodnight},
460
+ {start: 6, end: 10, text: lang.morning},
461
+ {start: 11, end: 14, text: lang.noon},
462
+ {start: 15, end: 18, text: lang.afternoon},
463
+ {start: 19, end: 24, text: lang.night},
646
464
  ];
647
465
  for (let greeting of greetings) {
648
466
  if (hours >= greeting.start && hours <= greeting.end) {
@@ -652,9 +470,6 @@ let sco = {
652
470
  }
653
471
  }
654
472
  },
655
- /**
656
- * tagPageActive
657
- */
658
473
  tagPageActive: function () {
659
474
  const currentPath = window.location.pathname;
660
475
  const decodedPath = decodeURIComponent(currentPath);
@@ -677,9 +492,6 @@ let sco = {
677
492
  }
678
493
  }
679
494
  },
680
- /**
681
- * categoryBarActive
682
- */
683
495
  categoriesBarActive: function () {
684
496
  const categoryBar = document.querySelector("#category-bar");
685
497
  const currentPath = window.location.pathname;
@@ -709,9 +521,6 @@ let sco = {
709
521
  }
710
522
  }
711
523
  },
712
- /**
713
- * categoryBarRightButton
714
- */
715
524
  scrollCategoryBarToRight: function () {
716
525
  let timeoutId;
717
526
  let scrollBar = document.getElementById("category-bar-items");
@@ -742,9 +551,6 @@ let sco = {
742
551
  });
743
552
  }
744
553
  },
745
- /**
746
- * 打开侧边栏标签隐藏
747
- */
748
554
  openAllTags: function () {
749
555
  let tagCloudElements = document.querySelectorAll(".card-allinfo .card-tag-cloud");
750
556
  tagCloudElements.forEach(function (tagCloudElement) {
@@ -755,9 +561,6 @@ let sco = {
755
561
  moreTagsButton.parentNode.removeChild(moreTagsButton);
756
562
  }
757
563
  },
758
- /**
759
- * 监听底部分页输入框
760
- */
761
564
  listenToPageInputPress: function () {
762
565
  const pageText = document.getElementById("toPageText");
763
566
  const pageButton = document.getElementById("toPageButton");
@@ -794,9 +597,6 @@ let sco = {
794
597
  }
795
598
  });
796
599
  },
797
- /**
798
- * 初始化Nav背景
799
- */
800
600
  addNavBackgroundInit: function () {
801
601
  var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
802
602
  if (scrollTop !== 0) {
@@ -810,10 +610,6 @@ let sco = {
810
610
  }
811
611
  }
812
612
  },
813
- /**
814
- * 初始化Header
815
- * @param change
816
- */
817
613
  initAdjust: function (change = false) {
818
614
  const $blogName = document.getElementById('site-name')
819
615
  let blogNameWidth = $blogName && $blogName.offsetWidth
@@ -839,9 +635,6 @@ let sco = {
839
635
 
840
636
  document.getElementById('nav')?.classList.add('show')
841
637
  },
842
- /**
843
- * 首页分页跳转
844
- */
845
638
  toPage: function () {
846
639
  const pageNumbers = document.querySelectorAll(".page-number");
847
640
  const maxPageNumber = parseInt(pageNumbers[pageNumbers.length - 1].innerHTML);
@@ -882,9 +675,6 @@ let sco = {
882
675
  }
883
676
  }
884
677
 
885
- /*
886
- * 代码高亮显示
887
- */
888
678
  class hightlight {
889
679
  static createEle(langEl, item) {
890
680
  const fragment = document.createDocumentFragment()
@@ -908,11 +698,10 @@ class hightlight {
908
698
  if ($expand.length !== 0) {
909
699
  $expand[0].setAttribute('style', 'display:block')
910
700
  }
911
- if (itemHeight < 200) {
912
- $table.setAttribute('style', 'height: auto')
701
+ if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
702
+ $table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
913
703
  } else {
914
- $table.setAttribute('style', 'height:200px')
915
- ele.classList.remove("expand-done")
704
+ $table.setAttribute('style', `height: auto`)
916
705
  }
917
706
  }
918
707
  expand = !expand
@@ -924,10 +713,10 @@ class hightlight {
924
713
  fragment.appendChild(hlTools)
925
714
  const itemHeight = item.clientHeight, $table = item.querySelector('table'),
926
715
  $expand = item.getElementsByClassName('code-expand-btn')
927
- if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit + 30) {
716
+ if (GLOBAL_CONFIG.hightlight.limit && itemHeight > GLOBAL_CONFIG.hightlight.limit) {
928
717
  $table.setAttribute('style', `height: ${GLOBAL_CONFIG.hightlight.limit}px`)
929
718
  ele.className = 'code-expand-btn'
930
- ele.innerHTML = '<i class="scoicon sco-show-line" style="font-size: 1.2rem"></i>'
719
+ ele.innerHTML = '<i class="scoicon sco-show-line"></i>'
931
720
  ele.addEventListener('click', (e) => {
932
721
  $table.setAttribute('style', `height: ${itemHeight}px`)
933
722
  e.target.classList.add('expand-done')
@@ -936,7 +725,13 @@ class hightlight {
936
725
  fragment.appendChild(ele)
937
726
  }
938
727
  item.insertBefore(fragment, item.firstChild)
939
- hlTools.children[0].click()
728
+ if (!expand) {
729
+ hlTools.children[0].classList.add('closed')
730
+ $table.setAttribute('style', 'display:none')
731
+ if ($expand.length !== 0) {
732
+ $expand[0].setAttribute('style', 'display:none')
733
+ }
734
+ }
940
735
  }
941
736
 
942
737
  static init() {
@@ -1002,17 +797,15 @@ window.refreshFn = () => {
1002
797
  sco.listenToPageInputPress()
1003
798
  sco.addNavBackgroundInit()
1004
799
  GLOBAL_CONFIG.rightside.enable && addRightMenuClickEvent()
1005
- GLOBAL_CONFIG.lazyload.enable && sco.lazyloadImg()
1006
- GLOBAL_CONFIG.lightbox && sco.lightbox('')
800
+ GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg()
801
+ GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar)"))
1007
802
  GLOBAL_CONFIG.randomlinks && randomLinksList()
1008
803
  PAGE_CONFIG.comment && initComment()
1009
804
  PAGE_CONFIG.toc && toc.init();
1010
805
  (PAGE_CONFIG.is_post || PAGE_CONFIG.is_page) && ((GLOBAL_CONFIG.hightlight.enable && hightlight.init()) || tabs.init())
1011
- PAGE_CONFIG.is_home && (showTodayCard() || sco.initbbtalk())
806
+ PAGE_CONFIG.is_home && showTodayCard()
1012
807
  GLOBAL_CONFIG.covercolor.enable && coverColor()
1013
808
  sco.initConsoleState()
1014
- document.getElementById('history-baidu') && sco.card_history()
1015
- document.getElementById('welcome-info') && sco.card_welcome()
1016
809
  GLOBAL_CONFIG.comment.commentBarrage && PAGE_CONFIG.comment && initializeCommentBarrage()
1017
810
  document.body.setAttribute('data-type', PAGE_CONFIG.page)
1018
811
  PAGE_CONFIG.page === "music" && scoMusic.init()
File without changes