Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
235 lines (202 loc) · 9.6 KB
/
Copy pathindex.html
File metadata and controls
235 lines (202 loc) · 9.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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="./favicon.png">
<title>开源代码 | source-code | Qcy's Blog</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.animate-gradient {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite;
}
.glass-panel {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}
.glass-card {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(5px);
transition: all 0.3s ease;
}
.glass-card:hover {
transform: translateY(-5px);
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}
.btn-animate {
position: relative;
overflow: hidden;
transition: all 0.3s ease;
}
.btn-animate::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
width: 0;
height: 0;
background: rgba(255, 255, 255, 0.2);
border-radius: 50%;
transform: translate(-50%, -50%);
transition: width 0.6s ease, height 0.6s ease;
}
.btn-animate:active::after {
width: 200px;
height: 200px;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
::selection {
background-color: #3b82f6;
color: white;
}
::-moz-selection {
background-color: #3b82f6;
color: white;
}
</style>
</head>
<body class="animate-gradient min-h-screen font-sans text-gray-800 selection:bg-blue-500 selection:text-white">
<nav class="fixed top-0 w-full z-50 glass-panel px-6 py-4 flex justify-between items-center">
<div class="flex items-center space-x-3">
<i class="fa-solid fa-code text-white text-2xl"></i>
<span class="text-white font-bold text-xl tracking-wider">开源代码 | source-code</span>
</div>
<a href="https://www.qcyblog.dpdns.org" class="btn-animate bg-white/20 hover:bg-white/30 text-white px-6 py-2 rounded-full font-medium border border-white/30 transition-colors flex items-center gap-2">
<i class="fa-solid fa-house"></i>
返回主站
</a>
</nav>
<main class="container mx-auto px-4 pt-24 pb-12">
<div class="text-center mb-12">
<h1 class="text-4xl md:text-5xl font-bold text-white mb-4 drop-shadow-md">Qcy的开源代码</h1>
<p class="text-white/80 text-lg mb-8">探索高质量的前端、后端及全栈项目源码</p>
<div class="max-w-2xl mx-auto relative">
<input type="text" id="searchInput" placeholder="搜索项目名称、技术栈..."
class="w-full px-6 py-4 rounded-full bg-white/90 backdrop-blur shadow-lg focus:outline-none focus:ring-4 focus:ring-white/30 text-gray-700 placeholder-gray-400 transition-all">
<button class="absolute right-2 top-2 bg-indigo-600 hover:bg-indigo-700 text-white p-2.5 rounded-full transition-colors">
<i class="fa-solid fa-magnifying-glass"></i>
</button>
</div>
</div>
<div id="sourceList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
</div>
<div id="emptyState" class="hidden text-center py-20">
<i class="fa-regular fa-folder-open text-6xl text-white/50 mb-4"></i>
<p class="text-white text-xl">未找到相关源代码</p>
</div>
</main>
<footer class="text-center py-6 text-white/60 text-sm">
<p>© 2026 source-code | Qcy's Blog.</p>
</footer>
<script>
const sources = [
{
id: 1,
title: "SHA-512-generator",
description: "使用C++制作,伪SHA-512,其实是512个随机字符,不是真的!",
tags: ["C++"],
downloads: 0,
date: "2026-08-15"
},
];
function renderSources(data) {
const container = document.getElementById('sourceList');
const emptyState = document.getElementById('emptyState');
container.innerHTML = '';
if (data.length === 0) {
emptyState.classList.remove('hidden');
return;
} else {
emptyState.classList.add('hidden');
}
data.forEach(item => {
const card = document.createElement('div');
card.className = 'glass-card rounded-2xl p-6 flex flex-col h-full relative group';
const tagsHtml = item.tags.map(tag =>
`<span class="px-2 py-1 bg-indigo-100 text-indigo-600 text-xs rounded-md font-medium">${tag}</span>`
).join('');
card.innerHTML = `
<div class="flex justify-between items-start mb-4">
<div class="bg-gradient-to-br from-indigo-500 to-purple-500 w-12 h-12 rounded-lg flex items-center justify-center text-white shadow-lg">
<i class="fa-solid fa-code-branch"></i>
</div>
<div class="flex space-x-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300">
<button class="text-gray-400 hover:text-indigo-600 transition-colors" title="收藏"><i class="fa-regular fa-heart"></i></button>
<button class="text-gray-400 hover:text-indigo-600 transition-colors" title="分享"><i class="fa-solid fa-share-nodes"></i></button>
</div>
</div>
<h3 class="text-xl font-bold text-gray-800 mb-2 group-hover:text-indigo-600 transition-colors">${item.title}</h3>
<p class="text-gray-500 text-sm mb-4 flex-grow line-clamp-3">${item.description}</p>
<div class="flex flex-wrap gap-2 mb-6">
${tagsHtml}
</div>
<div class="border-t border-gray-100 pt-4 flex items-center justify-between mt-auto">
<div class="text-xs text-gray-400">
<span class="mr-3"><i class="fa-regular fa-calendar mr-1"></i> ${item.date}</span>
<span><i class="fa-solid fa-download mr-1"> ${item.downloads}
<div class="flex space-x-3">
<button onclick="viewSource(${item.id})" class="btn-animate px-4 py-2 rounded-lg text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 transition-colors">
查看
</button>
<button onclick="downloadSource(${item.id})" class="btn-animate px-4 py-2 rounded-lg text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 shadow-md hover:shadow-lg transition-all">
下载
</button>
</div>
</div>
`;
container.appendChild(card);
});
}
document.getElementById('searchInput').addEventListener('input', (e) => {
const keyword = e.target.value.toLowerCase();
const filtered = sources.filter(item =>
item.title.toLowerCase().includes(keyword) ||
item.description.toLowerCase().includes(keyword) ||
item.tags.some(tag => tag.toLowerCase().includes(keyword))
);
renderSources(filtered);
});
window.viewSource = function(id) {
const item = sources.find(s => s.id === id);
alert(`正在打开预览: ${item.title}\n(实际项目中此处应跳转至详情页)`);
};
window.downloadSource = function(id) {
const item = sources.find(s => s.id === id);
const btn = event.currentTarget;
const originalText = btn.innerHTML;
btn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin"></i>';
setTimeout(() => {
btn.innerHTML = '<i class="fa-solid fa-check"></i> 已启动';
setTimeout(() => {
btn.innerHTML = originalText;
alert(`开始下载: ${item.title}.zip`);
}, 1000);
}, 800);
};
renderSources(sources);
</script>
</body>
</html>