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 +23 -23
- package/{README_EN.md → README_zh-cn.md} +23 -23
- package/README_zh-tw.md +2 -2
- package/layout/includes/inject/body.pug +0 -6
- package/layout/includes/inject/head.pug +1 -1
- package/layout/includes/page/music.pug +2 -12
- package/layout/includes/page/says.pug +1 -1
- package/layout/includes/widgets/page/about/award.pug +1 -1
- package/layout/includes/widgets/page/about/personalities.pug +1 -1
- package/layout/includes/widgets/third-party/music.pug +1 -1
- package/package.json +1 -1
- package/source/css/_global/function.styl +4 -0
- package/source/css/_page/_about/author.styl +14 -16
- package/source/css/_page/_home/home-top.styl +5 -5
- package/source/css/_page/music.styl +9 -9
- package/source/js/main.js +0 -1
- package/source/js/music.js +91 -139
- package/source/js/utils.js +1 -1
- /package/.github/workflows/{npm-publish-github-packages.yml → publish.yml} +0 -0
package/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
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
|
-
|
7
|
+
<h1 align="center">Hexo Theme Solitude</h1>
|
8
8
|
|
9
|
-
|
9
|
+
<p align="center">An elegant Hexo theme that supports lazy loading, PWA, Latex, and multiple comment systems.</p>
|
10
10
|
|
11
11
|

|
12
12
|

|
@@ -15,47 +15,47 @@
|
|
15
15
|
[](https://github.com/valor-x/hexo-theme-solitude/stargazers)
|
16
16
|
[](https://github.com/valor-x/hexo-theme-solitude/releases/latest)
|
17
17
|
|
18
|
-
[
|
18
|
+
[Preview](https://solitude-demo.efu.me/) 丨 [Documentation](https://solitude-docs.efu.me/)
|
19
19
|
|
20
20
|
</div>
|
21
21
|
|
22
22
|

|
23
23
|
|
24
|
-
##
|
24
|
+
## Features
|
25
25
|
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
26
|
+
- Pjax、LazyLoad、PWA
|
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.
|
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
|
-
|
59
|
+
**Theme is fully licensed and designed by the author of [@张洪Heo](https://github.com/zhheo)!**
|
60
60
|
|
61
|
-
>
|
61
|
+
> You are welcome to contribute to this topic! [Contribution Guide](/CONTRIBUTING.md)
|
@@ -1,12 +1,12 @@
|
|
1
|
-
[
|
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
|
-
|
7
|
+
<h1 align="center">Hexo Theme Solitude</h1>
|
8
8
|
|
9
|
-
|
9
|
+
<p align="center">一款优雅的 Hexo 主题,支持懒加载、PWA、Latex以及多种评论系统。</p>
|
10
10
|
|
11
11
|

|
12
12
|

|
@@ -15,47 +15,47 @@
|
|
15
15
|
[](https://github.com/valor-x/hexo-theme-solitude/stargazers)
|
16
16
|
[](https://github.com/valor-x/hexo-theme-solitude/releases/latest)
|
17
17
|
|
18
|
-
[
|
18
|
+
[预览](https://solitude-demo.efu.me/) 丨 [文档](https://solitude-docs.efu.me/)
|
19
19
|
|
20
20
|
</div>
|
21
21
|
|
22
22
|

|
23
23
|
|
24
|
-
##
|
24
|
+
## 特性
|
25
25
|
|
26
|
-
- Pjax
|
27
|
-
-
|
28
|
-
- ColorMode
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
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]
|
37
|
-
- [ ] Tags plugin
|
38
|
-
- [ ]
|
36
|
+
- [x] Waline 评论支持
|
37
|
+
- [ ] Tags plugin 插件化
|
38
|
+
- [ ] 相册页重构(已移除,待重构)
|
39
39
|
|
40
|
-
##
|
40
|
+
## 应用
|
41
41
|
|
42
|
-
1.
|
42
|
+
1. 使用 NPM 包进行安装
|
43
43
|
```bash
|
44
44
|
npm i hexo-theme-solitude
|
45
45
|
```
|
46
|
-
2.
|
46
|
+
2. 应用主题
|
47
47
|
```yaml
|
48
48
|
theme: solitude
|
49
49
|
```
|
50
|
+
|
51
|
+
前往 [文档](https://solitude-docs.efu.me/) 获取更多信息。
|
50
52
|
|
51
|
-
|
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
|
-
|
59
|
+
**主题由 [@张洪Heo](https://github.com/zhheo) 作者全权授权、设计!**
|
60
60
|
|
61
|
-
>
|
61
|
+
> 欢迎你对本主题做出贡献
|
package/README_zh-tw.md
CHANGED
@@ -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.
|
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(--
|
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(--
|
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(--
|
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
@@ -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
|
24
|
+
display none
|
25
25
|
|
26
|
-
+
|
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
|
-
+
|
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
|
-
+
|
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
|
-
+
|
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
|
67
|
+
height 75vh
|
68
68
|
|
69
69
|
ol
|
70
|
-
max-height
|
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
|
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
|
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
|
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
|
418
|
-
padding 15px
|
417
|
+
border-radius 16px 16px 0 0
|
418
|
+
padding 15px 0
|
419
419
|
max-width 100%
|
420
|
-
height
|
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
|
|
package/source/js/music.js
CHANGED
@@ -1,158 +1,110 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
aplayer.volume(
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
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
|
-
|
156
|
-
let vh = window.innerHeight * 1;
|
157
|
-
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
158
|
-
});
|
110
|
+
const scoMusic = new ScoMusicPlayer();
|
package/source/js/utils.js
CHANGED
@@ -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', '--
|
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
|
})
|
File without changes
|