-
Notifications
You must be signed in to change notification settings - Fork 0
/
apps.html
425 lines (360 loc) · 16.1 KB
/
apps.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Apps-TobDeng</title>
<link rel="shortcut icon" href="./imager/code library.png" type="icon"></link>
<link rel="stylesheet" href="./style.css">
<style>
body{
background-color: #f4f2f168;
}
.header{
height: 80px;
background-color: white;
}
a{
padding-bottom: 6px;
color: #565e6c;
font-size: 20px;
font-weight: 700
}
a:hover,
.apps{
color: #373a40;
border-bottom: #ff5500da 2.5px solid;
}
ul{
width: 75%;
line-height: 80px;
display: flex;
justify-content: flex-end;
gap: 40px;
}
.name{
text-align: center;
font-size: 30px;
}
.name h1{
font-size: 200%;
margin-top: 70px;
margin-bottom: 20px;
font-weight: 600;
display: inline-block;
}
.name .color{
background: linear-gradient(to right, rgb(242, 44, 44), rgb(255, 111, 1));-webkit-background-clip: text;
color: transparent;
text-align: center;
}
.icon-1,
.icon-1:hover,
.icon-2,
.icon-2:hover{
border-bottom: #ff5500da 0px solid;
}
/* APPS-BOX */
.box{
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
.box li{
width: 600px;
height: 150px;
margin-top: 30px;
background-color: white;
box-shadow: 2px 3px 9px 1px rgba(76, 69, 69, 0.3);
border-radius: 10px;
transition: 0.5s;
}
.box li:hover{
box-shadow: 4px 6px 9px 4px rgba(76, 69, 69, 0.3);
padding-top: 5px;
transition: 0.5s;
}
.box li img{
width: 150px;
height: 150px;
border-radius: 15px;
}
.apps-name{
margin-left: 400px;
}
.apps-name {
}
.apps-tp{
}
/* Music */
.container {
text-align: center;
max-width: 300px;
background-color: #fff;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
position: relative;
}
.music-player {
/* 固定在左下角移动也是 */
position: fixed;
bottom: 10px;
}
.toggle-button {
position: absolute;
top: 10px;
right: 10px;
background-color: transparent;
border: none;
cursor: pointer;
padding: 5px;
}
.toggle-button img {
width: 20px;
height: 20px;
margin-right: -2px;
}
.song-info img {
width: 100%;
border-radius: 8px;
margin-bottom: 15px;
}
.song-info h2 {
font-size: 18px;
color: rgb(23, 23, 23);
margin-bottom: 10px;
}
.song-info p {
font-size: 14px;
color: rgb(57, 55, 53);
margin-bottom: 15px;
}
.custom-player {
display: flex;
align-items: center;
justify-content: space-between;
}
.custom-player button {
background-color: transparent;
border: none;
width: 50px; /* 调整按钮大小 */
height: 50px; /* 调整按钮大小 */
cursor: pointer;
transition: transform 0.3s ease;
padding: 0;
}
.custom-player button:hover {
transform: scale(1.1);
}
.custom-player button:focus {
outline: none;
}
.custom-player img {
width: 100%; /* 图标适应按钮大小 */
height: 100%; /* 图标适应按钮大小 */
}
.progress-bar {
flex-grow: 1;
height: 5px;
background-color: #ddd;
border-radius: 5px;
margin: 0 10px;
position: relative;
}
.progress-bar-fill {
height: 100%;
background-color: rgb(242, 44, 44);
width: 0;
border-radius: 5px;
}
.play-button {
margin-top: 15px;
padding: 10px 20px;
background-color: rgb(242, 44, 44);
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.play-button:hover {
background-color: rgb(255, 111, 1);
}
audio {
display: none; /* 隐藏默认播放器 */
}
.collapsed .song-info,
.collapsed .play-button {
display: none;
}
.collapsed {
padding: 10px 20px;
}
</style>
</head>
<body>
<div class="header">
<ul>
<li><a href="./index.html">Home</a></li></li>
<li><a href="#apps" class="apps">Apps</a></li></li>
<li><a href="./code.html">Code</a></li></li>
<li><a href="./about.html">About</a></li></li>
<li><a class="icon-1" href="#rss"><svg style="width: 1.5em;height: 1.5em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3499"><path d="M763.904 921.6l157.696 0c0-444.416-367.616-806.4-819.2-806.4l0 154.624c364.544 0 661.504 292.352 661.504 651.776zM485.376 921.6l157.696 0c0-293.376-242.688-532.48-540.672-532.48l0 154.624c102.4 0 198.144 39.424 270.848 110.592 72.192 71.168 112.128 166.4 112.128 267.264zM211.456 920.576c59.904 0 109.056-47.616 109.056-107.008 0-58.88-49.152-107.008-109.056-107.008-60.416 0-109.056 48.128-109.056 107.008 0 59.392 48.64 107.008 109.056 107.008z" p-id="3500"></path></svg></a></li>
<li><a class="icon-2" href="#email"><svg class="icon" style="width: 1.8em;height: 1.8em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4722"><path d="M887.044 267.194H135.36c-39.56 0-71.631 32.07-71.631 71.632v463.536c0 39.561 32.07 71.632 71.631 71.632h751.685c39.561 0 71.632-32.07 71.632-71.632V338.826c0-39.562-32.07-71.632-71.632-71.632z m12.733 100.255v406.715c0 0.039-0.003 0.077-0.003 0.116L683.68 580.338l216.097-212.89zM383.103 620.616c70.996 50.776 191.38 54.63 258.105 0.748L857.07 815.095H166.406l216.697-194.48z m471.412-294.523l-218.34 215.055c-77.786 80.175-179.434 75.4-252.906-1.627L171.962 326.093h682.553z m-731.889 40.932c0-2.023 0.153-4.01 0.436-5.953l216.892 219.127-217.3 195.023c-0.01-0.353-0.027-0.704-0.027-1.058V367.025z" p-id="4723"></path></svg></a></li>
</ul>
</div>
<div class="name">
<h1>Quality crafted</h1> <h1 class="color">apps</h1>
</div>
<ul class="box">
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
<li><img src="https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/23/7d/57/237d57bc-3b5a-a5ed-c543-91c22721a9f7/AppIcon-0-0-1x_U007emarketing-0-4-0-85-220.png/230x0w.webp"alt="Procreate"></li>
</ul>
<div class="music-player">
<div class="container" id="player-container">
<button class="toggle-button" onclick="togglePlayer()">
<img src="./imager/fullscreen-exit.png" alt="Toggle">
</button>
<div class="song-info" id="song-info">
<p>Tap the button to get random songs</p>
</div>
<button class="play-button" onclick="fetchRandomSong()">Get random music</button>
<div class="custom-player" id="custom-player">
</div>
</div>
</div>
<script>
let audio;
let isPlaying = false;
// 恢复音乐播放状态
window.onload = function () {
const savedSong = localStorage.getItem('currentSong');
const savedIsPlaying = localStorage.getItem('isPlaying');
const savedCurrentTime = localStorage.getItem('currentTime');
if (savedSong) {
audio = new Audio(savedSong);
audio.currentTime = savedCurrentTime ? parseFloat(savedCurrentTime) : 0;
const songInfoDiv = document.getElementById('song-info');
songInfoDiv.innerHTML = `
<img src="${localStorage.getItem('songImg')}" alt="封面">
<h2>${localStorage.getItem('songName')}</h2>
<p>${localStorage.getItem('songArtist')}</p>
`;
const customPlayerDiv = document.getElementById('custom-player');
customPlayerDiv.innerHTML = `
<button id="play-pause-btn">
<img src="./imager/play.png" alt="播放">
</button>
<div class="progress-bar">
<div class="progress-bar-fill" id="progress-bar-fill"></div>
</div>
`;
const playPauseBtn = document.getElementById('play-pause-btn');
const progressBarFill = document.getElementById('progress-bar-fill');
playPauseBtn.addEventListener('click', function () {
if (!isPlaying) {
audio.play();
playPauseBtn.innerHTML = '<img src="./imager/pause.png" alt="暂停">';
localStorage.setItem('isPlaying', 'true');
} else {
audio.pause();
playPauseBtn.innerHTML = '<img src="./imager/play.png" alt="播放">';
localStorage.setItem('isPlaying', 'false');
}
isPlaying = !isPlaying;
});
audio.addEventListener('timeupdate', function () {
const progress = (audio.currentTime / audio.duration) * 100;
progressBarFill.style.width = `${progress}%`;
// 更新当前播放时间到 localStorage
localStorage.setItem('currentTime', audio.currentTime);
});
if (savedIsPlaying === 'true') {
audio.play();
playPauseBtn.innerHTML = '<img src="./imager/pause.png" alt="暂停">';
isPlaying = true;
}
}
};
function togglePlayer() {
const playerContainer = document.getElementById('player-container');
playerContainer.classList.toggle('collapsed');
const toggleButton = document.querySelector('.toggle-button img');
if (playerContainer.classList.contains('collapsed')) {
toggleButton.src = './imager/fullscreen-enter.png';
} else {
toggleButton.src = './imager/fullscreen-exit.png';
}
}
async function fetchRandomSong() {
// 如果有正在播放的歌曲,暂停并重置
if (audio) {
audio.pause();
audio.currentTime = 0;
isPlaying = false;
document.getElementById('play-pause-btn').innerHTML = '<img src="./imager/play.png" alt="播放">';
}
const response = await fetch('https://api.cenguigui.cn/api/netease/');
const data = await response.json();
if (data.code === 200) {
const songInfoDiv = document.getElementById('song-info');
songInfoDiv.innerHTML = `
<img src="${data.data.img}" alt="封面">
<h2>${data.data.song_name}</h2>
<p>${data.data.artist}</p>
`;
audio = new Audio(data.data.play_url);
const customPlayerDiv = document.getElementById('custom-player');
customPlayerDiv.innerHTML = `
<button id="play-pause-btn">
<img src="./imager/play.png" alt="播放">
</button>
<div class="progress-bar">
<div class="progress-bar-fill" id="progress-bar-fill"></div>
</div>
`;
const playPauseBtn = document.getElementById('play-pause-btn');
const progressBarFill = document.getElementById('progress-bar-fill');
playPauseBtn.addEventListener('click', function () {
if (!isPlaying) {
audio.play();
playPauseBtn.innerHTML = '<img src="./imager/pause.png" alt="暂停">';
savePlaybackState(data.data.play_url, data.data.img, data.data.song_name, data.data.artist);
} else {
audio.pause();
playPauseBtn.innerHTML = '<img src="./imager/play.png" alt="播放">';
localStorage.setItem('isPlaying', 'false');
}
isPlaying = !isPlaying;
});
audio.addEventListener('timeupdate', function () {
const progress = (audio.currentTime / audio.duration) * 100;
progressBarFill.style.width = `${progress}%`;
// 更新当前播放时间到 localStorage
localStorage.setItem('currentTime', audio.currentTime);
});
// 播放新歌时保存所有信息
savePlaybackState(data.data.play_url, data.data.img, data.data.song_name, data.data.artist);
} else {
alert('获取歌曲失败,请稍后重试。');
}
}
function savePlaybackState(url, img, name, artist) {
localStorage.setItem('currentSong', url);
localStorage.setItem ('songImg', img);
localStorage.setItem('songName', name);
localStorage.setItem('songArtist', artist);
localStorage.setItem('isPlaying', 'true');
localStorage.setItem('currentTime', audio.currentTime);
}
</script>
</body>
</html>