封面 《Clover Day’s》

前言

因为对 butterfly 改了很多次,所以记录一下自己的修改记录,以免后面再次修改的时候找不到修改的地方,同时方便后续删除魔改。

魔改记录

在右边的目录可以方便查询

跳动标题

添加shake-it.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#site-title:hover,
#post-title:hover,
.article-title:hover {
animation: shake-it 0.5s reverse infinite cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
@keyframes shake-it {
0% {
text-shadow: 0 0 rgba(0, 255, 255, 0.5), 0 0 rgba(255, 0, 0, 0.5);
}
25% {
text-shadow: -2px 0 rgba(0, 255, 255, 0.5), 2px 0 rgba(255, 0, 0, 0.5);
}
50% {
text-shadow: -5px 0 rgba(0, 255, 255, 0.5), 3px 0 rgba(255, 0, 0, 0.5);
}
100% {
text-shadow: 3px 0 rgba(0, 255, 255, 0.5), 5px 0 rgba(255, 0, 0, 0.5);
}
}

_config.butterfly.yml中注入代码添加shake-it.css

1
2
3
inject:
head:
+ - <link rel="stylesheet" href="/css/shake-it.css"/>

效果如下

live2d 组件

_config.butterfly.yml中注入代码添加autoload.js

1
2
3
inject:
head:
+ - <script src="https://cdn-js.moeworld.top/gh/qxdn/qxdn-assert@0.6.8/autoload.js"></script>

其中对 live2d 的配置在https://github.com/qxdn/live2d-widget,live2d 的模型在https://github.com/qxdn/live2d_api

效果

天气组件

创建weather-widget.js,其中配置在心知天气添加

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const menus = document.getElementById("menus");
menus.insertAdjacentHTML("beforebegin", `<div id="tp-weather-widget"></div>`);
(function (a, h, g, f, e, d, c, b) {
b = function () {
d = h.createElement(g);
c = h.getElementsByTagName(g)[0];
d.src = e;
d.charset = "utf-8";
d.async = 1;
c.parentNode.insertBefore(d, c);
};
a["SeniverseWeatherWidgetObject"] = f;
a[f] ||
(a[f] = function () {
(a[f].q = a[f].q || []).push(arguments);
});
a[f].l = +new Date();
if (a.attachEvent) {
a.attachEvent("onload", b);
} else {
a.addEventListener("load", b, false);
}
})(
window,
document,
"script",
"SeniverseWeatherWidget",
"//cdn.sencdn.com/widget2/static/js/bundle.js?t=" +
parseInt((new Date().getTime() / 100000000).toString(), 10)
);
window.SeniverseWeatherWidget("show", {
flavor: "slim",
location: "",
geolocation: true,
language: "auto",
unit: "c",
theme: "auto",
token: "",
hover: "enabled",
container: "tp-weather-widget",
});

效果

github 日历

安装依赖

1
npm install --save @barry-flynn/hexo-github-calendar

_config.yml中注入代码添加配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# butterfly
githubcalendar:
enable: true
priority: 12
enable_page: /
user: qxdn
layout:
type: id
name: recent-posts
index: 0
githubcalendar_html: '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>'
pc_minheight: 280px
mobile_minheight: 0px
# color: "['#e4dfd7', '#f9f4dc', '#f7e8aa', '#f7e8aa', '#f8df72', '#fcd217', '#fcc515', '#f28e16', '#fb8b05', '#d85916', '#f43e06']" #橘黄色调
color: "['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f']" #浅紫色调
# color: "['#ebedf0', '#f0fff4', '#dcffe4', '#bef5cb', '#85e89d', '#34d058', '#28a745', '#22863a', '#176f2c', '#165c26', '#144620']" #翠绿色调
# color: "['#ebedf0', '#f1f8ff', '#dbedff', '#c8e1ff', '#79b8ff', '#2188ff', '#0366d6', '#005cc5', '#044289', '#032f62', '#05264c']" #天青色调
api: https://calendar.qianxu.run/api
# api: https://python-gitee-calendar-api.vercel.app/api
#calendar_js: https://cdn-js.moeworld.top/gh/Zfour/hexo-github-calendar@1.21/hexo_githubcalendar.js
calendar_js: https://cdn-js.moeworld.top/gh/Barry-Flynn/hexo-github-calendar@1.0.1/hexo_githubcalendar.js
plus_style: ""

效果

文章轮播

安装依赖

1
npm install hexo-butterfly-swiper --save

_config.butterfly.yml中注入代码添加配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# hexo-butterfly-swiper
# see https://akilar.top/posts/8e1264d1/
swiper:
enable: true # 开关
priority: 5 #过滤器优先权
enable_page: / # 应用页面
timemode: date #date/updated
layout: # 挂载容器类型
type: id
name: recent-posts
index: 0
default_descr: 再怎么看我也不知道怎么描述它的啦!
swiper_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css #swiper css依赖
swiper_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js #swiper js依赖
custom_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css # 适配主题样式补丁
custom_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js # swiper初始化方法

效果

AI 摘要

创建ai-summary.js,其中 key 在爱发电购买,后台管理在https://postsummary.zhheo.com/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
new ChucklePostAI({
// 文章内容所在的元素属性的选择器,也是AI挂载的容器,AI将会挂载到该容器的最前面
el: "#post>#article-container",
// 驱动AI所必须的key,即是tianliGPT后端服务所必须的key
key: "",
// 文章推荐方式,all:匹配数据库内所有文章进行推荐,web:仅当前站内的文章,默认all
rec_method: "web",
hide_shuttle: true,
summary_directly: true,
pjax: true,
summary_speech: true,
interface: {
name: "AI摘要", // AI名称
introduce:
"我是文章辅助AI: 点击下方的按钮,让我生成本文简介、推荐相关文章等。", // 自我介绍
},
});

_config.butterfly.yml中注入代码添加配置

1
2
3
4
5
inject:
head:
+ - <script src="https://jsd.onmicrosoft.cn/gh/qxchuckle/Post-Summary-AI@6.0/chuckle-post-ai.min.js"></script>
bottom:
+ - <script src="/scripts/ai-summary.js" data-pjax defer />

效果

bilibili 视频适配

创建bilibili.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*哔哩哔哩视频适配*/
.aspect-ratio {
position: relative;
width: 100%;
height: 0;
padding-bottom: 75%;
margin: 3% auto;
text-align: center;
}
.aspect-ratio iframe {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}

效果

人生倒计时

_data中创建widget.yml,添加如下内容

1
2
3
4
5
6
top:
- class_name: aside aside-count
name: 人生倒计时
icon: fas fa-hourglass-half
order: 5
html: <div id="life-progress" ></div> <script src="https://cdn-js.moeworld.top/gh/qxdn/life-progress@latest/autoload.min.js"></script>

效果

pixiv 日榜

_data/widget.yml,添加如下内容

1
2
3
4
bottom:
+ - name: pixiv 日榜Top50
+ html: '<iframe src="https://pixiv.mokeyjay.com" style="width:240px; height:380px; border: 0"></iframe>'
+ order: 3

效果

访客地图

_data/widget.yml,添加如下内容。其中 html 组件到https://www.revolvermaps.com/?target=gallery获取。

1
2
3
4
5
bottom:
+ - name: 访客来源
+ icon: fas fa-globe-asia fa-spin
+ order: 5
+ html: <script type="text/javascript" async="async"></script>

效果

信封留言板

安装依赖

1
npm install --save hexo-butterfly-envelope

_config.butterfly.yml中注入代码添加配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# envelope_comment
# see https://akilar.top/posts/e2d3c450/
envelope_comment:
enable: true #控制开关
custom_pic:
cover: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/violet.jpg #信笺头部图片
line: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/line.png #信笺底部图片
beforeimg: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/before.png # 信封前半部分
afterimg: https://npm.elemecdn.com/hexo-butterfly-envelope/lib/after.png # 信封后半部分
message: #信笺正文,多行文本,写法如下
- 有什么想问的?
- 有什么想说的?
- 有什么想吐槽的?
- 哪怕是有什么想吃的,都可以告诉我哦~
bottom: 自动书记人偶竭诚为您服务! #仅支持单行文本
height: #1050px,信封划出的高度
path: #【可选】comments 的路径名称。默认为 comments,生成的页面为 comments/index.html
front_matter: #【可选】comments页面的 front_matter 配置
title: 留言板
comments: true

效果

朋友圈

创建朋友圈页

1
hexo new page fcircle

/fcircle/index.md中添加如下内容,其中后端 api 的配置见https://fcircle-doc.yyyzyyyz.cn/#/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<div id="hexo-circle-of-friends-root"></div>
<script>
let UserConfig = {
// 填写你的api地址
private_api_url: 'https://fcircle.qianxu.run/',
// 初始加载几篇文章
page_init_number: 20,
// 点击加载更多时,一次最多加载几篇文章,默认10
page_turning_number: 10,
// 头像加载失败时,默认头像地址
error_img: 'https://sdn.geekzu.org/avatar/57d8260dfb55501c37dde588e7c3852c',
// 进入页面时第一次的排序规则
sort_rule: 'created',
// 本地文章缓存数据过期时间(天)
expire_days: 1,
}
</script>
<script type="text/javascript" src="https://npm.elemecdn.com/fcircle-theme-yyyz@1.0.13/dist/fcircle.min.js"></script>

效果

音乐页

安装依赖

1
npm install --save hexo-anzhiyu-music

创建音乐页

1
hexo new page music

创建music.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
body:has(#anMusic-page) .layout.hide-aside {
max-width: 85%;
}

#page:has(#anMusic-page) {
border: 0;
box-shadow: none !important;
padding: 0 !important;
background: transparent !important;
}
body:has(#anMusic-page)
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-volume-wrap
.aplayer-volume-bar-wrap {
bottom: 0;
right: -5px;
}
#page:has(#anMusic-page) h1.page-title {
display: none;
}
[data-theme="dark"] #page:has(#anMusic-page) #article-container .aplayer {
filter: none;
}
[data-theme="dark"] .page:has(#anMusic-page) {
background: linear-gradient(to bottom, rgb(0 0 0 / 80%), rgb(0 0 0 / 0%));
}
#an_music_bg {
display: none;
filter: blur(63px);
opacity: 0.6;
position: fixed;
z-index: -999;
background-attachment: local;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
transform: rotate(0deg);
transition: 0.3s;
}
body:has(#anMusic-page) {
background-color: #0d0d0d;
}
body:has(#anMusic-page) #an_music_bg {
display: block;
}
body:has(#anMusic-page) #web_bg {
display: none;
}
body:has(#anMusic-page) .s-sticker div {
color: #fff !important;
}
body:has(#anMusic-page)
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-time
.aplayer-icon.aplayer-icon-loop {
margin-right: 15px;
}
#anMusic-page meting-js .aplayer {
display: flex;
flex-direction: row-reverse;
background: rgba(0, 0, 0, 0);
border: none;
box-shadow: none;
}
#anMusic-page
meting-js
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-bar-wrap
.aplayer-bar {
height: 6px;
border-radius: 4px;
}
#anMusic-page
meting-js
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-bar-wrap
.aplayer-bar
.aplayer-played {
height: 6px;
border-radius: 4px;
}
#anMusic-page
meting-js
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-bar-wrap
.aplayer-bar
.aplayer-played
.aplayer-thumb {
width: 20px;
height: 20px;
margin-top: -7px;
}
#anMusic-page
meting-js
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-bar-wrap
.aplayer-bar
.aplayer-loaded {
height: 6px;
border-radius: 4px;
}
#anMusic-page .aplayer-body {
width: 60%;
height: 75vh;
}
#anMusic-page ol {
max-height: 75vh !important;
padding-right: 25px;
}
#anMusic-page ol > li {
border-top: 1px solid transparent;
font-size: 14px;
}
#anMusic-page ol > li:hover {
background: rgba(255, 255, 255, 0.2);
border-radius: 6px;
}
#anMusic-page ol > li.aplayer-list-light {
background: rgba(255, 255, 255, 0.2);
border-radius: 6px;
padding: 20px 15px;
}
#anMusic-page ol > li.aplayer-list-light span.aplayer-list-title {
font-weight: bolder;
}
#anMusic-page ol > li.aplayer-list-light .aplayer-list-cur {
display: none;
}
#anMusic-page ol > li span {
color: #fff;
}
#anMusic-page ol > li span.aplayer-list-author {
opacity: 0.6;
}
#anMusic-page .aplayer-pic {
float: none;
width: 180px;
height: 180px;
border-radius: 12px;
margin: auto;
left: 0;
right: 0;
transition: background-image 0.5s ease-in-out;
background-size: cover;
background-color: transparent !important;
}
#anMusic-page .aplayer-info {
margin: 0 20px 0 20px;
border-bottom: none;
}
#anMusic-page .aplayer-info .aplayer-music {
text-align: center;
height: auto;
margin: 15px;
}
#anMusic-page .aplayer-info .aplayer-lrc {
height: 800%;
margin-top: 80px;
mask-image: linear-gradient(
to bottom,
#000,
#000,
#000,
#000,
#000,
#000,
#000,
#000,
#000,
#000,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0)
);
}
#anMusic-page .aplayer-info .aplayer-lrc p {
font-size: 20px;
line-height: 20px !important;
height: 20px !important;
margin: 20px 0 !important;
color: #fff;
}
#anMusic-page .aplayer-info .aplayer-controller {
position: fixed;
max-width: 1500px;
margin: auto;
left: 0;
right: 0;
bottom: 50px;
}
#anMusic-page .aplayer-info .aplayer-controller .aplayer-bar-wrap {
margin: 0 160px 0 150px;
}
#anMusic-page .aplayer-info .aplayer-controller .aplayer-played {
background: #fff !important;
}
#anMusic-page .aplayer-info .aplayer-controller .aplayer-thumb {
-webkit-transform: none;
transform: none;
background: #fff !important;
}
#anMusic-page .aplayer-info .aplayer-time {
position: absolute;
width: 100%;
bottom: 21px;
height: 0;
display: flex;
justify-content: flex-end;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner {
margin-right: 18px;
margin-top: -8px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back {
position: absolute;
left: 0;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play {
position: absolute;
left: 40px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward {
position: absolute;
left: 80px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon {
width: 2rem;
height: 2rem;
margin-left: 15px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon path {
fill: #fff;
opacity: 0.8;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-menu {
display: none;
}
#anMusic-page .aplayer-list {
width: 40%;
max-height: none !important;
height: 100%;
}
body:has(#anMusic-page) #footer,
body:has(#anMusic-page) #nav-music {
display: none;
}
#anMusic-page .aplayer-info .aplayer-music .aplayer-author,
#anMusic-page .aplayer-info .aplayer-music .aplayer-title {
font-size: 2rem;
font-weight: 700;
color: #fff;
}
#anMusic-page .aplayer .aplayer-lrc:after,
#anMusic-page .aplayer .aplayer-lrc:before {
display: none;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back,
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward,
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play {
display: inline;
}
.page:has(#anMusic-page) #nav {
backdrop-filter: none !important;
background: 0 0 !important;
border-bottom: none !important;
box-shadow: none;
}
.page:has(#anMusic-page) #page-header.not-top-img #nav a,
.page:has(#anMusic-page) #page-header #nav .back-home-button {
color: #fff;
}
[data-theme="dark"] .page:has(#anMusic-page) #page-header:before {
background-color: transparent;
}
@media screen and (max-width: 768px) {
body:has(#anMusic-page) #rightside {
display: none;
}
#anMusic-page .aplayer-list {
position: fixed;
z-index: 1002;
width: 100%;
bottom: -76%;
left: 0;
background: var(--sidebar-bg);
height: auto;
border-radius: 15px 15px 0px 0px;
padding: 15px 0px;
}
#anMusic-page .aplayer-list.aplayer-list-hide {
bottom: 0% !important;
}
#anMusic-page ol {
max-height: 60vh !important;
padding-right: 0px;
}
#anMusic-page ol > li {
display: flex;
margin: 0 10px;
}
#anMusic-page ol > li span {
color: var(--font-color);
}
#anMusic-page ol > li span.aplayer-list-title {
width: 30%;
max-width: 55%;
width: auto;
display: -webkit-box;
-webkit-line-clamp: 1;
overflow: hidden;
-webkit-box-orient: vertical;
}
#anMusic-page ol > li span.aplayer-list-author {
position: absolute;
right: 10px;
width: auto;
max-width: 35%;
display: -webkit-box;
-webkit-line-clamp: 1;
overflow: hidden;
-webkit-box-orient: vertical;
}
#anMusic-page ol > li.aplayer-list-light {
background: #33a673;
padding: 5px 20px;
border-radius: 10px;
}
#anMusic-page ol > li.aplayer-list-light span {
color: #fff;
}
#anMusic-page ol > li.aplayer-list-light span.aplayer-list-author {
right: 15px;
}
#anMusic-page .aplayer-body {
width: 100%;
position: fixed;
margin: auto;
left: 0;
right: 0;
top: 100px;
}
#anMusic-page .aplayer-info .aplayer-lrc {
margin-top: 40px;
height: auto;
max-height: 200%;
min-height: 100%;
mask-image: linear-gradient(
to bottom,
#000,
#000,
#000,
#000,
rgba(0, 0, 0, 0),
rgba(0, 0, 0, 0)
);
}
#anMusic-page .aplayer-info .aplayer-lrc p.aplayer-lrc-current {
color: #33a673;
}
#anMusic-page .aplayer-info .aplayer-controller {
width: 100%;
bottom: 100px;
}
#anMusic-page .aplayer-info .aplayer-controller .aplayer-bar-wrap {
margin: 0 30px;
}
#anMusic-page .aplayer-info .aplayer-time {
bottom: -40px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner {
position: absolute;
width: 100%;
margin-right: 0;
margin-top: -33px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner .aplayer-dtime {
position: absolute;
right: 30px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-time-inner .aplayer-ptime {
position: absolute;
left: 35px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-back {
margin: auto;
right: 110px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-play {
margin: auto;
right: 0;
left: 0;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-forward {
margin: auto;
left: 110px;
right: 0;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-order {
position: absolute;
left: 22px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-loop {
position: absolute;
right: 25px;
}
#anMusic-page .aplayer-info .aplayer-time .aplayer-icon-menu {
display: inline;
position: absolute;
right: 25px;
top: -90px;
}
#anMusic-page .aplayer-volume-bar-wrap {
bottom: 0px;
right: 7px;
}
#anMusic-page
.aplayer
.aplayer-info
.aplayer-controller
.aplayer-volume-wrap {
left: -66px;
}
body:has(#anMusic-page) #content-inner,
body:has(#anMusic-page) #page {
z-index: auto;
}
}

创建music.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* copy from anzhiyu-hexo-music
*/
// custom api
var meting_api =
"https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r";
var anzhiyu_music = {
// 音乐节目切换背景
changeMusicBg: function (isChangeBg = true) {
if (window.location.pathname != "/music/") {
return;
}
const anMusicBg = document.getElementById("an_music_bg");

if (isChangeBg) {
// player listswitch 会进入此处
const musiccover = document.querySelector("#anMusic-page .aplayer-pic");
anMusicBg.style.backgroundImage = musiccover.style.backgroundImage;
} else {
// 第一次进入,绑定事件,改背景
let timer = setInterval(() => {
const musiccover = document.querySelector("#anMusic-page .aplayer-pic");
// 确保player加载完成
if (musiccover) {
clearInterval(timer);
// 绑定事件
anzhiyu_music.addEventListenerChangeMusicBg();
}
}, 100);
}
},
addEventListenerChangeMusicBg: function () {
const anMusicPage = document.getElementById("anMusic-page");
const aplayerIconMenu = anMusicPage.querySelector(
".aplayer-info .aplayer-time .aplayer-icon-menu"
);

anMusicPage
.querySelector("meting-js")
.aplayer.on("loadeddata", function () {
anzhiyu_music.changeMusicBg();
console.info("player loadeddata");
});

aplayerIconMenu.addEventListener("click", function () {
document.getElementById("menu-mask").style.display = "block";
document.getElementById("menu-mask").style.animation =
"0.5s ease 0s 1 normal none running to_show";
});

document.getElementById("menu-mask").addEventListener("click", function () {
if (window.location.pathname != "/music/") return;
anMusicPage
.querySelector(".aplayer-list")
.classList.remove("aplayer-list-hide");
});
},
};

anzhiyu_music.changeMusicBg(false);

_config.butterfly.yml中注入代码添加配置,其中id为歌单 id

1
2
3
4
5
6
7
8
9
# music
# see https://anzhiy.cn/
anzhiyu_music:
enable: true #控制开关
id: "2004259211" #歌单id
server: netease #【可选】服务商
customJS: #【可选】自定义js
customCSS: /css/music.css #【可选】自定义css
front_matter: /scripts/music.js #【可选】自定义页面front_matter

效果

标题居中

butterfly的最近几个版本中改成了标题居左下,居中需要修改themes/butterfly/source/css/_layout/head.styl

1
2
3
4
5
6
7
8
9
10
  #post-info
position: absolute
- bottom: 30px
+ bottom: 100px
padding: 0 8%
width: 100%
+ text-align: center

+maxWidth768()
bottom: 22px

效果

波浪效果

修改themes/butterfly/layout/includes/header/index.pug

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if top_img !== false
if is_post()
include ./post-info.pug
+ section.main-hero-waves-area.waves-area
+ svg.waves-svg(xmlns='http://www.w3.org/2000/svg', xlink='http://www.w3.org/1999/xlink', viewBox='0 24 150 28', preserveAspectRatio='none', shape-rendering='auto')
+ defs
+ path#gentle-wave(d='M -160 44 c 30 0 58 -18 88 -18 s 58 18 88 18 s 58 -18 88 -18 s 58 18 88 18 v 44 h -352 Z')
+ g.parallax
+ use(href='#gentle-wave', x='48', y='0')
+ use(href='#gentle-wave', x='48', y='3')
+ use(href='#gentle-wave', x='48', y='5')
+ use(href='#gentle-wave', x='48', y='7')
#post-top-cover
img#post-top-bg(class='nolazyload' src=bg_img)
else if is_home()
#site-info
h1#site-title=site_title
if theme.subtitle.enable

添加wave.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* 波浪css */
.main-hero-waves-area {
width: 100%;
position: absolute;
left: 0;
bottom: -11px;
z-index: 5;
}
.waves-area .waves-svg {
width: 100%;
height: 5rem;
}
/* Animation */

.parallax > use {
animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
}
.parallax > use:nth-child(1) {
animation-delay: -2s;
animation-duration: 7s;
fill: #f7f9febd;
}
.parallax > use:nth-child(2) {
animation-delay: -3s;
animation-duration: 10s;
fill: #f7f9fe82;
}
.parallax > use:nth-child(3) {
animation-delay: -4s;
animation-duration: 13s;
fill: #f7f9fe36;
}
.parallax > use:nth-child(4) {
animation-delay: -5s;
animation-duration: 20s;
fill: #f7f9fe;
}
/* 黑色模式背景 */
[data-theme="dark"] .parallax > use:nth-child(1) {
animation-delay: -2s;
animation-duration: 7s;
fill: #18171dc8;
}
[data-theme="dark"] .parallax > use:nth-child(2) {
animation-delay: -3s;
animation-duration: 10s;
fill: #18171d80;
}
[data-theme="dark"] .parallax > use:nth-child(3) {
animation-delay: -4s;
animation-duration: 13s;
fill: #18171d3e;
}
[data-theme="dark"] .parallax > use:nth-child(4) {
animation-delay: -5s;
animation-duration: 20s;
fill: #18171d;
}

@keyframes move-forever {
0% {
transform: translate3d(-90px, 0, 0);
}
100% {
transform: translate3d(85px, 0, 0);
}
}
/*Shrinking for mobile*/
@media (max-width: 768px) {
.waves-area .waves-svg {
height: 40px;
min-height: 40px;
}
}

效果