Add 2 files
Browse files- README.md +7 -5
- index.html +390 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: flashes
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,390 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Artistry Gallery | Your Personal Digital Art Space</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.gallery-item {
|
| 11 |
+
transition: all 0.3s ease;
|
| 12 |
+
transform: scale(1);
|
| 13 |
+
}
|
| 14 |
+
.gallery-item:hover {
|
| 15 |
+
transform: scale(1.03);
|
| 16 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
|
| 17 |
+
z-index: 10;
|
| 18 |
+
}
|
| 19 |
+
.modal-overlay {
|
| 20 |
+
background-color: rgba(0, 0, 0, 0.9);
|
| 21 |
+
}
|
| 22 |
+
.modal-content {
|
| 23 |
+
animation: fadeIn 0.3s ease-out;
|
| 24 |
+
}
|
| 25 |
+
@keyframes fadeIn {
|
| 26 |
+
from { opacity: 0; transform: scale(0.9); }
|
| 27 |
+
to { opacity: 1; transform: scale(1); }
|
| 28 |
+
}
|
| 29 |
+
.upload-area {
|
| 30 |
+
border: 2px dashed #cbd5e0;
|
| 31 |
+
transition: all 0.3s ease;
|
| 32 |
+
}
|
| 33 |
+
.upload-area:hover {
|
| 34 |
+
border-color: #667eea;
|
| 35 |
+
background-color: rgba(102, 126, 234, 0.05);
|
| 36 |
+
}
|
| 37 |
+
.upload-area.dragover {
|
| 38 |
+
border-color: #667eea;
|
| 39 |
+
background-color: rgba(102, 126, 234, 0.1);
|
| 40 |
+
}
|
| 41 |
+
.category-btn.active {
|
| 42 |
+
background-color: #667eea;
|
| 43 |
+
color: white;
|
| 44 |
+
}
|
| 45 |
+
</style>
|
| 46 |
+
</head>
|
| 47 |
+
<body class="bg-gray-50 font-sans">
|
| 48 |
+
<!-- Navigation -->
|
| 49 |
+
<nav class="bg-white shadow-lg">
|
| 50 |
+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
| 51 |
+
<div class="flex justify-between h-16">
|
| 52 |
+
<div class="flex items-center">
|
| 53 |
+
<div class="flex-shrink-0 flex items-center">
|
| 54 |
+
<i class="fas fa-palette text-indigo-600 text-2xl mr-2"></i>
|
| 55 |
+
<span class="text-xl font-bold text-gray-900">Artistry Gallery</span>
|
| 56 |
+
</div>
|
| 57 |
+
</div>
|
| 58 |
+
<div class="flex items-center">
|
| 59 |
+
<button id="uploadBtn" class="bg-indigo-600 text-white px-4 py-2 rounded-md hover:bg-indigo-700 transition flex items-center">
|
| 60 |
+
<i class="fas fa-upload mr-2"></i> Upload Art
|
| 61 |
+
</button>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
</nav>
|
| 66 |
+
|
| 67 |
+
<!-- Main Content -->
|
| 68 |
+
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
| 69 |
+
<!-- Gallery Controls -->
|
| 70 |
+
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8">
|
| 71 |
+
<h1 class="text-3xl font-bold text-gray-900 mb-4 sm:mb-0">Your Personal Art Collection</h1>
|
| 72 |
+
|
| 73 |
+
<div class="flex space-x-2 overflow-x-auto pb-2 w-full sm:w-auto">
|
| 74 |
+
<button class="category-btn active px-4 py-2 rounded-full bg-indigo-600 text-white text-sm" data-category="all">All</button>
|
| 75 |
+
<button class="category-btn px-4 py-2 rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 text-sm" data-category="painting">Paintings</button>
|
| 76 |
+
<button class="category-btn px-4 py-2 rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 text-sm" data-category="photography">Photography</button>
|
| 77 |
+
<button class="category-btn px-4 py-2 rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 text-sm" data-category="digital">Digital Art</button>
|
| 78 |
+
<button class="category-btn px-4 py-2 rounded-full bg-gray-200 text-gray-700 hover:bg-gray-300 text-sm" data-category="sketch">Sketches</button>
|
| 79 |
+
</div>
|
| 80 |
+
</div>
|
| 81 |
+
|
| 82 |
+
<!-- Gallery Grid -->
|
| 83 |
+
<div id="galleryGrid" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
| 84 |
+
<!-- Gallery items will be added here dynamically -->
|
| 85 |
+
<div class="text-center py-12 text-gray-500" id="emptyState">
|
| 86 |
+
<i class="fas fa-images text-4xl mb-4 text-gray-300"></i>
|
| 87 |
+
<p class="text-lg">Your gallery is empty</p>
|
| 88 |
+
<p class="text-sm mt-2">Upload your first artwork to get started</p>
|
| 89 |
+
</div>
|
| 90 |
+
</div>
|
| 91 |
+
</main>
|
| 92 |
+
|
| 93 |
+
<!-- Upload Modal -->
|
| 94 |
+
<div id="uploadModal" class="fixed inset-0 z-50 hidden">
|
| 95 |
+
<div class="modal-overlay absolute inset-0"></div>
|
| 96 |
+
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
| 97 |
+
<div class="modal-content inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
|
| 98 |
+
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
| 99 |
+
<div class="sm:flex sm:items-start">
|
| 100 |
+
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
|
| 101 |
+
<div class="flex justify-between items-center mb-4">
|
| 102 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900">Upload Artwork</h3>
|
| 103 |
+
<button id="closeModal" class="text-gray-400 hover:text-gray-500">
|
| 104 |
+
<i class="fas fa-times"></i>
|
| 105 |
+
</button>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="mt-2">
|
| 108 |
+
<div id="uploadArea" class="upload-area rounded-lg p-8 text-center cursor-pointer mb-4">
|
| 109 |
+
<i class="fas fa-cloud-upload-alt text-4xl text-indigo-500 mb-3"></i>
|
| 110 |
+
<p class="text-gray-600">Drag & drop your artwork here</p>
|
| 111 |
+
<p class="text-gray-400 text-sm mt-1">or click to browse files</p>
|
| 112 |
+
<input type="file" id="fileInput" class="hidden" accept="image/*" multiple>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<div class="mb-4">
|
| 116 |
+
<label for="artTitle" class="block text-sm font-medium text-gray-700 mb-1">Title</label>
|
| 117 |
+
<input type="text" id="artTitle" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<div class="mb-4">
|
| 121 |
+
<label for="artCategory" class="block text-sm font-medium text-gray-700 mb-1">Category</label>
|
| 122 |
+
<select id="artCategory" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
|
| 123 |
+
<option value="painting">Painting</option>
|
| 124 |
+
<option value="photography">Photography</option>
|
| 125 |
+
<option value="digital">Digital Art</option>
|
| 126 |
+
<option value="sketch">Sketch</option>
|
| 127 |
+
<option value="other">Other</option>
|
| 128 |
+
</select>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<div class="mb-4">
|
| 132 |
+
<label for="artDescription" class="block text-sm font-medium text-gray-700 mb-1">Description (optional)</label>
|
| 133 |
+
<textarea id="artDescription" rows="3" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500"></textarea>
|
| 134 |
+
</div>
|
| 135 |
+
</div>
|
| 136 |
+
</div>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 140 |
+
<button id="submitUpload" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm">
|
| 141 |
+
Upload Artwork
|
| 142 |
+
</button>
|
| 143 |
+
<button id="cancelUpload" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
| 144 |
+
Cancel
|
| 145 |
+
</button>
|
| 146 |
+
</div>
|
| 147 |
+
</div>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<!-- Image Viewer Modal -->
|
| 152 |
+
<div id="imageViewer" class="fixed inset-0 z-50 hidden">
|
| 153 |
+
<div class="modal-overlay absolute inset-0"></div>
|
| 154 |
+
<div class="flex items-center justify-center min-h-screen">
|
| 155 |
+
<div class="relative max-w-4xl w-full mx-4">
|
| 156 |
+
<button id="closeViewer" class="absolute top-4 right-4 text-white text-3xl z-10 hover:text-gray-300">
|
| 157 |
+
<i class="fas fa-times"></i>
|
| 158 |
+
</button>
|
| 159 |
+
<button id="prevImage" class="absolute left-4 top-1/2 transform -translate-y-1/2 text-white text-3xl z-10 hover:text-gray-300">
|
| 160 |
+
<i class="fas fa-chevron-left"></i>
|
| 161 |
+
</button>
|
| 162 |
+
<button id="nextImage" class="absolute right-4 top-1/2 transform -translate-y-1/2 text-white text-3xl z-10 hover:text-gray-300">
|
| 163 |
+
<i class="fas fa-chevron-right"></i>
|
| 164 |
+
</button>
|
| 165 |
+
|
| 166 |
+
<div class="bg-white rounded-lg overflow-hidden">
|
| 167 |
+
<img id="viewerImage" src="" alt="" class="w-full max-h-screen-80 object-contain">
|
| 168 |
+
<div class="p-4 bg-white">
|
| 169 |
+
<h3 id="viewerTitle" class="text-xl font-bold text-gray-900"></h3>
|
| 170 |
+
<div class="flex items-center mt-1 mb-2">
|
| 171 |
+
<span id="viewerCategory" class="px-2 py-1 text-xs rounded-full bg-indigo-100 text-indigo-800"></span>
|
| 172 |
+
<span class="text-gray-500 text-sm ml-auto" id="viewerDate"></span>
|
| 173 |
+
</div>
|
| 174 |
+
<p id="viewerDescription" class="text-gray-700 mt-2"></p>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
|
| 181 |
+
<script>
|
| 182 |
+
// Gallery data
|
| 183 |
+
let galleryData = JSON.parse(localStorage.getItem('artGallery')) || [];
|
| 184 |
+
let currentCategory = 'all';
|
| 185 |
+
let currentViewerIndex = 0;
|
| 186 |
+
|
| 187 |
+
// DOM Elements
|
| 188 |
+
const uploadBtn = document.getElementById('uploadBtn');
|
| 189 |
+
const uploadModal = document.getElementById('uploadModal');
|
| 190 |
+
const closeModal = document.getElementById('closeModal');
|
| 191 |
+
const cancelUpload = document.getElementById('cancelUpload');
|
| 192 |
+
const uploadArea = document.getElementById('uploadArea');
|
| 193 |
+
const fileInput = document.getElementById('fileInput');
|
| 194 |
+
const submitUpload = document.getElementById('submitUpload');
|
| 195 |
+
const galleryGrid = document.getElementById('galleryGrid');
|
| 196 |
+
const emptyState = document.getElementById('emptyState');
|
| 197 |
+
const categoryBtns = document.querySelectorAll('.category-btn');
|
| 198 |
+
const imageViewer = document.getElementById('imageViewer');
|
| 199 |
+
const closeViewer = document.getElementById('closeViewer');
|
| 200 |
+
const prevImage = document.getElementById('prevImage');
|
| 201 |
+
const nextImage = document.getElementById('nextImage');
|
| 202 |
+
const viewerImage = document.getElementById('viewerImage');
|
| 203 |
+
const viewerTitle = document.getElementById('viewerTitle');
|
| 204 |
+
const viewerCategory = document.getElementById('viewerCategory');
|
| 205 |
+
const viewerDescription = document.getElementById('viewerDescription');
|
| 206 |
+
const viewerDate = document.getElementById('viewerDate');
|
| 207 |
+
|
| 208 |
+
// Event Listeners
|
| 209 |
+
uploadBtn.addEventListener('click', () => uploadModal.classList.remove('hidden'));
|
| 210 |
+
closeModal.addEventListener('click', () => uploadModal.classList.add('hidden'));
|
| 211 |
+
cancelUpload.addEventListener('click', () => uploadModal.classList.add('hidden'));
|
| 212 |
+
closeViewer.addEventListener('click', () => imageViewer.classList.add('hidden'));
|
| 213 |
+
|
| 214 |
+
uploadArea.addEventListener('click', () => fileInput.click());
|
| 215 |
+
|
| 216 |
+
fileInput.addEventListener('change', (e) => {
|
| 217 |
+
if (e.target.files.length > 0) {
|
| 218 |
+
// You could show a preview here if needed
|
| 219 |
+
}
|
| 220 |
+
});
|
| 221 |
+
|
| 222 |
+
// Drag and drop functionality
|
| 223 |
+
uploadArea.addEventListener('dragover', (e) => {
|
| 224 |
+
e.preventDefault();
|
| 225 |
+
uploadArea.classList.add('dragover');
|
| 226 |
+
});
|
| 227 |
+
|
| 228 |
+
uploadArea.addEventListener('dragleave', () => {
|
| 229 |
+
uploadArea.classList.remove('dragover');
|
| 230 |
+
});
|
| 231 |
+
|
| 232 |
+
uploadArea.addEventListener('drop', (e) => {
|
| 233 |
+
e.preventDefault();
|
| 234 |
+
uploadArea.classList.remove('dragover');
|
| 235 |
+
fileInput.files = e.dataTransfer.files;
|
| 236 |
+
});
|
| 237 |
+
|
| 238 |
+
// Submit upload
|
| 239 |
+
submitUpload.addEventListener('click', () => {
|
| 240 |
+
const title = document.getElementById('artTitle').value.trim();
|
| 241 |
+
const category = document.getElementById('artCategory').value;
|
| 242 |
+
const description = document.getElementById('artDescription').value.trim();
|
| 243 |
+
|
| 244 |
+
if (!title) {
|
| 245 |
+
alert('Please enter a title for your artwork');
|
| 246 |
+
return;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
if (fileInput.files.length === 0) {
|
| 250 |
+
alert('Please select an image file');
|
| 251 |
+
return;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
const file = fileInput.files[0];
|
| 255 |
+
const reader = new FileReader();
|
| 256 |
+
|
| 257 |
+
reader.onload = function(e) {
|
| 258 |
+
const newArtwork = {
|
| 259 |
+
id: Date.now(),
|
| 260 |
+
title: title,
|
| 261 |
+
category: category,
|
| 262 |
+
description: description,
|
| 263 |
+
image: e.target.result,
|
| 264 |
+
date: new Date().toLocaleDateString()
|
| 265 |
+
};
|
| 266 |
+
|
| 267 |
+
galleryData.push(newArtwork);
|
| 268 |
+
saveGalleryData();
|
| 269 |
+
renderGallery();
|
| 270 |
+
uploadModal.classList.add('hidden');
|
| 271 |
+
|
| 272 |
+
// Reset form
|
| 273 |
+
document.getElementById('artTitle').value = '';
|
| 274 |
+
document.getElementById('artDescription').value = '';
|
| 275 |
+
fileInput.value = '';
|
| 276 |
+
};
|
| 277 |
+
|
| 278 |
+
reader.readAsDataURL(file);
|
| 279 |
+
});
|
| 280 |
+
|
| 281 |
+
// Category filtering
|
| 282 |
+
categoryBtns.forEach(btn => {
|
| 283 |
+
btn.addEventListener('click', () => {
|
| 284 |
+
categoryBtns.forEach(b => b.classList.remove('active'));
|
| 285 |
+
btn.classList.add('active');
|
| 286 |
+
currentCategory = btn.dataset.category;
|
| 287 |
+
renderGallery();
|
| 288 |
+
});
|
| 289 |
+
});
|
| 290 |
+
|
| 291 |
+
// Image viewer navigation
|
| 292 |
+
prevImage.addEventListener('click', () => {
|
| 293 |
+
if (currentViewerIndex > 0) {
|
| 294 |
+
currentViewerIndex--;
|
| 295 |
+
updateViewer();
|
| 296 |
+
}
|
| 297 |
+
});
|
| 298 |
+
|
| 299 |
+
nextImage.addEventListener('click', () => {
|
| 300 |
+
if (currentViewerIndex < getFilteredGallery().length - 1) {
|
| 301 |
+
currentViewerIndex++;
|
| 302 |
+
updateViewer();
|
| 303 |
+
}
|
| 304 |
+
});
|
| 305 |
+
|
| 306 |
+
// Functions
|
| 307 |
+
function saveGalleryData() {
|
| 308 |
+
localStorage.setItem('artGallery', JSON.stringify(galleryData));
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
function getFilteredGallery() {
|
| 312 |
+
if (currentCategory === 'all') return galleryData;
|
| 313 |
+
return galleryData.filter(item => item.category === currentCategory);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
function renderGallery() {
|
| 317 |
+
const filteredGallery = getFilteredGallery();
|
| 318 |
+
|
| 319 |
+
if (filteredGallery.length === 0) {
|
| 320 |
+
emptyState.classList.remove('hidden');
|
| 321 |
+
galleryGrid.innerHTML = '';
|
| 322 |
+
galleryGrid.appendChild(emptyState);
|
| 323 |
+
return;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
emptyState.classList.add('hidden');
|
| 327 |
+
galleryGrid.innerHTML = '';
|
| 328 |
+
|
| 329 |
+
filteredGallery.forEach((item, index) => {
|
| 330 |
+
const galleryItem = document.createElement('div');
|
| 331 |
+
galleryItem.className = 'gallery-item bg-white rounded-lg overflow-hidden shadow-md cursor-pointer';
|
| 332 |
+
galleryItem.dataset.index = index;
|
| 333 |
+
|
| 334 |
+
galleryItem.innerHTML = `
|
| 335 |
+
<div class="relative pb-3/4 h-48 overflow-hidden">
|
| 336 |
+
<img src="${item.image}" alt="${item.title}" class="absolute h-full w-full object-cover">
|
| 337 |
+
</div>
|
| 338 |
+
<div class="p-4">
|
| 339 |
+
<h3 class="font-medium text-gray-900 truncate">${item.title}</h3>
|
| 340 |
+
<div class="flex items-center mt-1">
|
| 341 |
+
<span class="px-2 py-1 text-xs rounded-full ${getCategoryClass(item.category)}">${formatCategory(item.category)}</span>
|
| 342 |
+
</div>
|
| 343 |
+
</div>
|
| 344 |
+
`;
|
| 345 |
+
|
| 346 |
+
galleryItem.addEventListener('click', () => {
|
| 347 |
+
currentViewerIndex = index;
|
| 348 |
+
updateViewer();
|
| 349 |
+
imageViewer.classList.remove('hidden');
|
| 350 |
+
});
|
| 351 |
+
|
| 352 |
+
galleryGrid.appendChild(galleryItem);
|
| 353 |
+
});
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
function updateViewer() {
|
| 357 |
+
const artwork = getFilteredGallery()[currentViewerIndex];
|
| 358 |
+
viewerImage.src = artwork.image;
|
| 359 |
+
viewerImage.alt = artwork.title;
|
| 360 |
+
viewerTitle.textContent = artwork.title;
|
| 361 |
+
viewerCategory.textContent = formatCategory(artwork.category);
|
| 362 |
+
viewerCategory.className = `px-2 py-1 text-xs rounded-full ${getCategoryClass(artwork.category)}`;
|
| 363 |
+
viewerDescription.textContent = artwork.description || 'No description provided';
|
| 364 |
+
viewerDate.textContent = artwork.date;
|
| 365 |
+
|
| 366 |
+
// Disable/enable navigation buttons
|
| 367 |
+
prevImage.style.display = currentViewerIndex === 0 ? 'none' : 'block';
|
| 368 |
+
nextImage.style.display = currentViewerIndex === getFilteredGallery().length - 1 ? 'none' : 'block';
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
function formatCategory(category) {
|
| 372 |
+
return category.charAt(0).toUpperCase() + category.slice(1);
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
function getCategoryClass(category) {
|
| 376 |
+
const classes = {
|
| 377 |
+
painting: 'bg-red-100 text-red-800',
|
| 378 |
+
photography: 'bg-blue-100 text-blue-800',
|
| 379 |
+
digital: 'bg-purple-100 text-purple-800',
|
| 380 |
+
sketch: 'bg-yellow-100 text-yellow-800',
|
| 381 |
+
other: 'bg-gray-100 text-gray-800'
|
| 382 |
+
};
|
| 383 |
+
return classes[category] || 'bg-gray-100 text-gray-800';
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
// Initialize
|
| 387 |
+
renderGallery();
|
| 388 |
+
</script>
|
| 389 |
+
<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=Fate17/flashes" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 390 |
+
</html>
|