hexo-theme-solitude 1.4.6 → 1.5.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 (87) hide show
  1. package/CONTRIBUTING.md +16 -3
  2. package/README.md +2 -2
  3. package/README_EN.md +2 -2
  4. package/_config.yml +155 -230
  5. package/languages/en-US.yml +5 -2
  6. package/languages/zh-CN.yml +5 -2
  7. package/languages/zh-TW.yml +5 -2
  8. package/layout/404.pug +2 -2
  9. package/layout/includes/footer.pug +8 -6
  10. package/layout/includes/head/config.pug +7 -7
  11. package/layout/includes/head/opengraph.pug +5 -4
  12. package/layout/includes/head/pwa.pug +2 -3
  13. package/layout/includes/inject/body.pug +17 -19
  14. package/layout/includes/inject/head.pug +3 -2
  15. package/layout/includes/mixins/pagination.pug +1 -1
  16. package/layout/includes/nav.pug +3 -3
  17. package/layout/includes/page/says.pug +44 -7
  18. package/layout/includes/sidebar.pug +1 -1
  19. package/layout/includes/widgets/aside/asideInfoCard.pug +4 -3
  20. package/layout/includes/widgets/home/banner.pug +11 -4
  21. package/layout/includes/widgets/home/bbTimeList.pug +13 -7
  22. package/layout/includes/widgets/home/categoryGroup.pug +11 -8
  23. package/layout/includes/widgets/home/hometop.pug +1 -2
  24. package/layout/includes/widgets/home/postList.pug +3 -3
  25. package/layout/includes/widgets/nav/group.pug +13 -0
  26. package/layout/includes/widgets/nav/menu.pug +20 -16
  27. package/layout/includes/widgets/page/about/award.pug +1 -1
  28. package/layout/includes/widgets/page/banner.pug +8 -13
  29. package/layout/includes/widgets/page/equipment/content.pug +1 -1
  30. package/layout/includes/widgets/page/links/linksCard.pug +0 -1
  31. package/layout/includes/widgets/third-party/comments/waline.pug +2 -0
  32. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +2 -2
  33. package/layout/includes/widgets/third-party/news-comment/waline.pug +2 -2
  34. package/layout/includes/widgets/third-party/search/algolia-search.pug +1 -1
  35. package/layout/includes/widgets/third-party/search/local-search.pug +1 -1
  36. package/layout/index.pug +6 -6
  37. package/layout/page.pug +0 -2
  38. package/package.json +1 -1
  39. package/plugins.yml +0 -5
  40. package/scripts/event/init.js +18 -17
  41. package/scripts/event/welcome.js +1 -1
  42. package/scripts/generator/gallery.js +29 -27
  43. package/scripts/helper/getArchiveLength.js +5 -9
  44. package/scripts/helper/related_post.js +28 -39
  45. package/scripts/helper/stylus.js +23 -8
  46. package/source/css/_global/animation.styl +313 -0
  47. package/source/css/_layout/basic.styl +10 -1
  48. package/source/css/_layout/header.styl +5 -5
  49. package/source/css/_layout/index.styl +0 -1
  50. package/source/css/_page/_about/skills.styl +1 -1
  51. package/source/css/_page/_home/category-bar.styl +14 -14
  52. package/source/css/_page/_home/home-top.styl +57 -45
  53. package/source/css/_page/_home/recent-post.styl +1 -1
  54. package/source/css/_page/equipment.styl +3 -2
  55. package/source/css/_page/home.styl +0 -15
  56. package/source/css/_page/index.styl +0 -2
  57. package/source/css/_page/links.styl +9 -8
  58. package/source/css/_page/says.styl +1 -2
  59. package/source/css/_page/share.styl +30 -67
  60. package/source/css/_widgets/_aside/index.styl +1 -1
  61. package/source/css/_widgets/_aside/info.styl +1 -1
  62. package/source/css/_widgets/_comment/twikoo.styl +4 -6
  63. package/source/css/_widgets/_comment/waline.styl +435 -72
  64. package/source/css/_widgets/_extra/console.styl +1 -1
  65. package/source/css/_widgets/_extra/fullpage.styl +1 -1
  66. package/source/css/_widgets/_mixins/footer.styl +1 -1
  67. package/source/css/_widgets/_post/content.styl +1 -11
  68. package/source/css/_widgets/_post/meta.styl +2 -2
  69. package/source/css/_widgets/_post/relatedPost.styl +1 -1
  70. package/source/css/_widgets/_post/tools.styl +1 -1
  71. package/source/css/_widgets/_search/algolia-search.styl +4 -2
  72. package/source/css/_widgets/_tags/note.styl +4 -0
  73. package/source/css/index.styl +0 -1
  74. package/source/js/comment/twikoo_commentBarrage.js +76 -75
  75. package/source/js/covercolor/local.js +11 -10
  76. package/source/js/main.js +27 -35
  77. package/source/js/music.js +89 -49
  78. package/layout/includes/page/rss.pug +0 -20
  79. package/layout/includes/widgets/home/bb/json.pug +0 -25
  80. package/layout/includes/widgets/home/bb/local.pug +0 -20
  81. package/layout/includes/widgets/home/bb/memos.pug +0 -28
  82. package/layout/includes/widgets/nav/left.pug +0 -10
  83. package/layout/includes/widgets/page/says/json.pug +0 -82
  84. package/layout/includes/widgets/page/says/local.pug +0 -44
  85. package/layout/includes/widgets/page/says/memos.pug +0 -111
  86. package/source/css/_global/animation.css +0 -813
  87. package/source/css/_page/rss.styl +0 -82
