hexo-theme-solitude 1.5.5 → 1.5.7

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.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- 简体中文丨[繁体中文](README_zh-tw.md)丨[English](README_EN.md)
1
+ [简体中文](README_zh-cn.md)丨[繁体中文](README_zh-tw.md)丨English
2
2
 
3
3
  <div align="center">
4
4
 
5
5
  <img src=".github/logo.svg" alt="Solitude logo" height="200">
6
6
 
7
- <h1 align="center">Hexo Theme Solitude</h1>
7
+ <h1 align="center">Hexo Theme Solitude</h1>
8
8
 
9
- <p align="center">一款优雅的 Hexo 主题,支持懒加载、PWALatex以及多种评论系统。</p>
9
+ <p align="center">An elegant Hexo theme that supports lazy loading, PWA, Latex, and multiple comment systems.</p>
10
10
 
11
11
  ![release](https://img.shields.io/github/package-json/v/valor-x/hexo-theme-solitude/master?color=%231ab1ad&label=release)
12
12
  ![https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff)
@@ -15,47 +15,47 @@
15
15
  [![Stars](https://img.shields.io/github/stars/valor-x/hexo-theme-solitude)](https://github.com/valor-x/hexo-theme-solitude/stargazers)
16
16
  [![GitHub all releases](https://img.shields.io/github/downloads/valor-x/hexo-theme-solitude/total)](https://github.com/valor-x/hexo-theme-solitude/releases/latest)
17
17
 
18
- [预览](https://solitude-demo.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
18
+ [Preview](https://solitude-demo.efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
19
19
 
20
20
  </div>
21
21
 
22
22
  ![Screenshot](.github/screenshot.png)
23
23
 
24
- ## 特性
24
+ ## Features
25
25
 
26
- - 页面懒加载(Pjax)、图片懒加载(LazyLoad)、离线应用(PWA
27
- - 评论(Twikoo、Waline)
28
- - 显示切换(ColorMode)
29
- - 灯箱(medium-zoom、fancybox)
30
- - 数学公式(Latex)
31
- - 特色页面:即刻短文、我的装备、在线工具、音乐馆、友链鱼塘、相册页、豆瓣页
32
- - 文章功能:AI 摘要、代码高亮
26
+ - PjaxLazyLoadPWA
27
+ - Comments(Twikoo、Waline)
28
+ - ColorMode
29
+ - Lightbox(medium-zoom、fancybox)
30
+ - Mathematical formulas(Latex)
31
+ - Featured pages: Instant Short Article, My Equipment, Online Tools, Music Gallery, Friend Chain Fish Pond, Photo Album Page, Douban Page
32
+ - Article features: AI summary, code highlighting
33
33
 
34
34
  ## Todo
35
35
 
36
- - [x] Waline 评论支持
37
- - [ ] Tags plugin 插件化
38
- - [ ] 相册页重构
36
+ - [x] Support Waline
37
+ - [ ] Tags plugin
38
+ - [ ] Album reconstruction(Removed, to be refactored)
39
39
 
40
- ## 应用
40
+ ## Setup
41
41
 
42
- 1. 使用 NPM 包进行安装
42
+ 1. Use the NPM package
43
43
  ```bash
44
44
  npm i hexo-theme-solitude
45
45
  ```
46
- 2. 应用主题
46
+ 2. Apply
47
47
  ```yaml
48
48
  theme: solitude
49
49
  ```
50
-
51
- 前往 [文档](https://solitude-docs.efu.me/) 获取更多信息。
52
50
 
53
- ## 贡献者
51
+ Check out the [Documentation](https://solitude-docs.efu.me/) for more information.
52
+
53
+ ## Contributors
54
54
 
55
55
  <a href="https://github.com/valor-x/hexo-theme-solitude/graphs/contributors">
56
56
  <img alt="contributors" src="https://contrib.rocks/image?repo=valor-x/hexo-theme-solitude" />
57
57
  </a>
58
58
 
59
- **主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!**
59
+ **Theme is fully licensed and designed by the author of [@张洪Heo](https://github.com/zhheo)!**
60
60
 
61
- > 欢迎你对本主题做出贡献![贡献指南](/CONTRIBUTING.md)
61
+ > You are welcome to contribute to this topic! [Contribution Guide](/CONTRIBUTING.md)
@@ -1,12 +1,12 @@
1
- [简体中文](README.md)丨[繁体中文](README_zh-tw.md)丨English
1
+ 简体中文丨[繁体中文](README_zh-tw.md)丨[English](README.md)
2
2
 
3
3
  <div align="center">
4
4
 
5
5
  <img src=".github/logo.svg" alt="Solitude logo" height="200">
6
6
 
7
- <h1 align="center">Hexo Theme Solitude</h1>
7
+ <h1 align="center">Hexo Theme Solitude</h1>
8
8
 
9
- <p align="center">An elegant Hexo theme that supports lazy loading, PWA, Latex, and multiple comment systems.</p>
9
+ <p align="center">一款优雅的 Hexo 主题,支持懒加载、PWALatex以及多种评论系统。</p>
10
10
 
11
11
  ![release](https://img.shields.io/github/package-json/v/valor-x/hexo-theme-solitude/master?color=%231ab1ad&label=release)
12
12
  ![https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-solitude?color=%09%23bf00ff)
@@ -15,47 +15,47 @@
15
15
  [![Stars](https://img.shields.io/github/stars/valor-x/hexo-theme-solitude)](https://github.com/valor-x/hexo-theme-solitude/stargazers)
16
16
  [![GitHub all releases](https://img.shields.io/github/downloads/valor-x/hexo-theme-solitude/total)](https://github.com/valor-x/hexo-theme-solitude/releases/latest)
17
17
 
18
- [Preview](https://solitude-demo.efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
18
+ [预览](https://solitude-demo.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
19
19
 
20
20
  </div>
21
21
 
22
22
  ![Screenshot](.github/screenshot.png)
23
23
 
24
- ## Features
24
+ ## 特性
25
25
 
26
- - PjaxLazyLoadPWA
27
- - Comments(Twikoo、Waline)
28
- - ColorMode
29
- - Lightbox(medium-zoom、fancybox)
30
- - Mathematical formulas(Latex)
31
- - Featured pages: Instant Short Article, My Equipment, Online Tools, Music Gallery, Friend Chain Fish Pond, Photo Album Page, Douban Page
32
- - Article features: AI summary, code highlighting
26
+ - 页面懒加载(Pjax)、图片懒加载(LazyLoad)、离线应用(PWA
27
+ - 评论(Twikoo、Waline)
28
+ - 显示切换(ColorMode)
29
+ - 灯箱(medium-zoom、fancybox)
30
+ - 数学公式(Latex)
31
+ - 特色页面:即刻短文、我的装备、在线工具、音乐馆、友链鱼塘、相册页、豆瓣页
32
+ - 文章功能:AI 摘要、代码高亮
33
33
 
34
34
  ## Todo
35
35
 
36
- - [x] Support Waline
37
- - [ ] Tags plugin
38
- - [ ] Album reconstruction
36
+ - [x] Waline 评论支持
37
+ - [ ] Tags plugin 插件化
38
+ - [ ] 相册页重构(已移除,待重构)
39
39
 
40
- ## Setup
40
+ ## 应用
41
41
 
42
- 1. Use the NPM package
42
+ 1. 使用 NPM 包进行安装
43
43
  ```bash
44
44
  npm i hexo-theme-solitude
45
45
  ```
46
- 2. Apply
46
+ 2. 应用主题
47
47
  ```yaml
48
48
  theme: solitude
49
49
  ```
50
+
51
+ 前往 [文档](https://solitude-docs.efu.me/) 获取更多信息。
50
52
 
51
- Check out the [Documentation](https://solitude-docs.efu.me/) for more information.
52
-
53
- ## Contributors
53
+ ## 贡献者
54
54
 
55
55
  <a href="https://github.com/valor-x/hexo-theme-solitude/graphs/contributors">
56
56
  <img alt="contributors" src="https://contrib.rocks/image?repo=valor-x/hexo-theme-solitude" />
57
57
  </a>
58
58
 
59
- **Theme is fully licensed and designed by the author of [@张洪Heo](https://github.com/zhheo)!**
59
+ **主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!**
60
60
 
61
- > You are welcome to contribute to this topic! [Contribution Guide](/CONTRIBUTING.md)
61
+ > 欢迎你对本主题做出贡献![贡献指南](/CONTRIBUTING.md)
package/README_zh-tw.md CHANGED
@@ -1,4 +1,4 @@
1
- [简体中文](README.md)丨繁体中文丨[English](README_EN.md)
1
+ [简体中文](README_zh-cn.md)丨繁体中文丨[English](README.md)
2
2
 
3
3
  <div align="center">
4
4
 
@@ -35,7 +35,7 @@
35
35
 
36
36
  - [x] Waline 評論支援
37
37
  - [ ] Tags plugin 外掛程式化
38
- - [ ] 相冊頁重構
38
+ - [ ] 相冊頁重構(已移除,待重構)
39
39
 
40
40
  ## 應用
41
41
 
@@ -20,9 +20,6 @@ div
20
20
  if theme.mermaid
21
21
  script(src=url_for(theme.cdn.mermaid_js))
22
22
 
23
- if theme.album.enable
24
- script(src=url_for(theme.cdn.macy_js))
25
-
26
23
  if theme.rightside.enable
27
24
  include ../widgets/rightside/index
28
25
  script(src=url_for(theme.cdn.rightside_js))
@@ -116,9 +113,6 @@ div#js-pjax
116
113
  if theme.mermaid
117
114
  script.
118
115
  mermaid.run();
119
- if page.type === 'album' && theme.album.enable
120
- script.
121
- initGallery()
122
116
  if is_home() && theme.says.home_mini
123
117
  script.
124
118
  sco.initbbtalk();
@@ -78,7 +78,7 @@ script.
78
78
  )(window)
79
79
 
80
80
  console.log(
81
- "%c Program: Hexo %c Theme: Solitude %c Version: v1.5.5",
81
+ "%c Program: Hexo %c Theme: Solitude %c Version: v1.5.7",
82
82
  "border-radius:5px 0 0 5px;padding: 5px 10px;color:white;background:#ff3842;",
83
83
  "padding: 5px 10px;color:white;background:#3e9f50;",
84
84
  "border-radius:0 5px 5px 0;padding: 5px 10px;background:#0084ff;color:white;"
@@ -1,16 +1,6 @@
1
1
  if theme.music.enable
2
2
  #Music-bg
3
3
  #Music-page
4
+ meting-js(id=theme.music.id, server=theme.music.server, type=theme.music.type, mutex=theme.music.mutex, volume=theme.music.volume, preload="none", data-lrctype="0", order="random")
4
5
  .Music-loading
5
- div APlayer加载中...
6
-
7
- script.
8
- if (!window.musicConfig) {
9
- window.musicConfig = {
10
- userId: '#{theme.music.id}',
11
- userServer: "#{theme.music.server}",
12
- userType: "#{theme.music.type}",
13
- volume: #{theme.music.volume},
14
- mutex: #{theme.music.mutex}
15
- }
16
- }
6
+ div APlayer加载中...
@@ -24,7 +24,7 @@ if theme.says.enable
24
24
 
25
25
  if item.aplayer
26
26
  .bber-music
27
- meting-js(server=item.aplayer.server type="song" id=item.aplayer.id mutex="true" preload="none" theme="var(--st-main)" data-lrctype="0")
27
+ meting-js(server=item.aplayer.server type="song" id=item.aplayer.id mutex="true" preload="none" theme="var(--efu-main)" data-lrctype="0")
28
28
 
29
29
  if item.video
30
30
  .bber-video
@@ -14,7 +14,7 @@ if site.data.about.rewardList
14
14
  .reward-list-item
15
15
  .reward-list-item-name= reward.name
16
16
  .reward-list-bottom-group
17
- .reward-list-item-money(style=(reward.vip ? "background: var(--st-vip);color: var(--st-white)" : ""))
17
+ .reward-list-item-money(style=(reward.vip ? "background: var(--efu-vip);color: var(--efu-white)" : ""))
18
18
  if reward.icon
19
19
  i.solitude(class=reward.icon)
20
20
  | ¥ #{reward.money}
@@ -7,7 +7,7 @@ if personalities
7
7
  span.author-content-item-title= personalities.title
8
8
  .title2(style=`color:${personalities.color}`)= personalities.type
9
9
  .image
10
- img(src=personalities.image)
10
+ img.nolazyload(src=personalities.image)
11
11
  .post-tips
12
12
  | 在
13
13
  a(href="https://www.16personalities.com/")= personalities.linkText
@@ -1,3 +1,3 @@
1
1
  div.needEndHide#nav-music(onclick="sco.musicToggle()")
2
2
  div#nav-music-hoverTips=__('music.hit')
3
- meting-js(id=theme.capsule.id, server=theme.capsule.server, type="playlist", mutex="true", preload="none", data-lrctype="0", order="random", theme="var(--st-main)")
3
+ meting-js(id=theme.capsule.id, server=theme.capsule.server, type="playlist", mutex="true", preload="none", data-lrctype="0", order="random", theme="var(--efu-main)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-solitude",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "A beautiful, powerful, and efficient Hexo theme developed by the wleelw",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -58,6 +58,10 @@ minWidth1200()
58
58
  @media screen and (min-width: 1200px)
59
59
  {block}
60
60
 
61
+ minWidth1201()
62
+ @media screen and (min-width: 1201px)
63
+ {block}
64
+
61
65
  maxWidth1024()
62
66
  @media screen and (max-width: 1024px)
63
67
  {block}
@@ -65,23 +65,8 @@
65
65
  &:hover
66
66
  transform scale(1.1)
67
67
 
68
- +maxWidth768()
69
- width 120px
70
- height 120px
71
-
72
- &::before
73
- bottom -5px
74
- right -5px
75
-
76
- img
77
- border-radius 200px
78
-
79
68
  &::before
80
69
  content ''
81
- -webkit-transition 1s
82
- -moz-transition 1s
83
- -o-transition 1s
84
- -ms-transition 1s
85
70
  transition 1s
86
71
  width 30px
87
72
  height 30px
@@ -91,4 +76,17 @@
91
76
  border 5px solid var(--efu-background)
92
77
  bottom 5px
93
78
  right 10px
94
- z-index 2
79
+ z-index 2
80
+
81
+ +maxWidth768()
82
+ width 120px
83
+ height 120px
84
+
85
+ &::before
86
+ bottom -2px
87
+ right -2px
88
+ width 20px
89
+ height 20px
90
+
91
+ img
92
+ border-radius 200px
@@ -21,9 +21,9 @@
21
21
  display none
22
22
 
23
23
  / #bannerGroup
24
- display flex
24
+ display none
25
25
 
26
- +minWidth1200()
26
+ +minWidth1201()
27
27
  width calc(50% - .25rem)
28
28
  margin-right .5rem
29
29
  height calc(328px + .5rem)
@@ -50,7 +50,7 @@
50
50
  flex-direction column
51
51
  justify-content space-between
52
52
  min-width 200px
53
- +minWidth1200()
53
+ +minWidth1201()
54
54
  display none
55
55
  +maxWidth768()
56
56
  min-width 130px
@@ -128,7 +128,7 @@
128
128
  /.topGroup
129
129
  display: flex
130
130
 
131
- +minWidth1200()
131
+ +minWidth1201()
132
132
  display flex
133
133
  flex-direction row
134
134
  flex-wrap wrap
@@ -216,7 +216,7 @@
216
216
  .todayCard
217
217
  display none
218
218
 
219
- +minWidth1200()
219
+ +minWidth1201()
220
220
  position absolute
221
221
  width 100%
222
222
  z-index 3
@@ -26,7 +26,6 @@ body[data-type=music]
26
26
  left -50%
27
27
  background-size 40%
28
28
  transition 0.6s
29
- background-image url(https://bu.dusays.com/2023/11/08/654af68b25bb8.jpg)
30
29
 
31
30
  &:before
32
31
  content ''
@@ -54,6 +53,7 @@ body[data-type=music]
54
53
 
55
54
  .aplayer-body
56
55
  width 70%
56
+ height 88vh
57
57
 
58
58
  +maxWidth798()
59
59
  width 100%
@@ -64,10 +64,10 @@ body[data-type=music]
64
64
  left 0
65
65
  right 0
66
66
  top 0
67
- height calc(var(--vh) - 250px)
67
+ height 75vh
68
68
 
69
69
  ol
70
- max-height calc(var(--vh) - 170px)!important
70
+ max-height 88vh !important
71
71
 
72
72
  +maxWidth798()
73
73
  max-height 100%!important
@@ -194,7 +194,7 @@ body[data-type=music]
194
194
  +maxWidth798()
195
195
  display flex
196
196
  position fixed
197
- top calc(var(--vh) - 178px)
197
+ top 88vh
198
198
  left 0
199
199
  margin 0
200
200
  margin-left 32px
@@ -229,7 +229,7 @@ body[data-type=music]
229
229
 
230
230
  .aplayer-lrc
231
231
  padding-top 240px
232
- height var(--vh)
232
+ height 100vh
233
233
 
234
234
  +maxWidth798()
235
235
  margin-top 0
@@ -254,7 +254,7 @@ body[data-type=music]
254
254
  opacity 0.3
255
255
  transition all 0.9s cubic-bezier(0.56, 0.17, 0.22, 0.76)
256
256
  user-select none
257
- text-shadow 0px 4px 0px #ffffff00
257
+ text-shadow 0 4px 0 #ffffff00
258
258
  overflow hidden
259
259
 
260
260
  +maxWidth798()
@@ -414,10 +414,10 @@ body[data-type=music]
414
414
  bottom 0px
415
415
  left 0
416
416
  background var(--efu-white)
417
- border-radius 16px 16px 0px 0px
418
- padding 15px 0px
417
+ border-radius 16px 16px 0 0
418
+ padding 15px 0
419
419
  max-width 100%
420
- height calc(var(--vh) - 200px)
420
+ height 75vh
421
421
 
422
422
  &.aplayer-list-hide
423
423
  bottom -100% !important
package/source/js/main.js CHANGED
@@ -792,7 +792,6 @@ window.refreshFn = () => {
792
792
  GLOBAL_CONFIG.comment.commentBarrage && PAGE_CONFIG.comment && initializeCommentBarrage()
793
793
  document.body.setAttribute('data-type', PAGE_CONFIG.page)
794
794
  PAGE_CONFIG.page === "music" && scoMusic.init()
795
- GLOBAL_CONFIG.music.enable && !document.querySelector('#Music-page') && document.removeEventListener('keydown', scoMusic.setKeydown)
796
795
  GLOBAL_CONFIG.ai.enable && PAGE_CONFIG.page === "post" && ScoAI.init()
797
796
  }
798
797
 
@@ -1,158 +1,110 @@
1
- const scoMusic = {
2
- params: new URLSearchParams(window.location.search),
3
- extractValue: (input) => {
4
- const valueRegex = /\("([^\s]+)"\)/g;
5
- const match = valueRegex.exec(input);
6
- return match[1];
7
- },
8
- changeMusicBg: (isChangeBg = true) => {
9
- const MusicBg = document.getElementById("Music-bg");
10
- const MusicLoading = document.getElementsByClassName("Music-loading");
1
+ /**
2
+ * Music Player
3
+ * author: @efu
4
+ * date: 2024-03-19
5
+ * update: 2024-03-19
6
+ */
7
+
8
+ class ScoMusicPlayer {
9
+ init() {
10
+ this.getCustomPlayList();
11
+ this.addEventListenerToDocument();
12
+ this.addButtonListEventListener();
13
+ }
14
+
15
+ getCustomPlayList() {
16
+ this.changeMusicBg(false);
17
+ }
18
+ addEventListenerToDocument() {
19
+ document.addEventListener("keydown", this.handleKeydown.bind(this));
20
+ }
21
+
22
+ addButtonListEventListener() {
23
+ const aplayerList = document.querySelector(".aplayer-list");
24
+ document.querySelector(".aplayer-lrc")?.addEventListener("click", () => {
25
+ aplayerList.classList.toggle("aplayer-list-hide");
26
+ });
27
+ }
28
+
29
+ changeMusicBg(isChangeBg = true) {
30
+ const musicBg = document.getElementById("Music-bg");
31
+ const musicLoading = document.getElementsByClassName("Music-loading")[0];
11
32
 
12
33
  if (isChangeBg) {
13
- const musiccover = document.querySelector("#Music-page .aplayer-pic");
14
- const img = new Image();
15
- img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
16
- img.onload = () => {
17
- MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
18
- };
34
+ this.updateBackgroundImage(musicBg);
19
35
  } else {
20
- const timer = setInterval(() => {
21
- const musiccover = document.querySelector("#Music-page .aplayer-pic");
22
- if (musiccover) {
23
- MusicLoading[0].style.display = "none";
24
- clearInterval(timer);
25
- document.querySelector('meting-js').aplayer.volume(0.8, true);
26
-
27
- scoMusic.addEventListenerChangeMusicBg();
28
- MusicBg.style.display = "block";
29
- }
30
- }, 100);
36
+ this.setLoadingScreen(musicLoading, musicBg);
31
37
  }
32
- },
33
- lrcupdate: () => {
34
- const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
35
- const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
38
+ }
36
39
 
37
- if (currentLrc) {
38
- const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
39
- const translateYValue = -currentIndex * 80;
40
+ updateBackgroundImage(element) {
41
+ const musicCover = document.querySelector("#Music-page .aplayer-pic");
42
+ const img = new Image();
43
+ img.src = this.extractValue(musicCover.style.backgroundImage);
44
+ img.onload = () => {
45
+ element.style.backgroundImage = musicCover.style.backgroundImage;
46
+ };
47
+ }
40
48
 
41
- aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
42
- }
43
- },
44
- extractValue: (input) => {
45
- const valueRegex = /\("([^\s]+)"\)/g;
49
+ setLoadingScreen(loadingElement, backgroundElement) {
50
+ const timer = setInterval(() => {
51
+ const musicCover = document.querySelector("#Music-page .aplayer-pic");
52
+ if (musicCover) {
53
+ loadingElement.style.display = "none";
54
+ clearInterval(timer);
55
+ document.querySelector('meting-js').aplayer.volume(0.8, true);
56
+ this.addEventListenerChangeMusicBg();
57
+ backgroundElement.style.display = "block";
58
+ }
59
+ }, 100);
60
+ }
61
+
62
+ extractValue(input) {
63
+ const valueRegex = /url\("([^"]+)"\)/;
46
64
  const match = valueRegex.exec(input);
47
- return match[1];
48
- },
49
- changeMusicBg: (isChangeBg = true) => {
50
- const MusicBg = document.getElementById("Music-bg");
51
- const MusicLoading = document.getElementsByClassName("Music-loading");
65
+ return match ? match[1] : '';
66
+ }
52
67
 
53
- if (isChangeBg) {
54
- const musiccover = document.querySelector("#Music-page .aplayer-pic");
55
- const img = new Image();
56
- img.src = scoMusic.extractValue(musiccover.style.backgroundImage);
57
- img.onload = () => {
58
- MusicBg.style.backgroundImage = musiccover.style.backgroundImage;
59
- };
60
- } else {
61
- const timer = setInterval(() => {
62
- const musiccover = document.querySelector("#Music-page .aplayer-pic");
63
- if (musiccover) {
64
- MusicLoading[0].style.display = "none";
65
- clearInterval(timer);
66
- document.querySelector('meting-js').aplayer.volume(0.8, true);
68
+ addEventListenerChangeMusicBg() {
69
+ const aplayer = document.querySelector("#Music-page meting-js").aplayer;
70
+ aplayer.on('loadeddata', this.changeMusicBg.bind(this, true));
71
+ aplayer.on('timeupdate', this.lrcUpdate.bind(this));
72
+ }
67
73
 
68
- scoMusic.addEventListenerChangeMusicBg();
69
- MusicBg.style.display = "block";
70
- }
71
- }, 100);
72
- }
73
- },
74
- lrcupdate: () => {
74
+ lrcUpdate() {
75
75
  const aplayerLrcContents = document.querySelector('.aplayer-lrc-contents');
76
76
  const currentLrc = aplayerLrcContents.querySelector('p.aplayer-lrc-current');
77
-
78
77
  if (currentLrc) {
79
78
  const currentIndex = Array.from(aplayerLrcContents.children).indexOf(currentLrc);
80
- const translateYValue = -currentIndex * 80;
81
-
82
- aplayerLrcContents.style.transform = `translateY(${translateYValue}px)`;
79
+ aplayerLrcContents.style.transform = `translateY(${-currentIndex * 80}px)`;
83
80
  }
84
- },
85
- buttonlist: () => {
86
- const aplayerList = document.querySelector(".aplayer-list");
87
- if (aplayerList) {
88
- document.querySelector(".aplayer-lrc").addEventListener("click", () => {
89
- if (aplayerList.classList.contains("aplayer-list-hide")) {
90
- aplayerList.classList.remove("aplayer-list-hide");
91
- } else {
92
- aplayerList.classList.add("aplayer-list-hide");
93
- }
94
- });
95
- }
96
- },
97
- addEventListenerChangeMusicBg: () => {
98
- const aplayer = document.getElementById("Music-page").querySelector("meting-js").aplayer;
99
- aplayer.on('loadeddata', () => {
100
- scoMusic.changeMusicBg();
101
- });
102
- aplayer.on('timeupdate', () => {
103
- scoMusic.lrcupdate();
104
- });
105
- },
106
- getCustomPlayList: () => {
107
- const MusicPage = document.getElementById("Music-page");
108
- const playlistType = scoMusic.params.get("type") || "playlist";
81
+ }
109
82
 
110
- if (scoMusic.params.get("id") && params.get("server")) {
111
- const id = scoMusic.params.get("id");
112
- const server = scoMusic.params.get("server");
113
- MusicPage.innerHTML = `<meting-js id="${id}" server="${server}" type="${playlistType}" preload="auto" order="random"></meting-js>`;
114
- } else {
115
- MusicPage.innerHTML = `<meting-js id="${musicConfig.userId}" server="${musicConfig.userServer}" type="${musicConfig.userType}" preload="auto" order="random"></meting-js>`;
116
- }
117
- scoMusic.changeMusicBg(false);
118
- },
119
- setKeydown: (event) => {
83
+ handleKeydown(event) {
120
84
  const aplayer = document.querySelector('meting-js').aplayer;
121
- if (event.code === "Space") {
122
- event.preventDefault();
123
- aplayer.toggle();
124
- }
125
- if (event.keyCode === 39) {
126
- event.preventDefault();
127
- aplayer.skipForward();
128
- }
129
- if (event.keyCode === 37) {
130
- event.preventDefault();
131
- aplayer.skipBack();
132
- }
133
- if (event.keyCode === 38) {
134
- if (musicConfig.volume <= 1) {
135
- musicConfig.volume += 0.1;
136
- aplayer.volume(musicConfig.volume, true);
137
- }
138
- }
139
- if (event.keyCode === 40) {
140
- if (musicConfig.volume >= 0) {
141
- musicConfig.volume += -0.1;
142
- aplayer.volume(musicConfig.volume, true);
143
- }
85
+ switch (event.code) {
86
+ case "Space":
87
+ event.preventDefault();
88
+ aplayer.toggle();
89
+ break;
90
+ case "ArrowRight":
91
+ event.preventDefault();
92
+ aplayer.skipForward();
93
+ break;
94
+ case "ArrowLeft":
95
+ event.preventDefault();
96
+ aplayer.skipBack();
97
+ break;
98
+ case "ArrowUp":
99
+ event.preventDefault();
100
+ if (aplayer.volume < 1) aplayer.volume(aplayer.volume + 0.1);
101
+ break;
102
+ case "ArrowDown":
103
+ event.preventDefault();
104
+ if (aplayer.volume > 0) aplayer.volume(aplayer.volume - 0.1);
105
+ break;
144
106
  }
145
- },
146
- init: () => {
147
- let vh = window.innerHeight * 1;
148
- document.documentElement.style.setProperty('--vh', `${vh}px`);
149
- scoMusic.getCustomPlayList();
150
- document.addEventListener("keydown", scoMusic.setKeydown);
151
- scoMusic.buttonlist();
152
107
  }
153
- };
108
+ }
154
109
 
155
- window.addEventListener('resize', () => {
156
- let vh = window.innerHeight * 1;
157
- document.documentElement.style.setProperty('--vh', `${vh}px`);
158
- });
110
+ const scoMusic = new ScoMusicPlayer();
@@ -70,7 +70,7 @@ const utils = {
70
70
  snackbarShow: (text, showAction, duration) => {
71
71
  const sa = (typeof showAction !== 'undefined') ? showAction : false
72
72
  const dur = (typeof duration !== 'undefined') ? duration : 5000
73
- document.styleSheets[0].addRule(':root', '--st-snackbar-time:' + dur + 'ms!important')
73
+ document.styleSheets[0].addRule(':root', '--efu-snackbar-time:' + dur + 'ms!important')
74
74
  Snackbar.show({
75
75
  text: text, showAction: sa, duration: dur, pos: 'top-center'
76
76
  })