hexo-theme-solitude 1.0.0 → 1.1.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 (75) hide show
  1. package/README.md +12 -7
  2. package/_config.yml +117 -99
  3. package/layout/404.ejs +1 -1
  4. package/layout/layout.ejs +27 -32
  5. package/layout/page/links.ejs +1 -12
  6. package/layout/page/says.ejs +1 -0
  7. package/layout/partial/body.ejs +0 -1
  8. package/layout/partial/compoment/about/award.ejs +2 -0
  9. package/layout/partial/compoment/about/hobbies.ejs +44 -35
  10. package/layout/partial/compoment/about/other.ejs +68 -60
  11. package/layout/partial/compoment/aside/asideFlipCard.ejs +67 -3
  12. package/layout/partial/compoment/aside/asideHistory.ejs +49 -0
  13. package/layout/partial/compoment/aside/asideNewestPost.ejs +1 -1
  14. package/layout/partial/compoment/aside/asidePower.ejs +3 -3
  15. package/layout/partial/compoment/aside/asideSwitch.ejs +6 -0
  16. package/layout/partial/compoment/aside/asideToc.ejs +1 -1
  17. package/layout/partial/compoment/aside/asideWebInfo.ejs +8 -8
  18. package/layout/partial/compoment/aside/asideWelcome.ejs +33 -0
  19. package/layout/partial/compoment/circle/angle.ejs +1 -1
  20. package/layout/partial/compoment/circle/content.ejs +2 -5
  21. package/layout/partial/compoment/dorakika/rightmenu.ejs +90 -105
  22. package/layout/partial/compoment/hometop/bbTimeList.ejs +1 -1
  23. package/layout/partial/compoment/hometop/groupTag.ejs +1 -1
  24. package/layout/partial/compoment/hometop/topGroup.ejs +11 -18
  25. package/layout/partial/compoment/inject/body.ejs +19 -4
  26. package/layout/partial/compoment/inject/head.ejs +68 -3
  27. package/layout/partial/compoment/links/angle.ejs +26 -0
  28. package/layout/partial/compoment/links/banner.ejs +2 -2
  29. package/layout/partial/compoment/mixins/pagination.ejs +2 -2
  30. package/layout/partial/compoment/nav/right.ejs +6 -6
  31. package/layout/partial/compoment/post/postMeta.ejs +10 -10
  32. package/layout/partial/compoment/says/saysBottom.ejs +3 -3
  33. package/layout/partial/compoment/says/saysContent.ejs +0 -1
  34. package/layout/partial/compoment/says/saysFunction.ejs +15 -0
  35. package/layout/partial/compoment/third-party/comments/comment.ejs +1 -1
  36. package/layout/partial/compoment/third-party/comments/twikoo.ejs +2 -1
  37. package/layout/partial/compoment/third-party/search/algolia-search.ejs +2 -2
  38. package/layout/partial/compoment/third-party/search/local-search.ejs +2 -2
  39. package/layout/partial/console.ejs +10 -4
  40. package/layout/partial/footer.ejs +6 -9
  41. package/layout/partial/nav.ejs +1 -1
  42. package/layout/partial/sidebar.ejs +2 -2
  43. package/layout/post.ejs +18 -2
  44. package/package.json +5 -6
  45. package/scripts/event/welcome.js +6 -7
  46. package/scripts/helper/randomLinks.js +1 -1
  47. package/scripts/helper/related_post.js +1 -1
  48. package/scripts/helper/themeJsExport.js +12 -10
  49. package/scripts/tags/hide.js +70 -0
  50. package/scripts/tags/tabs.js +1 -1
  51. package/source/css/main.css +55 -106
  52. package/source/css/search/algolia-search.css +1 -1
  53. package/source/css/search/local-search.css +1 -1
  54. package/source/css/var.css +3 -0
  55. package/source/img/error_load.png +0 -0
  56. package/source/img/pwa/16.png +0 -0
  57. package/source/img/pwa/32.png +0 -0
  58. package/source/js/commentBarrage.js +145 -136
  59. package/source/js/extend/search/algolia-search.js +11 -0
  60. package/source/js/extend/search/local-search.js +12 -1
  61. package/source/js/main.js +203 -21
  62. package/source/js/rightmenu.js +402 -0
  63. package/source/js/txmap.js +236 -0
  64. package/source/lib/chuckle-post-ai.js +1 -0
  65. package/source/lib/circle.min.js +1 -0
  66. package/source/lib/friends_post.js +4 -98
  67. package/source/lib/snackbar.min.js +9 -0
  68. package/source/lib/view-image.min.js +6 -0
  69. package/source/img/power.png +0 -0
  70. package/source/js/circle.js +0 -1828
  71. package/source/js/post_ai.js +0 -517
  72. package/source/lib/snackbar.js +0 -16
  73. package/source/lib/view-image.js +0 -13
  74. /package/source/lib/{bundle.js → bundle.min.js} +0 -0
  75. /package/source/lib/{lazyload.js → lazyload.min.js} +0 -0