@@ -1,117 +1,116 @@
1
1
  function initializeCommentBarrage() {
2
2
  window.commentBarrageInitialized = !0;
3
- let e = {
3
+ const e = {
4
4
  maxBarrage: 1,
5
5
  barrageTime: 8e3,
6
6
  twikooUrl: GLOBAL_CONFIG.comment.twikoo.url,
7
7
  pageUrl: window.location.pathname,
8
8
  accessToken: GLOBAL_CONFIG.comment.twikoo.accessToken,
9
9
  };
10
- new class {
11
- commentInterval = null
12
10
 
13
- constructor(e) {
11
+ class CommentBarrage {
12
+ constructor(config) {
14
13
  this.config = {
15
- ...e,
14
+ ...config,
16
15
  barrageTimer: [],
17
16
  barrageList: [],
18
17
  barrageIndex: 0,
19
18
  dom: document.querySelector(".comment-barrage")
20
- },
21
- this.commentInterval = null,
22
- this.hoverOnCommentBarrage = !1,
23
- this.init()
19
+ };
20
+ this.commentInterval = null;
21
+ this.hoverOnCommentBarrage = false;
22
+ this.init();
24
23
  }
25
24
 
26
25
  async fetchComments() {
27
- return fetch(this.config.twikooUrl, {
28
- method: "POST",
29
- headers: {
30
- "Content-Type": "application/json"
31
- },
32
- body: JSON.stringify({
33
- event: "COMMENT_GET",
34
- accessToken: this.config.accessToken,
35
- url: this.config.pageUrl
36
- })
37
- }).then((e => {
38
- if (!e.ok)
39
- throw Error("HTTP error! status: " + e.status);
40
- return e.json()
26
+ try {
27
+ const response = await fetch(this.config.twikooUrl, {
28
+ method: "POST",
29
+ headers: {
30
+ "Content-Type": "application/json"
31
+ },
32
+ body: JSON.stringify({
33
+ event: "COMMENT_GET",
34
+ accessToken: this.config.accessToken,
35
+ url: this.config.pageUrl
36
+ })
37
+ });
38
+ if (!response.ok) {
39
+ throw new Error("HTTP error! status: " + response.status);
41
40
  }
42
- )).then((e => e.data)).catch((e => console.error("An error occurred while fetching comments: ", e)))
41
+ const data = await response.json();
42
+ return data.data;
43
+ } catch (error) {
44
+ console.error("An error occurred while fetching comments: ", error);
45
+ }
43
46
  }
44
47
 
45
- commentLinkFilter(e) {
46
- e.sort(((e, t) => e.created - t.created));
47
- let t = [];
48
- return e.forEach((e => {
49
- t.push(...this.getCommentReplies(e))
50
- }
51
- )),
52
- t
48
+ commentLinkFilter(comments) {
49
+ comments.sort((a, b) => a.created - b.created);
50
+ let filteredComments = [];
51
+ comments.forEach(comment => {
52
+ filteredComments.push(...this.getCommentReplies(comment));
53
+ });
54
+ return filteredComments;
53
55
  }
54
56
 
55
- getCommentReplies(e) {
56
- if (e.replies) {
57
- let comments = [e];
58
- e.replies.forEach((reply) => {
57
+ getCommentReplies(comment) {
58
+ let comments = [comment];
59
+ if (comment.replies) {
60
+ comment.replies.forEach(reply => {
59
61
  comments.push(...this.getCommentReplies(reply));
60
62
  });
61
- return comments;
62
63
  }
63
- return [];
64
+ return comments;
64
65
  }
65
66
 
66
-
67
- processCommentContent(e) {
68
- const t = e.replace(/<blockquote\b[^>]*>[\s\S]*?<\/blockquote>/gi, "")
69
- , r = t.replace(/<[^>]*>/g, "").replace(/\n/g, " ");
70
- return "" === t.trim() ? "" : `<p>${r}</p>`
67
+ processCommentContent(comment) {
68
+ const strippedContent = comment.replace(/<blockquote\b[^>]*>[\s\S]*?<\/blockquote>/gi, "");
69
+ const plainText = strippedContent.replace(/<[^>]*>/g, "").replace(/\n/g, " ");
70
+ return plainText.trim() !== "" ? `<p>${plainText}</p>` : "";
71
71
  }
72
72
 
73
- popCommentBarrage(e) {
74
- var commentContent = this.processCommentContent(e.comment);
75
-
73
+ popCommentBarrage(comment) {
74
+ const commentContent = this.processCommentContent(comment.comment);
76
75
  if (!commentContent.trim()) {
77
76
  return false;
78
77
  }
79
-
80
- let commentBarrageItem = document.createElement("div");
78
+ const commentBarrageItem = document.createElement("div");
81
79
  commentBarrageItem.className = "comment-barrage-item";
82
-
83
80
  commentBarrageItem.innerHTML = `
84
- <div class="barrageHead">
85
- <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>
86
- <div class="barrageNick">${e.nick}</div>
87
- <img class="barrageAvatar" src="https://cravatar.cn/avatar/${e.mailMd5}"/>
88
- <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scoicon sco-close-fill"></i></a>
89
- </div>
90
- <a class="barrageContent" href="javascript:sco.scrollTo('${e.id}');">${commentContent}</a>
91
- `;
92
-
81
+ <div class="barrageHead">
82
+ <a class="barrageTitle" href="javascript:sco.scrollTo('post-comment')">热评</a>
83
+ <div class="barrageNick">${comment.nick}</div>
84
+ <img class="barrageAvatar" src="https://cravatar.cn/avatar/${comment.mailMd5}"/>
85
+ <a class="comment-barrage-close" href="javascript:sco.switchCommentBarrage();"><i class="scoicon sco-close-fill"></i></a>
86
+ </div>
87
+ <a class="barrageContent" href="javascript:sco.scrollTo('${comment.id}');">${commentContent}</a>
88
+ `;
93
89
  this.config.barrageTimer.push(commentBarrageItem);
94
-
95
90
  this.config.dom.appendChild(commentBarrageItem);
96
91
  return true;
97
92
  }
98
93
 
99
- removeCommentBarrage(e) {
100
- e.className = "comment-barrage-item out",
101
- setTimeout((() => {
102
- this.config.dom.removeChild(e)
103
- }
104
- ), 1e3)
94
+ removeCommentBarrage(commentBarrageItem) {
95
+ commentBarrageItem.className = "comment-barrage-item out";
96
+ setTimeout(() => {
97
+ this.config.dom.removeChild(commentBarrageItem);
98
+ }, 1000);
105
99
  }
106
100
 
107
101
  async initCommentBarrage() {
108
- if (localStorage.getItem("commentBarrageSwitch") != null) {
102
+ const commentBarrageSwitch = localStorage.getItem("commentBarrageSwitch");
103
+ if (commentBarrageSwitch != null) {
109
104
  document.querySelector(".comment-barrage").style.display = "flex";
110
- GLOBAL_CONFIG.rightside.enable && (document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评");
105
+ if (GLOBAL_CONFIG.rightside.enable) {
106
+ document.querySelector(".menu-commentBarrage-text").textContent = "关闭热评";
107
+ }
111
108
  document.querySelector("#consoleCommentBarrage").classList.add("on");
112
109
  } else {
113
110
  document.querySelector(".comment-barrage").style.display = "none";
114
- GLOBAL_CONFIG.rightside.enable && (document.querySelector(".menu-commentBarrage-text").textContent = "显示热评");
111
+ if (GLOBAL_CONFIG.rightside.enable) {
112
+ document.querySelector(".menu-commentBarrage-text").textContent = "显示热评";
113
+ }
115
114
  document.querySelector("#consoleCommentBarrage").classList.remove("on");
116
115
  }
117
116
  const comments = await this.fetchComments();
@@ -121,12 +120,13 @@ function initializeCommentBarrage() {
121
120
  this.commentInterval = null;
122
121
  const t = () => {
123
122
  if (this.config.barrageList.length && !this.hoverOnCommentBarrage) {
124
- if (!this.popCommentBarrage(this.config.barrageList[this.config.barrageIndex]))
125
- return this.config.barrageIndex += 1,
126
- this.config.barrageIndex %= this.config.barrageList.length,
127
- void t();
128
- this.config.barrageIndex += 1,
129
- this.config.barrageIndex %= this.config.barrageList.length
123
+ if (!this.popCommentBarrage(this.config.barrageList[this.config.barrageIndex])) {
124
+ this.config.barrageIndex += 1;
125
+ this.config.barrageIndex %= this.config.barrageList.length;
126
+ return t();
127
+ }
128
+ this.config.barrageIndex += 1;
129
+ this.config.barrageIndex %= this.config.barrageList.length;
130
130
  }
131
131
  if (this.config.barrageTimer.length > (this.config.barrageList.length > this.config.maxBarrage ? this.config.maxBarrage : this.config.barrageList.length) && !this.hoverOnCommentBarrage) {
132
132
  this.removeCommentBarrage(this.config.barrageTimer.shift());
@@ -152,5 +152,6 @@ function initializeCommentBarrage() {
152
152
  });
153
153
  }
154
154
  }
155
- (e)
155
+
156
+ new CommentBarrage(e);
156
157
  }
@@ -107,9 +107,6 @@ function colorRgb(str) {
107
107
  }
108
108
 
109
109
  function setThemeColors(value, r = null, g = null, b = null) {
110
- const cardContents = document.getElementsByClassName('card-content');
111
- const authorInfo = document.getElementsByClassName('author-info__sayhi');
112
-
113
110
  if (value) {
114
111
  document.documentElement.style.setProperty('--sco-main', value);
115
112
  document.documentElement.style.setProperty('--sco-main-op', value + '23');
@@ -118,13 +115,17 @@ function setThemeColors(value, r = null, g = null, b = null) {
118
115
 
119
116
  if (r && g && b) {
120
117
  let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
121
- for (let i = 0; i < cardContents.length; i++) {
122
- cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
123
- }
124
-
125
- for (let i = 0; i < authorInfo.length; i++) {
126
- authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
127
- authorInfo[i].style.setProperty('color', 'var(--sco-white)');
118
+ if (brightness < 125) {
119
+ let cardContents = document.getElementsByClassName('card-content');
120
+ for (let i = 0; i < cardContents.length; i++) {
121
+ cardContents[i].style.setProperty('--sco-card-bg', 'var(--sco-white)');
122
+ }
123
+
124
+ let authorInfo = document.getElementsByClassName('author-info__sayhi');
125
+ for (let i = 0; i < authorInfo.length; i++) {
126
+ authorInfo[i].style.setProperty('background', 'var(--sco-white-op)');
127
+ authorInfo[i].style.setProperty('color', 'var(--sco-white)');
128
+ }
128
129
  }
129
130
  }
130
131
 
package/source/js/main.js CHANGED
@@ -64,45 +64,37 @@ const scrollFn = function () {
64
64
  }
65
65
  }
66
66
 
67
- let ticking = false;
68
-
69
67
  const percent = () => {
70
- if (!ticking) {
71
- window.requestAnimationFrame(() => {
72
- let scrollTop = document.documentElement.scrollTop || window.pageYOffset;
73
- 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;
74
- let scrollPercent = Math.round(scrollTop / totalHeight * 100);
75
- let percentElement = document.querySelector("#percent");
76
- let viewportBottom = window.scrollY + document.documentElement.clientHeight;
77
- let remainingScroll = totalHeight - scrollTop;
78
-
79
- if ((document.getElementById("post-comment") || document.getElementById("footer")).offsetTop < viewportBottom || scrollPercent > 90) {
80
- document.querySelector("#nav-totop").classList.add("long");
81
- percentElement.innerHTML = "返回顶部";
82
- } else {
83
- document.querySelector("#nav-totop").classList.remove("long");
84
- if (scrollPercent >= 0) {
85
- percentElement.innerHTML = scrollPercent + "";
86
- }
87
- }
68
+ let scrollTop = document.documentElement.scrollTop || window.pageYOffset
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
70
+ let scrollPercent = Math.round(scrollTop / totalHeight * 100)
71
+ let percentElement = document.querySelector("#percent")
72
+ let viewportBottom = window.scrollY + document.documentElement.clientHeight
73
+ let remainingScroll = totalHeight - scrollTop
74
+
75
+ if ((document.getElementById("post-comment") || document.getElementById("footer")).offsetTop < viewportBottom || scrollPercent > 90) {
76
+ document.querySelector("#nav-totop").classList.add("long")
77
+ percentElement.innerHTML = "返回顶部"
78
+ } else {
79
+ document.querySelector("#nav-totop").classList.remove("long")
80
+ if (scrollPercent >= 0) {
81
+ percentElement.innerHTML = scrollPercent + ""
82
+ }
83
+ }
88
84
 
89
- let elementsToHide = document.querySelectorAll(".needEndHide");
90
- if (remainingScroll < 100) {
91
- elementsToHide.forEach(function (element) {
92
- element.classList.add("hide");
93
- });
94
- } else {
95
- elementsToHide.forEach(function (element) {
96
- element.classList.remove("hide");
97
- });
98
- }
99
- ticking = false;
100
- });
101
- ticking = true;
85
+ let elementsToHide = document.querySelectorAll(".needEndHide")
86
+ if (remainingScroll < 100) {
87
+ elementsToHide.forEach(function (element) {
88
+ element.classList.add("hide")
89
+ })
90
+ } else {
91
+ elementsToHide.forEach(function (element) {
92
+ element.classList.remove("hide")
93
+ })
102
94
  }
103
- };
104
95
 
105
- window.onscroll = percent;
96
+ window.onscroll = percent
97
+ }
106
98
 
107
99
 
108
100
  const showTodayCard = () => {
@@ -1,93 +1,135 @@
1
- var vh = window.innerHeight * 1;
2
- var scoMusic = {
3
- // 获取地址栏参数
4
- // 创建URLSearchParams对象并传入URL中的查询字符串
1
+ const scoMusic = {
5
2
  params: new URLSearchParams(window.location.search),
6
- extractValue: function (input) {
7
- var valueRegex = /\("([^\s]+)"\)/g;
8
- var match = valueRegex.exec(input);
3
+ extractValue: (input) => {
4
+ const valueRegex = /\("([^\s]+)"\)/g;
5
+ const match = valueRegex.exec(input);
9
6
  return match[1];
10
7
  },
11
- changeMusicBg: function (isChangeBg = true) {
12
- const MusicBg = document.getElementById("Music-bg")
13
- const MusicLoading = document.getElementsByClassName("Music-loading")
8
+ changeMusicBg: (isChangeBg = true) => {
9
+ const MusicBg = document.getElementById("Music-bg");
10
+ const MusicLoading = document.getElementsByClassName("Music-loading");
14
11
 
15
12
  if (isChangeBg) {
16
13
  const musiccover = document.querySelector("#Music-page .aplayer-pic");
17
- var img = new Image();
14
+ const img = new Image();
18
15
  img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
19
- img.onload = function () {
16
+ img.onload = () => {
20
17
  MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
21
18
  };
22
19
  } else {
23
- let timer = setInterval(() => {
20
+ const timer = setInterval(() => {
24
21
  const musiccover = document.querySelector("#Music-page .aplayer-pic");
25
- // 确保player加载完成
26
22
  if (musiccover) {
27
23
  MusicLoading[0].style.display = "none";
28
- clearInterval(timer)
29
- document.querySelector('meting-js')
30
- .aplayer.volume(0.8, true);
24
+ clearInterval(timer);
25
+ document.querySelector('meting-js').aplayer.volume(0.8, true);
31
26
 
32
27
  scoMusic.addEventListenerChangeMusicBg();
33
28
  MusicBg.style.display = "block";
34
29
  }
35
- }, 100)
30
+ }, 100);
36
31
  }
37
32
  },
38
- lrcupdate: function () {
39
- var aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
40
- var currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
33
+ lrcupdate: () => {
34
+ const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
35
+ const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
41
36
 
42
37
  if (currentLrc) {
43
- var currentIndex = Array.from(aplayerLrcContents.children)
44
- .indexOf(currentLrc);
45
- var translateYValue = -currentIndex * 80;
38
+ const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
39
+ const translateYValue = -currentIndex * 80;
46
40
 
47
- aplayerLrcContents.style.transform = 'translateY(' + translateYValue + 'px)';
41
+ aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
48
42
  }
49
43
  },
50
- buttonlist: function () {
51
- document.querySelector(".aplayer-lrc")
52
- .addEventListener("click", function () {
53
- const aplayerList = document.querySelector(".aplayer-list");
44
+ buttonlist: () => {
45
+ const aplayerList = document.querySelector(".aplayer-list");
46
+ if (aplayerList) {
47
+ document.querySelector(".aplayer-lrc").addEventListener("click", () => {
48
+ if (aplayerList.classList.contains("aplayer-list-hide")) {
49
+ aplayerList.classList.remove("aplayer-list-hide");
50
+ } else {
51
+ aplayerList.classList.add("aplayer-list-hide");
52
+ }
53
+ });
54
+ }
55
+ },
56
+ extractValue: (input) => {
57
+ const valueRegex = /\("([^\s]+)"\)/g;
58
+ const match = valueRegex.exec(input);
59
+ return match[1];
60
+ },
61
+ changeMusicBg: (isChangeBg = true) => {
62
+ const MusicBg = document.getElementById("Music-bg");
63
+ const MusicLoading = document.getElementsByClassName("Music-loading");
64
+
65
+ if (isChangeBg) {
66
+ const musiccover = document.querySelector("#Music-page .aplayer-pic");
67
+ const img = new Image();
68
+ img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
69
+ img.onload = () => {
70
+ MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
71
+ };
72
+ } else {
73
+ const timer = setInterval(() => {
74
+ const musiccover = document.querySelector("#Music-page .aplayer-pic");
75
+ if (musiccover) {
76
+ MusicLoading[0].style.display = "none";
77
+ clearInterval(timer);
78
+ document.querySelector('meting-js').aplayer.volume(0.8, true);
79
+
80
+ scoMusic.addEventListenerChangeMusicBg();
81
+ MusicBg.style.display = "block";
82
+ }
83
+ }, 100);
84
+ }
85
+ },
86
+ lrcupdate: () => {
87
+ const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
88
+ const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
89
+
90
+ if (currentLrc) {
91
+ const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
92
+ const translateYValue = -currentIndex * 80;
54
93
 
94
+ aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
95
+ }
96
+ },
97
+ buttonlist: () => {
98
+ const aplayerList = document.querySelector(".aplayer-list");
99
+ if (aplayerList) {
100
+ document.querySelector(".aplayer-lrc").addEventListener("click", () => {
55
101
  if (aplayerList.classList.contains("aplayer-list-hide")) {
56
102
  aplayerList.classList.remove("aplayer-list-hide");
57
103
  } else {
58
104
  aplayerList.classList.add("aplayer-list-hide");
59
105
  }
60
106
  });
107
+ }
61
108
  },
62
- addEventListenerChangeMusicBg: function () {
63
- const aplayer = document.getElementById("Music-page").querySelector("meting-js").aplayer
64
- aplayer.on('loadeddata', function () {
109
+ addEventListenerChangeMusicBg: () => {
110
+ const aplayer = document.getElementById("Music-page").querySelector("meting-js").aplayer;
111
+ aplayer.on('loadeddata', () => {
65
112
  scoMusic.changeMusicBg();
66
113
  });
67
- aplayer.on('timeupdate', function () {
114
+ aplayer.on('timeupdate', () => {
68
115
  scoMusic.lrcupdate();
69
116
  });
70
- scoMusic.buttonlist();
71
117
  },
72
- getCustomPlayList: function () {
118
+ getCustomPlayList: () => {
73
119
  const MusicPage = document.getElementById("Music-page");
74
120
  const playlistType = scoMusic.params.get("type") || "playlist";
75
121
 
76
122
  if (scoMusic.params.get("id") && params.get("server")) {
77
- var id = scoMusic.params.get("id")
78
- var server = scoMusic.params.get("server")
123
+ const id = scoMusic.params.get("id");
124
+ const server = scoMusic.params.get("server");
79
125
  MusicPage.innerHTML = `<meting-js id="${id}" server="${server}" type="${playlistType}" preload="auto" order="random"></meting-js>`;
80
126
  } else {
81
127
  MusicPage.innerHTML = `<meting-js id="${musicConfig.userId}" server="${musicConfig.userServer}" type="${musicConfig.userType}" preload="auto" order="random"></meting-js>`;
82
128
  }
83
129
  scoMusic.changeMusicBg(false);
84
130
  },
85
- /**
86
- * 绑定键盘事件
87
- * @param event
88
- */
89
- setKeydown: function (event) {
90
- const aplayer = document.querySelector('meting-js').aplayer
131
+ setKeydown: (event) => {
132
+ const aplayer = document.querySelector('meting-js').aplayer;
91
133
  if (event.code === "Space") {
92
134
  event.preventDefault();
93
135
  aplayer.toggle();
@@ -113,15 +155,13 @@ var scoMusic = {
113
155
  }
114
156
  }
115
157
  },
116
- init: function () {
158
+ init: () => {
159
+ let vh = window.innerHeight * 1;
117
160
  document.documentElement.style.setProperty('--vh', `${vh}px`);
118
- // 初始化
119
- this.getCustomPlayList();
120
-
121
- //热键控制音乐
161
+ scoMusic.getCustomPlayList();
122
162
  document.addEventListener("keydown", scoMusic.setKeydown);
123
163
  }
124
- }
164
+ };
125
165
 
126
166
  window.addEventListener('resize', () => {
127
167
  let vh = window.innerHeight * 1;
@@ -1,20 +0,0 @@
1
- .rss-plan-list
2
- a.rss-plan-item.rss-plan-wechat(href=page.wechatOA, title="公众号")
3
- .rss-plan-description 推送精选文章<br>推送全文
4
- .rss-plan-info-group
5
- .rss-plan-title 公众号订阅
6
- .rss-plan-info 推荐的订阅方式
7
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d14a4de78.png", alt="wechat")
8
- a.rss-plan-item.rss-plan-mail(href=page.emailOA, title="email")
9
- .rss-plan-description 推送全部文章<br>推送封面与简介
10
- .rss-plan-info-group
11
- .rss-plan-title 邮件订阅
12
- .rss-plan-info 推荐的订阅方式
13
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d16c3ea22.png", alt="email")
14
- a.rss-plan-item.rss-plan-rss(href=page.rssOA, title="rss")
15
- .rss-plan-description 推送全部文章<br>推送简介
16
- .rss-plan-info-group
17
- .rss-plan-title RSS
18
- .rss-plan-info 备用订阅方式
19
- img.rss-plan-icon(src="https://bu.dusays.com/2023/11/01/6541d184e2a09.png", alt="rss")
20
- != page.content
@@ -1,25 +0,0 @@
1
- script.
2
- async function getSays () {
3
- document.addEventListener('DOMContentLoaded', this)
4
- document.addEventListener('pjax:complete', this)
5
- const htmlTagRegex = /<[^>]+>/g;
6
- document.querySelector('#bber-talk').innerHTML = '<div class="li-style swiper-slide"><i class="scoicon sco-loading-line"></i></div>';
7
- await fetch('!{theme.says.mode_link}')
8
- .then(res => res.json())
9
- .then(res => {
10
- let list = res.filter(item => item.content).slice(0, 10);
11
-
12
- document.querySelector('#bber-talk').innerHTML = list.map(item => {
13
- let content = item.content ? item.content.replace(htmlTagRegex, '') : '';
14
- content += item.image ? '<i class="scoicon scp-image-fill"></i>' : '';
15
- content += item.aplayer ? '<i class="scoicon sco-disc-fill"></i>' : '';
16
- content += item.video ? '<i class="scoicon sco-video-fill"></i>' : '';
17
- content += item.bilibili ? '<i class="scoicon sco-bilibili-line"></i>' : '';
18
- content += item.link ? `<i class="scoicon sco-link"></i>` : '';
19
- return `<div class="li-style swiper-slide">${content}</div>`;
20
- }).join('');
21
- sco.initbbtalk();
22
- }).catch(err => console.log('bbtime |', err));
23
- }
24
- document.addEventListener('DOMContentLoaded', getSays)
25
- document.addEventListener('pjax:complete', getSays)
@@ -1,20 +0,0 @@
1
- each item, i in site.data.essay.essay_list.slice(0, 10)
2
- .li-style.swiper-slide
3
- | #{item.content}
4
- if item.image
5
- i.scoicon.sco-image-fill
6
- if item.aplayer
7
- i.scoicon.sco-disc-fill
8
- if item.video
9
- i.scoicon.sco-video-fill
10
- if item.bilibili
11
- i.scoicon.sco-bilibili-line
12
- if item.link
13
- i.scoicon.sco-links
14
- script.
15
- document.addEventListener('DOMContentLoaded',()=>{
16
- sco.initbbtalk();
17
- })
18
- document.addEventListener('pjax:complete',()=>{
19
- sco.initbbtalk();
20
- })
@@ -1,28 +0,0 @@
1
- script.
2
- async function getSays() {
3
- document.querySelector('#bber-talk').innerHTML = '<div class="li-style swiper-slide"><i class="scoicon sco-loading-line"></i></div>'
4
- await fetch('!{theme.says.mode_link}')
5
- .then(response => response.json())
6
- .then(data => {
7
- let aplayerRegex = /{aplayer,(.*?),(.*?)}/g;
8
- let bilibiliRegex = /{bilibili,(.*?)}/g;
9
- let playerRegex = /{player,(.*?)}/g;
10
- let linkRegex = /(?<!\!)\[([^\]]*)\]\(([^\)]*)\)/g;
11
- let imageRegex = /!\[\]\((.*?)\)/g;
12
- let contentRegex = /#.*?\s([^{\n]*)/g
13
- const list = data.slice(0, 10)
14
- document.querySelector('#bber-talk').innerHTML = list.map(item => {
15
- let content = item.content.match(contentRegex, '$1').map(item => item.replace(contentRegex, '$1'));
16
- let imageBox = item.content.match(imageRegex) ? '<i class="scoicon sco-image-fill"></i>' : '';
17
- let aplayer = item.content.match(aplayerRegex) ? '<i class="scoicon sco-disc-fill"></i>' : '';
18
- let video = item.content.match(playerRegex) ? '<i class="scoicon sco-video-fill"></i>' : item.content.match(bilibiliRegex) ? '<i class="scoicon sco-bilibili-line"></i>' : '';
19
- let link = item.content.match(linkRegex) ? `<i class="scoicon sco-link"></i>` : '';
20
-
21
- return `<div class="li-style swiper-slide">${content + aplayer + video + imageBox + link}</div>`
22
- }).join(' ')
23
- sco.initbbtalk();
24
- })
25
- .catch(error => console.error('bbtime | ', error));
26
- }
27
- document.addEventListener('DOMContentLoaded', getSays)
28
- document.addEventListener('pjax:complete', getSays)
@@ -1,10 +0,0 @@
1
- .back-menu-list-groups
2
- - var menu = theme.nav && theme.nav.left && theme.nav.left.menu ? theme.nav.left.menu : {}
3
- each groupData, x in menu
4
- .back-menu-list-group
5
- .back-menu-list-title= x
6
- .back-menu-list
7
- each data, y in groupData
8
- a.back-menu-item(href=url_for(data.url), title=y)
9
- img.back-menu-item-icon(src=data.icon, alt=x)
10
- span.back-menu-item-text= y