Skyd3d commited on
Commit
56eb434
·
verified ·
1 Parent(s): 9e05b36

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +317 -1
index.html CHANGED
@@ -51,9 +51,16 @@
51
  height: 100%;
52
  background-color: rgba(0,0,0,0.5);
53
  z-index: 1000;
 
 
54
  }
55
  .upload-modal-content {
56
  animation: modalFadeIn 0.3s ease-out;
 
 
 
 
 
57
  }
58
  @keyframes modalFadeIn {
59
  from {
@@ -65,6 +72,12 @@
65
  transform: translateY(0);
66
  }
67
  }
 
 
 
 
 
 
68
  </style>
69
  </head>
70
  <body class="bg-gray-100 min-h-screen">
@@ -130,5 +143,308 @@
130
  </div>
131
 
132
  <!-- Items Grid -->
133
- <div class="p
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  </html>
 
51
  height: 100%;
52
  background-color: rgba(0,0,0,0.5);
53
  z-index: 1000;
54
+ justify-content: center;
55
+ align-items: center;
56
  }
57
  .upload-modal-content {
58
  animation: modalFadeIn 0.3s ease-out;
59
+ background-color: white;
60
+ padding: 2rem;
61
+ border-radius: 0.5rem;
62
+ width: 90%;
63
+ max-width: 500px;
64
  }
65
  @keyframes modalFadeIn {
66
  from {
 
72
  transform: translateY(0);
73
  }
74
  }
75
+ #itemsGrid {
76
+ display: grid;
77
+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
78
+ gap: 1rem;
79
+ padding: 1rem;
80
+ }
81
  </style>
82
  </head>
83
  <body class="bg-gray-100 min-h-screen">
 
143
  </div>
144
 
145
  <!-- Items Grid -->