@@ -1,148 +1,157 @@
1
- var commentBarrageConfig = {
2
- maxBarrage: 1,
3
- barrageTime: 8e3,
4
- twikooUrl: "https://twikoo.sondy.top",
5
- pageUrl: window.location.pathname,
6
- barrageTimer: [],
7
- barrageList: [],
8
- barrageIndex: 0,
9
- dom: document.querySelector(".comment-barrage")
10
- }
11
- , commentInterval = null
12
- , hoverOnCommentBarrage = !1
13
- , isFirstTime = !0;
14
- document.querySelector(".comment-barrage").addEventListener("mouseenter", (function () {
15
- hoverOnCommentBarrage = !0
16
- }
17
- )),
18
- document.querySelector(".comment-barrage").addEventListener("mouseleave", (function () {
19
- hoverOnCommentBarrage = !1
20
- }
21
- ));
22
- var fetchComments = async function () {
23
- try {
24
- var e = await fetch(commentBarrageConfig.twikooUrl, {
25
- method: "POST",
26
- headers: {
27
- "Content-Type": "application/json"
1
+ function initializeCommentBarrage() {
2
+ window.commentBarrageInitialized = !0;
3
+ let e = {
4
+ maxBarrage: 1,
5
+ barrageTime: 8e3,
6
+ twikooUrl: GLOBALCONFIG.comment.twikooUrl,
7
+ pageUrl: window.location.pathname,
8
+ accessToken: GLOBALCONFIG.comment.twikooAccessToken,
9
+ };
10
+ new class {
11
+ commentInterval = null
12
+ constructor(e) {
13
+ this.config = {
14
+ ...e,
15
+ barrageTimer: [],
16
+ barrageList: [],
17
+ barrageIndex: 0,
18
+ dom: document.querySelector(".comment-barrage")
28
19
  },
29
- body: JSON.stringify({
30
- event: "COMMENT_GET",
31
- accessToken: commentBarrageConfig.accessToken,
32
- url: commentBarrageConfig.pageUrl
33
- })
34
- });
35
- if (!e.ok)
36
- throw new Error("HTTP error! status: " + e.status);
37
- return (await e.json()).data
38
- } catch (e) {
39
- console.error("An error occurred while fetching comments: ", e)
40
- }
41
- }
42
- , initCommentBarrage = function () {
43
- "false" !== localStorage.getItem("commentBarrageSwitch") ? (commentBarrageConfig.dom.style.display = "none",
44
- document.querySelector(".menu-commentBarrage-text").textContent = "显示热评",
45
- document.querySelector("#consoleCommentBarrage").classList.remove("on")) : (commentBarrageConfig.dom.style.display = "flex",
46
- document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评",
47
- document.querySelector("#consoleCommentBarrage").classList.add("on")),
48
- fetchComments().then((function (e) {
49
- commentBarrageConfig.barrageList = commentLinkFilter(e),
50
- commentBarrageConfig.dom.innerHTML = "",
51
- clearInterval(commentInterval),
52
- commentInterval = null;
53
- var r = function () {
54
- if (commentBarrageConfig.barrageList.length && !hoverOnCommentBarrage) {
55
- if (!popCommentBarrage(commentBarrageConfig.barrageList[commentBarrageConfig.barrageIndex]))
56
- return commentBarrageConfig.barrageIndex += 1,
57
- commentBarrageConfig.barrageIndex %= commentBarrageConfig.barrageList.length,
58
- r();
59
- commentBarrageConfig.barrageIndex += 1,
60
- commentBarrageConfig.barrageIndex %= commentBarrageConfig.barrageList.length
61
- }
62
- commentBarrageConfig.barrageTimer.length > (commentBarrageConfig.barrageList.length > commentBarrageConfig.maxBarrage ? commentBarrageConfig.maxBarrage : commentBarrageConfig.barrageList.length) && !hoverOnCommentBarrage && removeCommentBarrage(commentBarrageConfig.barrageTimer.shift())
63
- };
64
- setTimeout((function () {
65
- r(),
66
- commentInterval = setInterval(r, commentBarrageConfig.barrageTime)
67
- }
68
- ), 3e3)
69
- }
70
- ))
71
- };
20
+ this.commentInterval = null,
21
+ this.hoverOnCommentBarrage = !1,
22
+ this.init()
23
+ }
72
24
 
73
- function commentLinkFilter(e) {
74
- e.sort((function (e, r) {
75
- return e.created - r.created
25
+ async fetchComments() {
26
+ return fetch(this.config.twikooUrl, {
27
+ method: "POST",
28
+ headers: {
29
+ "Content-Type": "application/json"
30
+ },
31
+ body: JSON.stringify({
32
+ event: "COMMENT_GET",
33
+ accessToken: this.config.accessToken,
34
+ url: this.config.pageUrl
35
+ })
36
+ }).then((e => {
37
+ if (!e.ok)
38
+ throw Error("HTTP error! status: " + e.status);
39
+ return e.json()
40
+ }
41
+ )).then((e => e.data)).catch((e => console.error("An error occurred while fetching comments: ", e)))
76
42
  }
77
- ));
78
- var r = [];
79
- return e.forEach((function (e) {
80
- r.push(...getCommentReplies(e))
43
+
44
+ commentLinkFilter(e) {
45
+ e.sort(((e, t) => e.created - t.created));
46
+ let t = [];
47
+ return e.forEach((e => {
48
+ t.push(...this.getCommentReplies(e))
49
+ }
50
+ )),
51
+ t
81
52
  }
82
- )),
83
- r
84
- }
85
53
 
86
- function getCommentReplies(e) {
87
- if (e.replies) {
88
- var r = [e];
89
- return e.replies.forEach((function (e) {
90
- r.push(...getCommentReplies(e))
54
+ getCommentReplies(e) {
55
+ if (e.replies) {
56
+ let comments = [e];
57
+ e.replies.forEach((reply) => {
58
+ comments.push(...this.getCommentReplies(reply));
59
+ });
60
+ return comments;
91
61
  }
92
- )),
93
- r
94
- }
95
- return []
96
- }
62
+ return [];
63
+ }
97
64
 
98
- function processCommentContent(e) {
99
- var r = document.createElement("div");
100
- r.innerHTML = e;
101
- for (var a = r.getElementsByTagName("img"), n = a.length - 1; n >= 0; n--) {
102
- var t = a[n];
103
- t.parentNode.removeChild(t)
104
- }
105
- var o = r.getElementsByTagName("blockquote");
106
- for (n = o.length - 1; n >= 0; n--) {
107
- var m = o[n];
108
- m.parentNode.removeChild(m)
109
- }
110
- var c = r.getElementsByTagName("a");
111
- for (n = c.length - 1; n >= 0; n--) {
112
- var i = c[n]
113
- , g = document.createTextNode(i.textContent);
114
- i.parentNode.replaceChild(g, i)
115
- }
116
- var s = r.getElementsByTagName("p");
117
- for (n = s.length - 1; n >= 0; n--) {
118
- var l = s[n];
119
- "" === l.textContent.trim() && l.parentNode.removeChild(l)
120
- }
121
- return r.innerHTML
122
- }
123
65
 
124
- function popCommentBarrage(e) {
125
- var r = processCommentContent(e.comment);
126
- if (!r.trim())
127
- return !1;
128
- var a = document.createElement("div");
129
- return a.className = "comment-barrage-item",
130
- a.innerHTML = `\n <div class="barrageHead">\n <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>\n <div class="barrageNick">${e.nick}</div>\n <img class="barrageAvatar" src="https://cravatar.cn/avatar/${e.mailMd5}"/>\n <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scofont icon-close-fill"></i></a>\n </div>\n <a class="barrageContent" href="javascript:sco.scrollTo('${e.id}');">${r}</a>\n `,
131
- commentBarrageConfig.barrageTimer.push(a),
132
- commentBarrageConfig.dom.appendChild(a),
133
- !0
134
- }
66
+ processCommentContent(e) {
67
+ const t = e.replace(/<blockquote\b[^>]*>[\s\S]*?<\/blockquote>/gi, "")
68
+ , r = t.replace(/<[^>]*>/g, "").replace(/\n/g, " ");
69
+ return "" === t.trim() ? "" : `<p>${r}</p>`
70
+ }
71
+
72
+ popCommentBarrage(e) {
73
+ var commentContent = this.processCommentContent(e.comment);
135
74
 
136
- function removeCommentBarrage(e) {
137
- e.className = "comment-barrage-item out",
138
- setTimeout((function () {
139
- commentBarrageConfig.dom.removeChild(e)
75
+ if (!commentContent.trim()) {
76
+ return false;
140
77
  }
141
- ), 1e3)
142
- }
143
78
 
144
- initCommentBarrage(),
145
- document.addEventListener("pjax:send", (function () {
146
- clearInterval(commentInterval)
79
+ let commentBarrageItem = document.createElement("div");
80
+ commentBarrageItem.className = "comment-barrage-item";
81
+
82
+ commentBarrageItem.innerHTML = `
83
+ <div class="barrageHead">
84
+ <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>
85
+ <div class="barrageNick">${e.nick}</div>
86
+ <img class="barrageAvatar" src="https://cravatar.cn/avatar/${e.mailMd5}"/>
87
+ <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scoicon sco-close-fill"></i></a>
88
+ </div>
89
+ <a class="barrageContent" href="javascript:sco.scrollTo('${e.id}');">${commentContent}</a>
90
+ `;
91
+
92
+ this.config.barrageTimer.push(commentBarrageItem);
93
+
94
+ this.config.dom.appendChild(commentBarrageItem);
95
+ return true;
96
+ }
97
+
98
+ removeCommentBarrage(e) {
99
+ e.className = "comment-barrage-item out",
100
+ setTimeout((() => {
101
+ this.config.dom.removeChild(e)
102
+ }
103
+ ), 1e3)
147
104
  }
148
- ));
105
+
106
+ async initCommentBarrage() {
107
+ if (localStorage.getItem("commentBarrageSwitch") != null) {
108
+ document.querySelector(".comment-barrage").style.display = "flex";
109
+ document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评";
110
+ document.querySelector("#consoleCommentBarrage").classList.add("on");
111
+ } else {
112
+ document.querySelector(".comment-barrage").style.display = "none";
113
+ document.querySelector(".menu-commentBarrage-text").textContent = "显示热评";
114
+ document.querySelector("#consoleCommentBarrage").classList.remove("on");
115
+ }
116
+ const comments = await this.fetchComments();
117
+ this.config.barrageList = this.commentLinkFilter(comments);
118
+ this.config.dom.innerHTML = "";
119
+ clearInterval(this.commentInterval);
120
+ this.commentInterval = null;
121
+ const t = () => {
122
+ if (this.config.barrageList.length && !this.hoverOnCommentBarrage) {
123
+ if (!this.popCommentBarrage(this.config.barrageList[this.config.barrageIndex]))
124
+ return this.config.barrageIndex += 1,
125
+ this.config.barrageIndex %= this.config.barrageList.length,
126
+ void t();
127
+ this.config.barrageIndex += 1,
128
+ this.config.barrageIndex %= this.config.barrageList.length
129
+ }
130
+ if (this.config.barrageTimer.length > (this.config.barrageList.length > this.config.maxBarrage ? this.config.maxBarrage : this.config.barrageList.length) && !this.hoverOnCommentBarrage) {
131
+ this.removeCommentBarrage(this.config.barrageTimer.shift());
132
+ }
133
+ };
134
+ setTimeout(() => {
135
+ t();
136
+ if (this.commentInterval) {
137
+ clearInterval(this.commentInterval);
138
+ }
139
+ this.commentInterval = setInterval(t, this.config.barrageTime);
140
+ }, 3000);
141
+ }
142
+
143
+ init() {
144
+ this.initCommentBarrage();
145
+ const commentBarrage = document.querySelector(".comment-barrage");
146
+ commentBarrage.addEventListener('mouseover', () => {
147
+ this.hoverOnCommentBarrage = true;
148
+ });
149
+ commentBarrage.addEventListener('mouseout', () => {
150
+ this.hoverOnCommentBarrage = false;
151
+ });
152
+ }
153
+ }
154
+ (e)
155
+ }
156
+
157
+ initializeCommentBarrage();
@@ -118,6 +118,17 @@ class search {
118
118
 
119
119
  const searchClickFn = () => {
120
120
  document.querySelector('#search-button > .search').addEventListener('click', search.openSearch)
121
+ document.getElementById('menu-search').addEventListener('click', function() {
122
+ rm.hideRightMenu();
123
+ search.openSearch();
124
+ let t = document.getElementsByClassName('ais-search-box--input')[0];
125
+ let evt = new Event('input', {
126
+ bubbles: true,
127
+ cancelable: true
128
+ });
129
+ t.value = selectTextNow;
130
+ t.dispatchEvent(evt);
131
+ });
121
132
  }
122
133
 
123
134
  const searchClickFnOnce = () => {
@@ -47,7 +47,7 @@ class search{
47
47
  if (!GLOBALCONFIG.localsearch.preload && dataObj === null) dataObj = this.fetchData(GLOBALCONFIG.localsearch.path)
48
48
  $input.addEventListener('input', function type() {
49
49
  const keywords = this.value.trim().toLowerCase().split(/[\s]+/)
50
- if (keywords[0] !== '') $loadingStatus.innerHTML = '<i class="ri-loader-2-fill"></i><span>加载中</span>'
50
+ if (keywords[0] !== '') $loadingStatus.innerHTML = '<i class="scoicon sco-loading-line"></i><span>加载中</span>'
51
51
  else {
52
52
  $resultContent.innerHTML = ''
53
53
  return
@@ -142,6 +142,17 @@ class search{
142
142
 
143
143
  const searchClickFn = () => {
144
144
  document.querySelector('#search-button > .search').addEventListener('click', search.openSearch)
145
+ document.getElementById('menu-search').addEventListener('click', function() {
146
+ rm.hideRightMenu();
147
+ search.openSearch();
148
+ let t = document.getElementsByClassName('search-box-input')[0];
149
+ let evt = new Event('input', {
150
+ bubbles: true,
151
+ cancelable: true
152
+ });
153
+ t.value = selectTextNow;
154
+ t.dispatchEvent(evt);
155
+ })
145
156
  }
146
157
 
147
158
  const searchClickFnOnce = () => {
package/source/js/main.js CHANGED
@@ -1,12 +1,12 @@
1
1
  function set_fest() {
2
2
  let date = new Date();
3
- switch ((date.getMonth() + 1).toString() + '.' + date.getDate()){
3
+ switch ((date.getMonth() + 1).toString() + '.' + date.getDate()) {
4
4
  case '1.8': // 周总理逝世
5
5
  case '9.9': // 毛主席逝世
6
6
  case '7.7': // 七七事变
7
7
  case '9.18': // 九一八事变
8
8
  case '12.13': // 南京大屠杀国家公祭日
9
- {
9
+ {
10
10
  // 创建一个<style>元素
11
11
  const styleElement = document.createElement('style');
12
12
  // 定义要添加的CSS样式
@@ -24,7 +24,8 @@ function set_fest() {
24
24
  styleElement.appendChild(document.createTextNode(css));
25
25
  // 将<style>元素添加到<head>标签中
26
26
  document.head.appendChild(styleElement);
27
- }break;
27
+ }
28
+ break;
28
29
  }
29
30
  }
30
31
 
@@ -338,6 +339,117 @@ class toc {
338
339
  let lastSayHello = "";
339
340
 
340
341
  class sco {
342
+ /**
343
+ * 个性定位
344
+ */
345
+ static card_welcome() {
346
+ /**
347
+ * 请求数据
348
+ */
349
+ ipLoacation = window.saveToLocal.get('ipLocation');
350
+ if (ipLoacation) {
351
+ // 使用 ipLocation
352
+
353
+ } else {
354
+ // 数据已过期或不存在
355
+ var script = document.createElement('script');
356
+ var url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
357
+ script.src = url;
358
+ window.QQmap = function (data) {
359
+ ipLoacation = data;
360
+ // 将数据保存到 localStorage,过期时间设置为 1 天
361
+ window.saveToLocal.set('ipLocation', ipLoacation, 1);
362
+ document.body.removeChild(script);
363
+ delete window.QQmap;
364
+ };
365
+ document.body.appendChild(script);
366
+ }
367
+ showWelcome();
368
+ }
369
+
370
+ /**
371
+ * 那年今日
372
+ * @type {*}
373
+ */
374
+ static card_history() {
375
+ if (document.getElementById('history-container')) {
376
+ 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);
388
+ }
389
+ }
390
+
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);
448
+ }
449
+ let getMonthDate = "S" + getMonth + getDate;
450
+ return ["https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/" + getMonth + ".json", getMonthDate]
451
+ }
452
+
341
453
  /*
342
454
  * 隐藏协议提醒助手
343
455
  */
@@ -389,6 +501,17 @@ class sco {
389
501
  }
390
502
  }
391
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() {
512
+ document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
513
+ }
514
+
392
515
  static sayhi() {
393
516
  document.querySelector("#author-info__sayhi") && (document.getElementById("author-info__sayhi").innerHTML = getTimeState())
394
517
  }
@@ -408,12 +531,14 @@ class sco {
408
531
  'light'
409
532
  if (nowMode === 'light') {
410
533
  document.documentElement.setAttribute('data-theme', 'dark')
411
- localStorage.setItem('theme', 'dark')
534
+ saveToLocal.set('theme', 'dark', 0.5);
412
535
  utils.snackbarShow(GLOBALCONFIG.lang.theme.dark, false, 2000)
536
+ document.querySelector(".menu-darkmode-text").textContent = "深色模式";
413
537
  } else {
414
538
  document.documentElement.setAttribute('data-theme', 'light')
415
- localStorage.setItem('theme', 'light')
539
+ saveToLocal.set('theme', 'light', 0.5);
416
540
  utils.snackbarShow(GLOBALCONFIG.lang.theme.light, false, 2000)
541
+ document.querySelector(".menu-darkmode-text").textContent = "浅色模式";
417
542
  }
418
543
  }
419
544
 
@@ -449,19 +574,16 @@ class sco {
449
574
 
450
575
  static initTheme() {
451
576
  const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
452
- const cachedMode = localStorage.getItem('theme');
453
- const isLightMode = !isDarkMode;
577
+ const cachedMode = saveToLocal.get('theme');
454
578
 
455
- const nowMode =
456
- cachedMode && (cachedMode === 'dark' || cachedMode === 'light')
457
- ? cachedMode === 'dark' && isLightMode ? 'light'
458
- : cachedMode === 'light' && isDarkMode ? 'dark'
459
- : cachedMode
460
- : isDarkMode ? 'dark'
461
- : 'light';
462
-
463
- document.documentElement.setAttribute('data-theme', nowMode);
464
- localStorage.setItem('theme', nowMode);
579
+ if (cachedMode === undefined) {
580
+ const nowMode =
581
+ isDarkMode ? 'dark' : 'light'
582
+ document.documentElement.setAttribute('data-theme', nowMode);
583
+ saveToLocal.set('theme', nowMode, 2);
584
+ } else {
585
+ document.documentElement.setAttribute('data-theme', cachedMode);
586
+ }
465
587
  }
466
588
 
467
589
  static reflashEssayWaterFall() {
@@ -535,6 +657,39 @@ class sco {
535
657
  });
536
658
  }
537
659
 
660
+ /*
661
+ * 图片加水印
662
+ */
663
+ static downloadImage(e, t) {
664
+ rm.hideRightMenu();
665
+ if (0 == rm.downloadimging) {
666
+ rm.downloadimging = !0;
667
+ utils.snackbarShow("正在下载中,请稍后", !1, 1e4);
668
+ setTimeout((function () {
669
+ let o = new Image;
670
+ o.setAttribute("crossOrigin", "anonymous");
671
+ o.onload = function () {
672
+ let e = document.createElement("canvas");
673
+ e.width = o.width;
674
+ e.height = o.height;
675
+ e.getContext("2d").drawImage(o, 0, 0, o.width, o.height);
676
+ let n = e.toDataURL("image/png");
677
+ let a = document.createElement("a");
678
+ let l = new MouseEvent("click");
679
+ a.download = t || "photo";
680
+ a.href = n;
681
+ a.dispatchEvent(l);
682
+ };
683
+ o.src = e;
684
+ utils.snackbarShow("图片已添加盲水印,请遵守版权协议");
685
+ rm.downloadimging = !1;
686
+ }), "10000");
687
+ } else {
688
+ utils.snackbarShow("有正在进行中的下载,请稍后再试");
689
+ }
690
+ }
691
+
692
+
538
693
  static musicToggle() {
539
694
  const $music = document.querySelector('#nav-music'),
540
695
  $meting = document.querySelector('meting-js'),
@@ -544,12 +699,34 @@ class sco {
544
699
  $console.classList.remove("on")
545
700
  wleelw_musicPlaying = false;
546
701
  $meting.aplayer.pause();
702
+ document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-play-fill"></i><span>播放音乐</span>`
547
703
  } else {
548
704
  $music.classList.add("playing")
549
705
  $console.classList.add("on")
550
706
  wleelw_musicPlaying = true;
551
707
  $meting.aplayer.play();
708
+ document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-pause-fill"></i><span>暂停音乐</span>`
709
+ }
710
+ rm.hideRightMenu()
711
+ }
712
+
713
+ static musicSkipBack() {
714
+ document.querySelector('meting-js').aplayer.skipBack()
715
+ rm.hideRightMenu()
716
+ }
717
+
718
+ static musicSkipForward() {
719
+ document.querySelector('meting-js').aplayer.skipForward()
720
+ rm.hideRightMenu()
721
+ }
722
+
723
+ static musicGetName() {
724
+ var e = document.querySelectorAll('.aplayer-title');
725
+ var t = [];
726
+ for (var o = e.length - 1; o >= 0; o--) {
727
+ t[o] = e[o].innerText;
552
728
  }
729
+ return t[0];
553
730
  }
554
731
 
555
732
  static scrollToComment() {
@@ -560,8 +737,8 @@ class sco {
560
737
  class hightlight {
561
738
  static createEle(langEl, item) {
562
739
  const fragment = document.createDocumentFragment()
563
- const highlightCopyEle = '<i class="ri-file-copy-fill"></i>'
564
- const highlightExpandEle = '<i class="ri-arrow-down-s-line expand" style="font-size: 16px"></i>'
740
+ const highlightCopyEle = '<i class="scoicon sco-copy-fill"></i>'
741
+ const highlightExpandEle = '<i class="scoicon sco-arrow-down expand" style="font-size: 16px"></i>'
565
742
 
566
743
  const hlTools = document.createElement('div')
567
744
  hlTools.className = `highlight-tools`
@@ -599,7 +776,7 @@ class hightlight {
599
776
  if (GLOBALCONFIG.hightlight.limit && itemHeight > GLOBALCONFIG.hightlight.limit + 30) {
600
777
  $table.setAttribute('style', `height: ${GLOBALCONFIG.hightlight.limit}px`)
601
778
  ele.className = 'code-expand-btn'
602
- ele.innerHTML = '<i class="ri-arrow-down-double-fill" style="font-size: 1.2rem"></i>'
779
+ ele.innerHTML = '<i class="scoicon sco-show-line" style="font-size: 1.2rem"></i>'
603
780
  ele.addEventListener('click', (e) => {
604
781
  $table.setAttribute('style', `height: ${itemHeight}px`)
605
782
  e.target.className !== 'code-expand-btn' ? e.target.parentNode.classList.add('expand-done') : e.target.classList.add('expand-done')
@@ -668,6 +845,7 @@ window.refreshFn = () => {
668
845
  sco.hideCookie()
669
846
  sco.addPhotoFigcaption()
670
847
  sco.sayhi()
848
+ addRightMenuClickEvent()
671
849
  GLOBALCONFIG.lazyload.enable && sco.lazyloadImg()
672
850
  GLOBALCONFIG.lightbox && sco.lightbox('')
673
851
  GLOBALCONFIG.randomlinks && randomLinksList()
@@ -687,6 +865,10 @@ window.refreshFn = () => {
687
865
  }
688
866
  GLOBALCONFIG.covercolor && coverColor();
689
867
  set_fest()
868
+ sco.initConsoleState()
869
+ if (document.getElementById('history-baidu')) sco.card_history() // 那年今日
870
+ if (document.getElementById('welcome-info')) sco.card_welcome() // 个性定位
871
+ if (GLOBALCONFIG.comment.enable) initializeCommentBarrage() // 热评
690
872
  }
691
873
 
692
874
  sco.initTheme()
@@ -702,4 +884,4 @@ document.addEventListener('pjax:complete', () => {
702
884
 
703
885
  window.onkeydown = function (e) {
704
886
  123 === e.keyCode && utils.snackbarShow("开发者模式已打开,请遵循GPL协议", !1, 3e3)
705
- }
887
+ };