hexo-theme-solitude 1.5.4 → 1.5.6
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/.github/ISSUE_TEMPLATE/bug_report.yml +7 -6
- package/.github/ISSUE_TEMPLATE/feature_request.yml +1 -1
- package/README.md +23 -23
- package/{README_EN.md → README_zh-cn.md} +23 -23
- package/README_zh-tw.md +2 -2
- package/_config.yml +0 -12
- package/languages/en.yml +9 -6
- package/languages/zh-CN.yml +9 -6
- package/languages/zh-TW.yml +9 -6
- package/layout/includes/head/config.pug +9 -6
- package/layout/includes/inject/body.pug +7 -6
- package/layout/includes/inject/head.pug +1 -1
- package/layout/includes/page/music.pug +2 -12
- package/layout/includes/widgets/page/about/personalities.pug +1 -1
- package/layout/includes/widgets/post/copyright.pug +0 -2
- package/layout/page.pug +0 -4
- package/package.json +1 -1
- package/plugins.yml +0 -4
- package/scripts/event/cdn.js +6 -1
- package/scripts/tags/button.js +1 -1
- package/scripts/tags/bvideo.js +2 -2
- package/scripts/tags/gallery.js +54 -0
- package/scripts/tags/image.js +1 -1
- package/scripts/tags/link.js +6 -3
- package/scripts/tags/note.js +6 -0
- package/source/css/_global/function.styl +4 -0
- package/source/css/_page/_gallery/index.styl +0 -66
- package/source/css/_page/_home/home-top.styl +1 -1
- package/source/css/_page/music.styl +9 -9
- package/source/css/_page/share.styl +2 -2
- package/source/css/_widgets/_post/content.styl +7 -0
- package/source/css/_widgets/_post/copyright.styl +0 -18
- package/source/css/_widgets/_tags/button.styl +29 -49
- package/source/css/_widgets/_tags/checkbox.styl +176 -57
- package/source/css/_widgets/_tags/fold.styl +65 -79
- package/source/css/_widgets/_tags/gallery.styl +67 -0
- package/source/css/_widgets/_tags/index.styl +32 -30
- package/source/css/_widgets/_tags/label.styl +4 -3
- package/source/css/_widgets/_tags/link.styl +48 -77
- package/source/css/_widgets/_tags/media.styl +57 -0
- package/source/css/_widgets/_tags/mermaid.styl +1 -2
- package/source/css/_widgets/_tags/note.styl +1 -7
- package/source/css/_widgets/_tags/span.styl +24 -51
- package/source/css/_widgets/_tags/tabs.styl +3 -1
- package/source/css/_widgets/index.styl +1 -1
- package/source/js/covercolor/api.js +16 -16
- package/source/js/covercolor/local.js +16 -16
- package/source/js/lately.min.js +6 -0
- package/source/js/main.js +2 -33
- package/source/js/music.js +91 -139
- package/source/js/utils.js +6 -0
- package/layout/includes/page/album.pug +0 -38
- package/layout/includes/page/gallery.pug +0 -11
- package/scripts/generator/gallery.js +0 -49
- package/scripts/tags/card.js +0 -9
- package/scripts/tags/u.js +0 -7
- package/source/css/_widgets/_tags/bvideo.styl +0 -8
- package/source/css/_widgets/_tags/card.styl +0 -52
- package/source/css/_widgets/_tags/image.styl +0 -10
- package/source/css/_widgets/_tags/inline-image.styl +0 -6
- /package/.github/workflows/{npm-publish-github-packages.yml → publish.yml} +0 -0
@@ -3,10 +3,10 @@ const coverColor = () => {
|
|
3
3
|
if (path) {
|
4
4
|
handleApiColor(path);
|
5
5
|
} else {
|
6
|
-
document.documentElement.style.setProperty('--
|
7
|
-
document.documentElement.style.setProperty('--
|
8
|
-
document.documentElement.style.setProperty('--
|
9
|
-
document.documentElement.style.setProperty('--
|
6
|
+
document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
|
7
|
+
document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
|
8
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
|
9
|
+
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
10
10
|
initThemeColor()
|
11
11
|
}
|
12
12
|
}
|
@@ -43,17 +43,17 @@ function img2color(src) {
|
|
43
43
|
|
44
44
|
function setThemeColors(value, r = null, g = null, b = null) {
|
45
45
|
if (value) {
|
46
|
-
document.documentElement.style.setProperty('--
|
47
|
-
document.documentElement.style.setProperty('--
|
48
|
-
document.documentElement.style.setProperty('--
|
49
|
-
document.documentElement.style.setProperty('--
|
46
|
+
document.documentElement.style.setProperty('--efu-main', value);
|
47
|
+
document.documentElement.style.setProperty('--efu-main-op', value + '23');
|
48
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', value + 'dd');
|
49
|
+
document.documentElement.style.setProperty('--efu-main-none', value + '00');
|
50
50
|
|
51
51
|
if (r && g && b) {
|
52
52
|
let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
|
53
53
|
if (brightness < 125) {
|
54
54
|
let cardContents = document.getElementsByClassName('card-content');
|
55
55
|
for (let i = 0; i < cardContents.length; i++) {
|
56
|
-
cardContents[i].style.setProperty('--
|
56
|
+
cardContents[i].style.setProperty('--efu-card-bg', 'var(--efu-white)');
|
57
57
|
}
|
58
58
|
|
59
59
|
let authorInfo = document.getElementsByClassName('author-info__sayhi');
|
@@ -67,10 +67,10 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
67
67
|
document.getElementById("coverdiv").classList.add("loaded");
|
68
68
|
initThemeColor();
|
69
69
|
} else {
|
70
|
-
document.documentElement.style.setProperty('--
|
71
|
-
document.documentElement.style.setProperty('--
|
72
|
-
document.documentElement.style.setProperty('--
|
73
|
-
document.documentElement.style.setProperty('--
|
70
|
+
document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
|
71
|
+
document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
|
72
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
|
73
|
+
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
74
74
|
initThemeColor();
|
75
75
|
}
|
76
76
|
}
|
@@ -79,11 +79,11 @@ function initThemeColor() {
|
|
79
79
|
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
80
80
|
let themeColor;
|
81
81
|
if (currentTop > 0) {
|
82
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
82
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-card-bg');
|
83
83
|
} else if (PAGE_CONFIG.is_post) {
|
84
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
84
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-main');
|
85
85
|
} else {
|
86
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
86
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-background');
|
87
87
|
}
|
88
88
|
changeThemeColor(themeColor);
|
89
89
|
}
|
@@ -3,10 +3,10 @@ const coverColor = () => {
|
|
3
3
|
if (path) {
|
4
4
|
localColor(path);
|
5
5
|
} else {
|
6
|
-
document.documentElement.style.setProperty('--
|
7
|
-
document.documentElement.style.setProperty('--
|
8
|
-
document.documentElement.style.setProperty('--
|
9
|
-
document.documentElement.style.setProperty('--
|
6
|
+
document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
|
7
|
+
document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
|
8
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
|
9
|
+
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
10
10
|
initThemeColor()
|
11
11
|
}
|
12
12
|
}
|
@@ -108,17 +108,17 @@ function colorRgb(str) {
|
|
108
108
|
|
109
109
|
function setThemeColors(value, r = null, g = null, b = null) {
|
110
110
|
if (value) {
|
111
|
-
document.documentElement.style.setProperty('--
|
112
|
-
document.documentElement.style.setProperty('--
|
113
|
-
document.documentElement.style.setProperty('--
|
114
|
-
document.documentElement.style.setProperty('--
|
111
|
+
document.documentElement.style.setProperty('--efu-main', value);
|
112
|
+
document.documentElement.style.setProperty('--efu-main-op', value + '23');
|
113
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', value + 'dd');
|
114
|
+
document.documentElement.style.setProperty('--efu-main-none', value + '00');
|
115
115
|
|
116
116
|
if (r && g && b) {
|
117
117
|
let brightness = Math.round(((parseInt(r) * 299) + (parseInt(g) * 587) + (parseInt(b) * 114)) / 1000);
|
118
118
|
if (brightness < 125) {
|
119
119
|
let cardContents = document.getElementsByClassName('card-content');
|
120
120
|
for (let i = 0; i < cardContents.length; i++) {
|
121
|
-
cardContents[i].style.setProperty('--
|
121
|
+
cardContents[i].style.setProperty('--efu-card-bg', 'var(--efu-white)');
|
122
122
|
}
|
123
123
|
|
124
124
|
let authorInfo = document.getElementsByClassName('author-info__sayhi');
|
@@ -132,10 +132,10 @@ function setThemeColors(value, r = null, g = null, b = null) {
|
|
132
132
|
document.getElementById("coverdiv").classList.add("loaded");
|
133
133
|
initThemeColor();
|
134
134
|
} else {
|
135
|
-
document.documentElement.style.setProperty('--
|
136
|
-
document.documentElement.style.setProperty('--
|
137
|
-
document.documentElement.style.setProperty('--
|
138
|
-
document.documentElement.style.setProperty('--
|
135
|
+
document.documentElement.style.setProperty('--efu-main', 'var(--efu-theme)');
|
136
|
+
document.documentElement.style.setProperty('--efu-main-op', 'var(--efu-theme-op)');
|
137
|
+
document.documentElement.style.setProperty('--efu-main-op-deep', 'var(--efu-theme-op-deep)');
|
138
|
+
document.documentElement.style.setProperty('--efu-main-none', 'var(--efu-theme-none)');
|
139
139
|
initThemeColor();
|
140
140
|
}
|
141
141
|
}
|
@@ -144,11 +144,11 @@ function initThemeColor() {
|
|
144
144
|
const currentTop = window.scrollY || document.documentElement.scrollTop;
|
145
145
|
let themeColor;
|
146
146
|
if (currentTop > 0) {
|
147
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
147
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-card-bg');
|
148
148
|
} else if (PAGE_CONFIG.is_post) {
|
149
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
149
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-main');
|
150
150
|
} else {
|
151
|
-
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--
|
151
|
+
themeColor = getComputedStyle(document.documentElement).getPropertyValue('--efu-background');
|
152
152
|
}
|
153
153
|
changeThemeColor(themeColor);
|
154
154
|
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* Lately.min.js 2.5.2
|
3
|
+
* MIT License - http://www.opensource.org/licenses/mit-license.php
|
4
|
+
* https://tokinx.github.io/lately/
|
5
|
+
*/
|
6
|
+
!function(){window.Lately=new function(){var t=this;this.lang={second:"秒",minute:"分钟",hour:"小时",day:"天",month:"个月",year:"年",ago:"前",error:"NaN"};var e=function(e){e=new Date(n(e));var r=new function(){this.second=(Date.now()-e.getTime())/1e3,this.minute=this.second/60,this.hour=this.minute/60,this.day=this.hour/24,this.month=this.day/30,this.year=this.month/12},i=Object.keys(r).reverse().find(function(t){return r[t]>=1});return(i?function(t,e){return Math.floor(t)+e}(r[i],t.lang[i]):t.lang.error)+t.lang.ago},n=function(t){return t=new Date(t&&("number"==typeof t?t:t.replace(/-/g,"/").replace("T"," "))),!isNaN(t.getTime())&&t.getTime()};return{init:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r.target,a=void 0===i?"time":i,o=r.lang;o&&(t.lang=o);var u=!0,h=!1,l=void 0;try{for(var s,c=document.querySelectorAll(a)[Symbol.iterator]();!(u=(s=c.next()).done);u=!0){var f=s.value,g=n(f.dateTime)||n(f.title)||n(f.innerHTML)||0;if(!g)return;f.title=new Date(g).toLocaleString(),f.innerHTML=e(g)}}catch(t){h=!0,l=t}finally{try{!u&&c.return&&c.return()}finally{if(h)throw l}}},format:e}}}();
|
package/source/js/main.js
CHANGED
@@ -108,36 +108,6 @@ const showTodayCard = () => {
|
|
108
108
|
}
|
109
109
|
}
|
110
110
|
|
111
|
-
const changeTimeFormat = () => {
|
112
|
-
const timeElements = Array.from(document.getElementsByTagName("time"));
|
113
|
-
const lang = GLOBAL_CONFIG.lang.time;
|
114
|
-
const currentDate = new Date();
|
115
|
-
|
116
|
-
timeElements.forEach(timeElement => {
|
117
|
-
const datetime = timeElement.getAttribute("datetime");
|
118
|
-
const timeObj = new Date(datetime);
|
119
|
-
const daysDiff = utils.timeDiff(timeObj, currentDate);
|
120
|
-
|
121
|
-
let timeString;
|
122
|
-
if (daysDiff === 0) {
|
123
|
-
timeString = lang.recent;
|
124
|
-
} else if (daysDiff === 1) {
|
125
|
-
timeString = lang.yesterday;
|
126
|
-
} else if (daysDiff === 2) {
|
127
|
-
timeString = lang.berforeyesterday;
|
128
|
-
} else if (daysDiff <= 7) {
|
129
|
-
timeString = `${daysDiff}${lang.daybefore}`;
|
130
|
-
} else {
|
131
|
-
if (timeObj.getFullYear() !== currentDate.getFullYear()) {
|
132
|
-
timeString = `${timeObj.getFullYear()}/${timeObj.getMonth() + 1}/${timeObj.getDate()}`;
|
133
|
-
} else {
|
134
|
-
timeString = `${timeObj.getMonth() + 1}/${timeObj.getDate()}`;
|
135
|
-
}
|
136
|
-
}
|
137
|
-
timeElement.textContent = timeString;
|
138
|
-
});
|
139
|
-
}
|
140
|
-
|
141
111
|
const initObserver = () => {
|
142
112
|
let commentElement = document.getElementById("post-comment");
|
143
113
|
let paginationElement = document.getElementById("pagination");
|
@@ -352,7 +322,7 @@ let sco = {
|
|
352
322
|
},
|
353
323
|
addRuntime: function () {
|
354
324
|
let el = document.getElementById('runtimeshow')
|
355
|
-
el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.
|
325
|
+
el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.lately.day)
|
356
326
|
},
|
357
327
|
toTalk: function (txt) {
|
358
328
|
const inputs = ["#wl-edit", ".el-textarea__inner"]
|
@@ -799,7 +769,6 @@ window.refreshFn = () => {
|
|
799
769
|
sco.initAdjust()
|
800
770
|
scrollFn()
|
801
771
|
sidebarFn()
|
802
|
-
changeTimeFormat()
|
803
772
|
initObserver()
|
804
773
|
sco.addRuntime()
|
805
774
|
sco.hideCookie()
|
@@ -809,6 +778,7 @@ window.refreshFn = () => {
|
|
809
778
|
sco.categoriesBarActive()
|
810
779
|
sco.listenToPageInputPress()
|
811
780
|
sco.addNavBackgroundInit()
|
781
|
+
utils.changeTimeFormat()
|
812
782
|
GLOBAL_CONFIG.rightside.enable && addRightMenuClickEvent()
|
813
783
|
GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg()
|
814
784
|
GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar)"))
|
@@ -822,7 +792,6 @@ window.refreshFn = () => {
|
|
822
792
|
GLOBAL_CONFIG.comment.commentBarrage && PAGE_CONFIG.comment && initializeCommentBarrage()
|
823
793
|
document.body.setAttribute('data-type', PAGE_CONFIG.page)
|
824
794
|
PAGE_CONFIG.page === "music" && scoMusic.init()
|
825
|
-
GLOBAL_CONFIG.music.enable && !document.querySelector('#Music-page') && document.removeEventListener('keydown', scoMusic.setKeydown)
|
826
795
|
GLOBAL_CONFIG.ai.enable && PAGE_CONFIG.page === "post" && ScoAI.init()
|
827
796
|
}
|
828
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
@@ -1,38 +0,0 @@
|
|
1
|
-
include ../widgets/page/banner
|
2
|
-
|
3
|
-
- var album = page.album
|
4
|
-
- var {limit} = theme.album
|
5
|
-
|
6
|
-
if album
|
7
|
-
#album
|
8
|
-
#st-container
|
9
|
-
if album.json
|
10
|
-
script.
|
11
|
-
function initGallery() {
|
12
|
-
let macy = Macy({ container: '#st-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }})
|
13
|
-
macy.runOnImageLoad(function () { setTimeout(function () { GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".st-gallery-item img")); macy.recalculate(true); }, 500); }, true)
|
14
|
-
}
|
15
|
-
(async function () {
|
16
|
-
await fetch('!{url_for(album.json)}')
|
17
|
-
.then(res => res.json())
|
18
|
-
.then(data => {
|
19
|
-
let html = ''
|
20
|
-
data = data.sort((a, b) => b.date - a.date)
|
21
|
-
data.forEach(item => { html += `<div class="st-gallery-item"><span class="locate">${item.locate}</span><img class="st-gallery-image" src="${item.image}" alt="${item.content}"></div>` })
|
22
|
-
document.querySelector('#st-container').innerHTML = html
|
23
|
-
GLOBAL_CONFIG.lazyload.enable && utils.lazyloadImg();
|
24
|
-
initGallery()
|
25
|
-
})
|
26
|
-
})()
|
27
|
-
|
28
|
-
else
|
29
|
-
each item in album.items.sort((a, b) => b.date - a.date)
|
30
|
-
.st-gallery-item
|
31
|
-
span.locate= item.locate
|
32
|
-
img.st-gallery-image(src=item.image, alt=item.content)
|
33
|
-
script.
|
34
|
-
function initGallery(){
|
35
|
-
let macy = Macy({ container: '#st-container', trueOrder: false, waitForImages: true, margin: 5, columns: !{limit}, breakAt: { 1200: 5, 940: 3, 520: 2, 400: 1 }})
|
36
|
-
macy.runOnImageLoad(function () { setTimeout(function () { GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".st-gallery-item img")); macy.recalculate(true); }, 500); }, true)
|
37
|
-
}
|
38
|
-
document.addEventListener('DOMContentLoaded', initGallery);
|
@@ -1,11 +0,0 @@
|
|
1
|
-
include ../widgets/page/banner
|
2
|
-
|
3
|
-
- var gallery = page.album
|
4
|
-
|
5
|
-
if theme.album.enable && gallery
|
6
|
-
#gallery
|
7
|
-
each item in gallery
|
8
|
-
.gallery-item(onclick="pjax.loadUrl('/" + page.url + "/" + item.album + "/')")
|
9
|
-
img.cover(src=item.cover)
|
10
|
-
span.title= item.class_name
|
11
|
-
span.desc= item.descr
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Created by wleelw on 2024/2/4.
|
3
|
-
*/
|
4
|
-
|
5
|
-
hexo.extend.generator.register('gallery', function (locals) {
|
6
|
-
if (!hexo.theme.config.album.enable) return;
|
7
|
-
const album = locals.data.gallery.gallery;
|
8
|
-
if (!album) return;
|
9
|
-
const { url, cover, comment, title, album_list, descr, rightbtn, rightbtnlink } = album;
|
10
|
-
return {
|
11
|
-
path: `${url}/index.html`,
|
12
|
-
layout: ['page'],
|
13
|
-
data: {
|
14
|
-
url,
|
15
|
-
cover,
|
16
|
-
type: 'gallery',
|
17
|
-
comment,
|
18
|
-
desc: title,
|
19
|
-
title,
|
20
|
-
album: album_list,
|
21
|
-
leftend: descr,
|
22
|
-
rightbtn,
|
23
|
-
rightbtnlink
|
24
|
-
}
|
25
|
-
};
|
26
|
-
});
|
27
|
-
|
28
|
-
hexo.extend.generator.register('album', function (locals) {
|
29
|
-
if (!hexo.theme.config.album.enable) return;
|
30
|
-
const album = locals.data.gallery.gallery;
|
31
|
-
let back = hexo.config.language === 'zh-CN' ? '返回相册' : hexo.config.language === 'zh-TW' ? '返回相冊' : 'Back to Album';
|
32
|
-
if (!album) return;
|
33
|
-
const albumPages = album.album_list.map(item => ({
|
34
|
-
path: `${album.url}/${item.album}/index.html`,
|
35
|
-
layout: ['page'],
|
36
|
-
data: {
|
37
|
-
album: item,
|
38
|
-
type: 'album',
|
39
|
-
cover: item.cover,
|
40
|
-
title: item.class_name,
|
41
|
-
desc: item.class_name,
|
42
|
-
leftend: item.descr,
|
43
|
-
rightbtn: back,
|
44
|
-
rightbtnlink: `/${album.url}/`,
|
45
|
-
comment: item.comment
|
46
|
-
}
|
47
|
-
}));
|
48
|
-
return albumPages;
|
49
|
-
});
|
package/scripts/tags/card.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
hexo.extend.tag.register('card', function (args, content) {
|
4
|
-
args = args.join(' ').split(',');
|
5
|
-
let icon = args[0] || 'no-icon';
|
6
|
-
let color = args[1] || 'info';
|
7
|
-
let title = args[2] || '';
|
8
|
-
return `<div class="card card-${color}"><div class="card-title"><i class="solitude ${icon}"></i>${title}</div>${hexo.render.renderSync({text: content, engine: 'markdown'})}</div>`
|
9
|
-
}, {ends: true});
|
package/scripts/tags/u.js
DELETED