forked from blueeggs1125-art/bluekard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsuck.html
More file actions
432 lines (366 loc) · 13.6 KB
/
suck.html
File metadata and controls
432 lines (366 loc) · 13.6 KB
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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<link rel="icon" type="image/png" sizes="16x16" href="icon/16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="icon/32x32.png">
<link rel="icon" type="image/png" sizes="48x48" href="icon/48x48.png">
<link rel="icon" type="image/png" sizes="64x64" href="icon/64x64.png">
<link rel="icon" type="image/png" sizes="128x128" href="icon/128x128.png">
<link rel="icon" type="image/png" sizes="256x256" href="icon/256x256.png">
<link rel="icon" type="image/png" sizes="512x512" href="icon/512x512.png">
<link rel="apple-touch-icon" sizes="180x180" href="icon/180x180.png">
<link rel="manifest" href="site.webmanifest">
<meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<title>FUCK 1939</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
padding: 10px;
background-color: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #333;
font-size: 24px;
}
/* 添加分类选择样式 */
.category-selector {
text-align: center;
margin-bottom: 20px;
}
.category-selector select {
padding: 8px 15px;
font-size: 16px;
border: 2px solid #1e90ff;
border-radius: 5px;
background-color: white;
color: #333;
cursor: pointer;
}
.sound-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 15px;
margin-top: 10px;
}
.sound-item {
position: relative;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
background-color: white;
aspect-ratio: 1/1;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: transform 0.2s;
}
.sound-item:hover {
transform: scale(1.05);
}
.sound-item .sound-name {
padding: 10px;
font-size: 14px;
text-align: center;
color: #333;
word-break: break-word;
}
.no-sounds {
text-align: center;
padding: 40px 20px;
color: #999;
font-style: italic;
grid-column: 1 / -1;
}
.loading {
text-align: center;
padding: 40px 20px;
color: #666;
grid-column: 1 / -1;
}
/* 添加导航链接样式 */
.nav-link {
display: block;
text-align: center;
margin: 15px 0;
color: #1e90ff;
text-decoration: none;
font-weight: bold;
}
.nav-link:hover {
text-decoration: underline;
}
@media (max-width: 768px) {
.container {
padding: 0 10px;
}
.sound-container {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: 10px;
}
h1 {
font-size: 20px;
}
}
@media (max-width: 480px) {
.sound-container {
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
gap: 8px;
}
.sound-item .sound-name {
font-size: 12px;
padding: 5px;
}
}
audio {
display: none;
}
</style>
</head>
<body>
<div class="container">
<h1>KARDS音效</h1>
<!-- 添加分类选择器 -->
<div class="category-selector">
<select id="category-select">
<option value="all">全部音效</option>
</select>
</div>
<div id="sound-display">
<div class="loading">加载中...</div>
</div>
</div>
<style>
/* 在现有样式基础上添加 */
.container {
padding-bottom: 60px; /* 为底部导航栏留出空间 */
}
</style>
<!-- 在 </body> 标签前添加 -->
<div style="position: fixed; bottom: 0; left: 0; right: 0; background-color: #fff; border-top: 1px solid #ddd; display: flex; justify-content: space-around; padding: 10px 0; z-index: 1000; font-size: 14px;">
<a href="index.html" style="text-decoration: none; color: #1e90ff; text-align: center;">卡图</a>
<a href="image2.html" style="text-decoration: none; color: #1e90ff; text-align: center;">其他素材</a>
<a href="suck.html" style="text-decoration: none; color: #1e90ff; text-align: center;">音效库</a>
<a href="zaza.html" style="text-decoration: none; color: #1e90ff; text-align: center;">加载动画</a>
<a href="team.html" style="text-decoration: none; color: #1e90ff; text-align: center;">关于</a>
</div>
<audio id="audio-player"></audio>
<script>
// 音频文件数据 - 从files.json获取
let soundFiles = [];
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', initSoundPage);
async function initSoundPage() {
const soundDisplay = document.getElementById('sound-display');
try {
// 获取音效文件列表
const response = await fetch('sound/files.json');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
soundFiles = await response.json();
if (soundFiles.length === 0) {
soundDisplay.innerHTML = '<div class="no-sounds">暂无音效文件</div>';
return;
}
// 过滤出MP3文件
const mp3Sounds = soundFiles.filter(sound =>
sound.toLowerCase().endsWith('.mp3')
);
if (mp3Sounds.length === 0) {
soundDisplay.innerHTML = '<div class="no-sounds">暂无MP3音效文件</div>';
return;
}
// 创建分类选择器
createCategorySelector(mp3Sounds);
// 显示所有音效
displaySounds(mp3Sounds);
} catch (error) {
console.error('加载音效出错:', error);
soundDisplay.innerHTML = '<div class="no-sounds">加载音效失败</div>';
}
}
// 创建分类选择器
function createCategorySelector(sounds) {
// 获取所有分类
const categories = new Set();
sounds.forEach(sound => {
const pathParts = sound.split('/');
if (pathParts.length > 2) {
categories.add(pathParts[1]); // 添加子文件夹名作为分类
}
});
// 获取选择器元素
const select = document.getElementById('category-select');
// 添加分类选项
Array.from(categories).sort().forEach(category => {
const option = document.createElement('option');
option.value = category;
option.textContent = category;
select.appendChild(option);
});
// 添加事件监听器
select.addEventListener('change', function() {
const selectedCategory = this.value;
filterSoundsByCategory(sounds, selectedCategory);
});
}
// 根据分类过滤音效
function filterSoundsByCategory(sounds, category) {
let filteredSounds = sounds;
if (category !== 'all') {
filteredSounds = sounds.filter(sound => {
const pathParts = sound.split('/');
return pathParts.length > 2 && pathParts[1] === category;
});
}
displaySounds(filteredSounds);
}
// 显示音效按钮
function displaySounds(sounds) {
const soundDisplay = document.getElementById('sound-display');
if (sounds.length === 0) {
soundDisplay.innerHTML = '<div class="no-sounds">该分类下暂无音效文件</div>';
return;
}
let html = '<div class="sound-container">';
sounds.forEach(sound => {
const fileName = sound.split('/').pop().replace('.mp3', '').replace('.MP3', '');
html += `
<div class="sound-item"
data-src="${sound}"
data-filename="${sound.split('/').pop()}">
<div class="sound-name">${fileName}</div>
</div>
`;
});
html += '</div>';
soundDisplay.innerHTML = html;
// 为每个音效按钮添加事件监听器
document.querySelectorAll('.sound-item').forEach(item => {
// PC端事件
item.addEventListener('click', () => {
playSound(item.getAttribute('data-src'));
});
item.addEventListener('contextmenu', (event) => {
event.preventDefault();
downloadSound(event, item.getAttribute('data-src'), item.getAttribute('data-filename'));
});
// 移动端事件
item.addEventListener('touchstart', (event) => {
handleTouchStart(event, item.getAttribute('data-src'), item.getAttribute('data-filename'));
});
item.addEventListener('touchend', handleTouchEnd);
item.addEventListener('touchmove', handleTouchMove);
});
}
// 播放音效
function playSound(src) {
const audioPlayer = document.getElementById('audio-player');
// 停止当前播放的音效
audioPlayer.pause();
audioPlayer.currentTime = 0;
// 播放新音效
audioPlayer.src = src;
audioPlayer.play();
}
// 下载音效文件
function downloadSound(event, url, filename) {
event.preventDefault();
const link = document.createElement('a');
link.href = url;
// 解码文件名用于下载
link.download = decodeURIComponent(filename);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
// 移动端触摸处理
let longPressTimer;
function handleTouchStart(event, url, filename) {
longPressTimer = setTimeout(() => {
downloadSound(event, url, filename);
}, 1000); // 长按1秒触发下载
}
function handleTouchEnd() {
clearTimeout(longPressTimer);
}
function handleTouchMove() {
clearTimeout(longPressTimer);
}
</script>
<style>
/* 统一的页面载入动画 */
@keyframes pageSlideIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 应用到所有页面容器 */
.container {
animation: pageSlideIn 0.4s ease-out forwards;
}
/* 为已有动画的页面调整动画 */
.content {
animation: pageSlideIn 0.4s ease-out forwards;
}
/* 视频列表动画 */
.video-list {
animation: pageSlideIn 0.4s ease-out forwards;
}
/* 音效容器动画 */
#sound-display {
animation: pageSlideIn 0.4s ease-out forwards;
}
/* 图片容器动画 */
#image-display {
animation: pageSlideIn 0.4s ease-out forwards;
}
/* 导航栏动画 */
.bottom-nav {
animation: pageSlideIn 0.4s ease-out 0.1s forwards;
animation-fill-mode: both;
}
/* 初始状态设置 */
.container,
.content,
.video-list,
#sound-display,
#image-display,
.bottom-nav {
opacity: 0;
}
/* 延迟显示内容,避免闪烁 */
@media (prefers-reduced-motion: reduce) {
.container,
.content,
.video-list,
#sound-display,
#image-display,
.bottom-nav {
animation: none;
opacity: 1;
}
}
</style>
</body>
</html>