146
+ <div id="itemsGrid" class="p-6">
147
+ <!-- Items will be loaded here dynamically -->
148
+ </div>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </main>
153
+
154
+ <!-- Admin Modal -->
155
+ <div id="adminModal" class="upload-modal">
156
+ <div class="upload-modal-content">
157
+ <div class="flex justify-between items-center mb-4">
158
+ <h3 class="text-xl font-bold">Admin Panel</h3>
159
+ <button id="closeAdminModal" class="text-gray-500 hover:text-gray-700">
160
+ <i class="fas fa-times"></i>
161
+ </button>
162
+ </div>
163
+
164
+ <div class="space-y-4">
165
+ <div>
166
+ <label class="block text-sm font-medium text-gray-700 mb-1">Category</label>
167
+ <select id="adminCategory" class="w-full p-2 border rounded">
168
+ <option value="faceMask">Face Mask</option>
169
+ <option value="pants">Pants</option>
170
+ <option value="hair">Hair</option>
171
+ <option value="cape">Cape</option>
172
+ <option value="backpack">Backpack</option>
173
+ </select>
174
+ </div>
175
+
176
+ <div>
177
+ <label class="block text-sm font-medium text-gray-700 mb-1">Item Name</label>
178
+ <input type="text" id="adminItemName" class="w-full p-2 border rounded" placeholder="Enter item name">
179
+ </div>
180
+
181
+ <div>
182
+ <label class="block text-sm font-medium text-gray-700 mb-1">Image URL</label>
183
+ <input type="text" id="adminImageUrl" class="w-full p-2 border rounded" placeholder="Enter image URL">
184
+ </div>
185
+
186
+ <div class="flex space-x-4">
187
+ <button id="addItemBtn" class="bg-blue-600 text-white px-4 py-2 rounded flex-1">
188
+ Add Item
189
+ </button>
190
+ <button id="removeItemBtn" class="bg-red-600 text-white px-4 py-2 rounded flex-1">
191
+ Remove Item
192
+ </button>
193
+ </div>
194
+ </div>
195
+ </div>
196
+ </div>
197
+
198
+ <script>
199
+ // Sample data for character items
200
+ const characterItems = {
201
+ faceMask: [
202
+ { id: 'mask1', name: 'Surgical Mask', imageUrl: 'https://via.placeholder.com/150?text=Surgical+Mask' },
203
+ { id: 'mask2', name: 'Gas Mask', imageUrl: 'https://via.placeholder.com/150?text=Gas+Mask' },
204
+ { id: 'mask3', name: 'Ninja Mask', imageUrl: 'https://via.placeholder.com/150?text=Ninja+Mask' },
205
+ { id: 'mask4', name: 'Bandana', imageUrl: 'https://via.placeholder.com/150?text=Bandana' }
206
+ ],
207
+ pants: [
208
+ { id: 'pants1', name: 'Jeans', imageUrl: 'https://via.placeholder.com/150?text=Jeans' },
209
+ { id: 'pants2', name: 'Cargo Pants', imageUrl: 'https://via.placeholder.com/150?text=Cargo+Pants' },
210
+ { id: 'pants3', name: 'Shorts', imageUrl: 'https://via.placeholder.com/150?text=Shorts' },
211
+ { id: 'pants4', name: 'Leather Pants', imageUrl: 'https://via.placeholder.com/150?text=Leather+Pants' }
212
+ ],
213
+ hair: [
214
+ { id: 'hair1', name: 'Short Hair', imageUrl: 'https://via.placeholder.com/150?text=Short+Hair' },
215
+ { id: 'hair2', name: 'Long Hair', imageUrl: 'https://via.placeholder.com/150?text=Long+Hair' },
216
+ { id: 'hair3', name: 'Ponytail', imageUrl: 'https://via.placeholder.com/150?text=Ponytail' },
217
+ { id: 'hair4', name: 'Mohawk', imageUrl: 'https://via.placeholder.com/150?text=Mohawk' }
218
+ ],
219
+ cape: [
220
+ { id: 'cape1', name: 'Red Cape', imageUrl: 'https://via.placeholder.com/150?text=Red+Cape' },
221
+ { id: 'cape2', name: 'Black Cape', imageUrl: 'https://via.placeholder.com/150?text=Black+Cape' },
222
+ { id: 'cape3', name: 'Royal Cape', imageUrl: 'https://via.placeholder.com/150?text=Royal+Cape' },
223
+ { id: 'cape4', name: 'Tattered Cape', imageUrl: 'https://via.placeholder.com/150?text=Tattered+Cape' }
224
+ ],
225
+ backpack: [
226
+ { id: 'backpack1', name: 'School Backpack', imageUrl: 'https://via.placeholder.com/150?text=School+Backpack' },
227
+ { id: 'backpack2', name: 'Hiking Backpack', imageUrl: 'https://via.placeholder.com/150?text=Hiking+Backpack' },
228
+ { id: 'backpack3', name: 'Military Backpack', imageUrl: 'https://via.placeholder.com/150?text=Military+Backpack' },
229
+ { id: 'backpack4', name: 'Jetpack', imageUrl: 'https://via.placeholder.com/150?text=Jetpack' }
230
+ ]
231
+ };
232
+
233
+ // Current selections
234
+ const currentSelections = {
235
+ faceMask: null,
236
+ pants: null,
237
+ hair: null,
238
+ cape: null,
239
+ backpack: null
240
+ };
241
+
242
+ // DOM elements
243
+ const categoryButtons = document.querySelectorAll('.category-btn');
244
+ const itemsGrid = document.getElementById('itemsGrid');
245
+ const adminBtn = document.getElementById('adminBtn');
246
+ const adminModal = document.getElementById('adminModal');
247
+ const closeAdminModal = document.getElementById('closeAdminModal');
248
+ const randomizeBtn = document.getElementById('randomizeBtn');
249
+ const downloadBtn = document.getElementById('downloadBtn');
250
+ const addItemBtn = document.getElementById('addItemBtn');
251
+ const removeItemBtn = document.getElementById('removeItemBtn');
252
+
253
+ // Initialize the app
254
+ function init() {
255
+ // Load first category by default
256
+ loadCategoryItems('faceMask');
257
+
258
+ // Set up event listeners
259
+ setupEventListeners();
260
+ }
261
+
262
+ // Set up all event listeners
263
+ function setupEventListeners() {
264
+ // Category buttons
265
+ categoryButtons.forEach(button => {
266
+ button.addEventListener('click', () => {
267
+ const category = button.dataset.category;
268
+ // Update active button
269
+ categoryButtons.forEach(btn => btn.classList.remove('active'));
270
+ button.classList.add('active');
271
+ // Load items for this category
272
+ loadCategoryItems(category);
273
+ });
274
+ });
275
+
276
+ // Admin button
277
+ adminBtn.addEventListener('click', () => {
278
+ adminModal.style.display = 'flex';
279
+ });
280
+
281
+ // Close admin modal
282
+ closeAdminModal.addEventListener('click', () => {
283
+ adminModal.style.display = 'none';
284
+ });
285
+
286
+ // Randomize button
287
+ randomizeBtn.addEventListener('click', randomizeCharacter);
288
+
289
+ // Download button
290
+ downloadBtn.addEventListener('click', downloadCharacter);
291
+
292
+ // Add item button
293
+ addItemBtn.addEventListener('click', addNewItem);
294
+
295
+ // Remove item button
296
+ removeItemBtn.addEventListener('click', removeItem);
297
+ }
298
+
299
+ // Load items for a specific category
300
+ function loadCategoryItems(category) {
301
+ itemsGrid.innerHTML = '';
302
+
303
+ // Add "None" option
304
+ const noneItem = document.createElement('div');
305
+ noneItem.className = `item-thumbnail bg-gray-100 rounded-lg p-4 flex flex-col items-center justify-center cursor-pointer ${!currentSelections[category] ? 'selected' : ''}`;
306
+ noneItem.innerHTML = `
307
+ <div class="w-16 h-16 bg-gray-200 rounded-full mb-2 flex items-center justify-center">
308
+ <i class="fas fa-times text-gray-500"></i>
309
+ </div>
310
+ <span class="text-sm font-medium">None</span>
311
+ `;
312
+ noneItem.addEventListener('click', () => {
313
+ // Remove selection
314
+ currentSelections[category] = null;
315
+ document.getElementById(`${category}Layer`).style.backgroundImage = '';
316
+
317
+ // Update selected state
318
+ document.querySelectorAll(`.item-thumbnail`).forEach(item => {
319
+ item.classList.remove('selected');
320
+ });
321
+ noneItem.classList.add('selected');
322
+ });
323
+ itemsGrid.appendChild(noneItem);
324
+
325
+ // Add items for this category
326
+ characterItems[category].forEach(item => {
327
+ const itemElement = document.createElement('div');
328
+ itemElement.className = `item-thumbnail bg-gray-100 rounded-lg p-4 flex flex-col items-center justify-center cursor-pointer ${currentSelections[category] === item.id ? 'selected' : ''}`;
329
+ itemElement.innerHTML = `
330
+ <img src="${item.imageUrl}" alt="${item.name}" class="w-16 h-16 object-contain mb-2">
331
+ <span class="text-sm font-medium">${item.name}</span>
332
+ `;
333
+ itemElement.addEventListener('click', () => {
334
+ // Update selection
335
+ currentSelections[category] = item.id;
336
+ document.getElementById(`${category}Layer`).style.backgroundImage = `url('${item.imageUrl}')`;
337
+
338
+ // Update selected state
339
+ document.querySelectorAll(`.item-thumbnail`).forEach(item => {
340
+ item.classList.remove('selected');
341
+ });
342
+ itemElement.classList.add('selected');
343
+ });
344
+ itemsGrid.appendChild(itemElement);
345
+ });
346
+ }
347
+
348
+ // Randomize all character items
349
+ function randomizeCharacter() {
350
+ Object.keys(characterItems).forEach(category => {
351
+ if (characterItems[category].length > 0) {
352
+ // Get random item from this category
353
+ const randomIndex = Math.floor(Math.random() * characterItems[category].length);
354
+ const randomItem = characterItems[category][randomIndex];
355
+
356
+ // Update selection
357
+ currentSelections[category] = randomItem.id;
358
+ document.getElementById(`${category}Layer`).style.backgroundImage = `url('${randomItem.imageUrl}')`;
359
+ }
360
+ });
361
+
362
+ // Reload current category to update selected states
363
+ const currentCategory = document.querySelector('.category-btn.active').dataset.category;
364
+ loadCategoryItems(currentCategory);
365
+ }
366
+
367
+ // Download character image
368
+ function downloadCharacter() {
369
+ alert('Character downloaded! (This would normally generate and download an image)');
370
+ }
371
+
372
+ // Add new item to a category
373
+ function addNewItem() {
374
+ const category = document.getElementById('adminCategory').value;
375
+ const name = document.getElementById('adminItemName').value.trim();
376
+ const imageUrl = document.getElementById('adminImageUrl').value.trim();
377
+
378
+ if (!name || !imageUrl) {
379
+ alert('Please fill in all fields');
380
+ return;
381
+ }
382
+
383
+ // Generate ID
384
+ const id = `${category}${characterItems[category].length + 1}`;
385
+
386
+ // Add to our data
387
+ characterItems[category].push({
388
+ id,
389
+ name,
390
+ imageUrl
391
+ });
392
+
393
+ // Clear form
394
+ document.getElementById('adminItemName').value = '';
395
+ document.getElementById('adminImageUrl').value = '';
396
+
397
+ // Reload items if this is the current category
398
+ const currentCategory = document.querySelector('.category-btn.active').dataset.category;
399
+ if (currentCategory === category) {
400
+ loadCategoryItems(category);
401
+ }
402
+
403
+ alert('Item added successfully!');
404
+ }
405
+
406
+ // Remove item from a category
407
+ function removeItem() {
408
+ const category = document.getElementById('adminCategory').value;
409
+ const name = document.getElementById('adminItemName').value.trim();
410
+
411
+ if (!name) {
412
+ alert('Please enter the name of the item to remove');
413
+ return;
414
+ }
415
+
416
+ // Find item index
417
+ const itemIndex = characterItems[category].findIndex(item => item.name === name);
418
+
419
+ if (itemIndex === -1) {
420
+ alert('Item not found');
421
+ return;
422
+ }
423
+
424
+ // Remove item
425
+ characterItems[category].splice(itemIndex, 1);
426
+
427
+ // Clear selection if it was this item
428
+ if (currentSelections[category] === name) {
429
+ currentSelections[category] = null;
430
+ document.getElementById(`${category}Layer`).style.backgroundImage = '';
431
+ }
432
+
433
+ // Clear form
434
+ document.getElementById('adminItemName').value = '';
435
+ document.getElementById('adminImageUrl').value = '';
436
+
437
+ // Reload items if this is the current category
438
+ const currentCategory = document.querySelector('.category-btn.active').dataset.category;
439
+ if (currentCategory === category) {
440
+ loadCategoryItems(category);
441
+ }
442
+
443
+ alert('Item removed successfully!');
444
+ }
445
+
446
+ // Initialize the app when DOM is loaded
447
+ document.addEventListener('DOMContentLoaded', init);
448
+ </script>
449
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Skyd3d/skydy" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
450
  </html>