-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode
More file actions
354 lines (310 loc) · 17.2 KB
/
Copy pathcode
File metadata and controls
354 lines (310 loc) · 17.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Squad Busters | Fan Assets Library</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Archivo+Black&family=Inter:wght@400;600;900&display=swap" rel="stylesheet">
<style>
:root {
--sb-purple-bright: #a855f7;
--sb-purple-main: #7c2ae8;
--sb-purple-dark: #2e1065;
--sb-purple-deep: #0f041d;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--sb-purple-deep);
color: white;
overflow: hidden;
}
.font-squad { font-family: 'Archivo Black', sans-serif; text-transform: uppercase; }
/* Sidebar Glassmorphism */
#sidebar {
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
width: 20rem;
background: linear-gradient(to bottom, rgba(15, 4, 29, 0.9), rgba(46, 16, 101, 0.6));
backdrop-filter: blur(20px);
}
#sidebar.collapsed { width: 5rem; }
#sidebar.collapsed .sidebar-hide { display: none; }
/* Icono Espiral Animada */
.spiral-svg { animation: rotateSpiral 15s linear infinite; }
@keyframes rotateSpiral { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.asset-card {
background: rgba(255, 255, 255, 0.03);
border: 2px solid rgba(255, 255, 255, 0.08);
border-radius: 20px;
transition: all 0.3s ease;
cursor: pointer;
}
.asset-card:hover {
transform: translateY(-5px);
border-color: var(--sb-purple-bright);
background: rgba(255, 255, 255, 0.07);
}
/* Políticas Expandidas */
.policy-section {
background: rgba(255, 255, 255, 0.03);
border-radius: 16px;
padding: 16px;
border: 1px solid rgba(255, 255, 255, 0.05);
transition: all 0.3s ease;
}
.policy-section:hover {
background: rgba(168, 85, 247, 0.05);
border-color: rgba(168, 85, 247, 0.2);
}
.drop-zone {
border: 2px dashed rgba(168, 85, 247, 0.4);
transition: all 0.3s ease;
}
.drop-zone:hover, .drop-zone.dragover {
background: rgba(168, 85, 247, 0.1);
border-color: var(--sb-purple-bright);
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--sb-purple-main); border-radius: 10px; }
.preview-img {
width: 100%;
height: 100%;
object-fit: contain;
image-rendering: pixelated;
}
</style>
</head>
<body class="h-screen flex flex-col text-slate-200">
<header class="h-20 border-b border-white/10 flex items-center justify-between px-8 bg-black/40 z-50">
<div class="flex items-center gap-4">
<!-- Espiral Animada como Toggle -->
<div class="w-12 h-12 relative cursor-pointer" id="sidebar-toggle">
<svg viewBox="0 0 100 100" class="spiral-svg w-full h-full">
<path class="fill-none stroke-purple-500 stroke-[7] stroke-linecap-round" d="M50 50 C 50 40, 65 40, 65 50 C 65 65, 35 65, 35 50 C 35 25, 75 25, 75 50 C 75 85, 20 85, 20 50" style="filter: drop-shadow(0 0 5px #a855f7)" />
</svg>
</div>
<h1 class="text-xl font-squad tracking-tighter">Squad <span class="text-purple-400">Explorer</span></h1>
</div>
<div class="flex items-center gap-4">
<input type="text" id="search-bar" placeholder="Search in ZIP..." class="bg-white/5 border border-white/10 rounded-full px-5 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-purple-500 w-64">
</div>
</header>
<div class="flex flex-1 overflow-hidden">
<aside id="sidebar" class="flex flex-col border-r border-white/5">
<div class="p-6 flex-1 overflow-y-auto sidebar-hide no-scrollbar">
<!-- Zip Upload Area -->
<div id="drop-zone" class="drop-zone rounded-2xl p-6 mb-8 text-center cursor-pointer">
<input type="file" id="zip-input" accept=".zip" class="hidden">
<div class="mb-2 flex justify-center">
<svg class="w-8 h-8 text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"></path></svg>
</div>
<p class="text-[10px] font-black uppercase text-purple-300">Upload Assets ZIP</p>
<p class="text-[8px] opacity-40 mt-1">Drop your backup here</p>
</div>
<div class="bg-purple-900/20 border border-purple-500/20 rounded-2xl p-4 mb-8 text-center">
<p class="text-[9px] font-black text-purple-400 uppercase mb-1">Files Loaded</p>
<span id="total-count" class="text-3xl font-squad">0</span>
</div>
<!-- Folders Section -->
<h3 class="text-[10px] font-black text-white/30 uppercase tracking-widest mb-4">Folders</h3>
<nav id="folder-list" class="space-y-1 mb-10">
<p class="text-[9px] opacity-20 italic">No files loaded yet</p>
</nav>
<!-- Expanded Policies Section -->
<h3 class="text-[10px] font-black text-white/30 uppercase tracking-widest mb-4">Terms & Policies</h3>
<div class="space-y-4 mb-8">
<div class="policy-section">
<p class="text-[10px] font-bold text-purple-400 uppercase mb-2">Fan Content Policy</p>
<p class="text-[10px] text-white/50 leading-relaxed">
This library is governed by the <strong>Supercell Fan Content Policy</strong>. Assets provided here must be used for non-commercial, fan-made projects only. Redistribution of raw assets for profit is strictly prohibited.
</p>
</div>
<div class="policy-section">
<p class="text-[10px] font-bold text-purple-400 uppercase mb-2">Copyright Notice</p>
<p class="text-[10px] text-white/50 leading-relaxed">
All characters, UI elements, and sound effects from <strong>Squad Busters</strong> are trademarks of <strong>Supercell</strong>. This tool is a community viewer and has no official affiliation.
</p>
</div>
<div class="policy-section">
<p class="text-[10px] font-bold text-purple-400 uppercase mb-2">Responsibility</p>
<p class="text-[10px] text-white/50 leading-relaxed">
Users are responsible for ensuring their creations do not mislead others into thinking they are official products. Always include a disclaimer in your final works.
</p>
</div>
</div>
<div class="text-center opacity-20 text-[8px] uppercase tracking-widest py-4">
v2.1 Community Explorer
</div>
</div>
</aside>
<main class="flex-1 overflow-y-auto p-8 relative">
<!-- Loading Overlay -->
<div id="loading-overlay" class="hidden absolute inset-0 bg-black/60 backdrop-blur-md z-50 flex items-center justify-center text-center">
<div>
<div class="w-12 h-12 border-4 border-purple-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
<p class="font-squad text-sm" id="loading-text">Processing ZIP...</p>
</div>
</div>
<div id="grid-container" class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 gap-6">
<!-- Welcome screen -->
<div class="col-span-full py-32 text-center">
<div class="w-20 h-20 mx-auto mb-8 opacity-10">
<svg viewBox="0 0 100 100" class="spiral-svg w-full h-full">
<path class="fill-none stroke-white stroke-[5]" d="M50 50 C 50 40, 65 40, 65 50 C 65 65, 35 65, 35 50 C 35 25, 75 25, 75 50 C 75 85, 20 85, 20 50" />
</svg>
</div>
<h2 class="text-3xl font-squad mb-4 opacity-30 tracking-tight">Library Empty</h2>
<p class="text-xs text-white/30 max-w-sm mx-auto leading-relaxed uppercase tracking-tighter">Please upload your compressed asset archive (.zip) via the sidebar to start browsing and previewing items.</p>
</div>
</div>
</main>
</div>
<!-- Modal para ver imagen en grande -->
<div id="preview-modal" class="hidden fixed inset-0 bg-black/95 z-[100] flex items-center justify-center p-8 transition-all" onclick="closeModal()">
<div class="relative max-w-5xl w-full h-full flex flex-col items-center justify-center">
<button class="absolute top-4 right-4 text-white/40 hover:text-white transition-colors p-4 font-black text-xl" onclick="closeModal()">✕</button>
<div class="bg-white/5 p-4 rounded-3xl border border-white/10 backdrop-blur-xl mb-6 max-h-[75%] flex items-center justify-center overflow-hidden">
<img id="modal-img" class="max-h-full max-w-full object-contain" src="" alt="">
</div>
<div class="text-center bg-black/50 p-6 rounded-2xl backdrop-blur-md border border-white/5">
<p id="modal-name" class="font-squad text-xl mb-1 text-purple-400"></p>
<p id="modal-path" class="text-[10px] opacity-40 uppercase tracking-widest font-mono"></p>
</div>
</div>
</div>
<script>
let assetsData = [];
let currentFolder = 'all';
let zipInstance = null;
const zipInput = document.getElementById('zip-input');
const dropZone = document.getElementById('drop-zone');
const loadingOverlay = document.getElementById('loading-overlay');
const loadingText = document.getElementById('loading-text');
// Toggle Sidebar con el icono de espiral
document.getElementById('sidebar-toggle').onclick = () => {
document.getElementById('sidebar').classList.toggle('collapsed');
};
dropZone.onclick = () => zipInput.click();
dropZone.ondragover = (e) => { e.preventDefault(); dropZone.classList.add('dragover'); };
dropZone.ondragleave = () => dropZone.classList.remove('dragover');
dropZone.ondrop = (e) => {
e.preventDefault();
dropZone.classList.remove('dragover');
if (e.dataTransfer.files.length) handleZip(e.dataTransfer.files[0]);
};
zipInput.onchange = (e) => {
if (e.target.files.length) handleZip(e.target.files[0]);
};
async function handleZip(file) {
if (!file.name.endsWith('.zip')) {
alert("Only .zip files are supported.");
return;
}
loadingOverlay.classList.remove('hidden');
loadingText.innerText = "Indexing assets...";
assetsData = [];
try {
zipInstance = await JSZip.loadAsync(file);
const entries = [];
zipInstance.forEach((relativePath, zipEntry) => {
if (!zipEntry.dir) {
const parts = relativePath.split('/');
const fileName = parts.pop();
const folder = parts.join('/') || 'Root';
const extension = fileName.split('.').pop().toLowerCase();
entries.push({
name: fileName,
folder: folder,
extension: extension,
fullPath: relativePath
});
}
});
assetsData = entries;
updateFilters();
renderAssets();
} catch (err) {
console.error(err);
alert("Failed to process ZIP. It might be corrupted or too large for the browser memory.");
} finally {
loadingOverlay.classList.add('hidden');
}
}
async function getFileBlob(path) {
const file = zipInstance.file(path);
if (!file) return null;
const blob = await file.async("blob");
return URL.createObjectURL(blob);
}
async function openPreview(path, name) {
const ext = path.split('.').pop().toLowerCase();
const validImgs = ['png', 'jpg', 'jpeg', 'webp', 'svg'];
if (validImgs.includes(ext)) {
loadingOverlay.classList.remove('hidden');
loadingText.innerText = "Extracting preview...";
const url = await getFileBlob(path);
loadingOverlay.classList.add('hidden');
if (url) {
document.getElementById('modal-img').src = url;
document.getElementById('modal-name').innerText = name;
document.getElementById('modal-path').innerText = path;
document.getElementById('preview-modal').classList.remove('hidden');
}
} else {
console.log("No preview for " + ext);
}
}
function closeModal() {
document.getElementById('preview-modal').classList.add('hidden');
}
function renderAssets() {
const container = document.getElementById('grid-container');
const query = document.getElementById('search-bar').value.toLowerCase();
const filtered = assetsData.filter(a => {
const matchesFolder = currentFolder === 'all' || a.folder === currentFolder;
const matchesSearch = a.name.toLowerCase().includes(query);
return matchesFolder && matchesSearch;
});
if (filtered.length === 0 && assetsData.length > 0) {
container.innerHTML = `<div class="col-span-full py-20 text-center text-white/10 font-squad uppercase text-2xl">No Results</div>`;
return;
}
if (assetsData.length > 0) {
container.innerHTML = filtered.map(a => {
const isImage = ['png', 'jpg', 'jpeg', 'webp', 'svg'].includes(a.extension);
return `
<div class="asset-card p-4 flex flex-col items-center text-center" onclick="openPreview('${a.fullPath}', '${a.name}')">
<div class="w-20 h-20 mb-3 bg-black/40 rounded-2xl flex items-center justify-center border border-white/5 overflow-hidden">
${isImage ?
`<svg class="w-6 h-6 text-purple-500 opacity-40" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>` :
`<span class="text-[10px] font-black opacity-30">${a.extension.toUpperCase()}</span>`
}
</div>
<p class="text-[10px] font-bold truncate w-full mb-0.5">${a.name}</p>
<p class="text-[8px] opacity-20 uppercase tracking-tighter truncate w-full">${a.folder}</p>
</div>
`;
}).join('');
document.getElementById('total-count').innerText = assetsData.length;
}
}
function updateFilters() {
const folders = ['all', ...new Set(assetsData.map(a => a.folder))].sort();
const folderList = document.getElementById('folder-list');
folderList.innerHTML = folders.map(f => `
<button onclick="setFolder('${f}')" class="folder-btn w-full text-left px-4 py-2 rounded-xl text-[9px] font-black uppercase hover:bg-white/10 transition-all flex justify-between items-center ${currentFolder === f ? 'bg-purple-600/30 text-purple-300' : 'text-white/30'}">
<span class="truncate pr-2">${f}</span>
<span class="opacity-30">${assetsData.filter(a => f === 'all' || a.folder === f).length}</span>
</button>
`).join('');
}
window.setFolder = (folder) => {
currentFolder = folder;
updateFilters();
renderAssets();
};
document.getElementById('search-bar').oninput = renderAssets;
</script>
</body>
</html>