Spaces:
Build error
Build error
Sahil commited on
Update templates/index.html
Browse files- templates/index.html +24 -37
templates/index.html
CHANGED
|
@@ -172,36 +172,30 @@
|
|
| 172 |
<input name="title" placeholder="Title" required />
|
| 173 |
<textarea name="description" placeholder="Description"></textarea>
|
| 174 |
<select name="category">
|
| 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 |
-
<option>Technology</option>
|
| 200 |
-
<option>Health & Wellness</option>
|
| 201 |
-
<option>Diversity & Innovation</option>
|
| 202 |
-
|
| 203 |
-
<!-- π§ Other -->
|
| 204 |
-
<option>Other</option> </select>
|
| 205 |
<input name="tags" placeholder="Tags (comma separated)" />
|
| 206 |
<input name="uploader" placeholder="Your name (optional)" />
|
| 207 |
<input type="file" name="file" accept="image/*,video/*" required id="uploadFile" />
|
|
@@ -238,7 +232,6 @@
|
|
| 238 |
</div>
|
| 239 |
|
| 240 |
<script>
|
| 241 |
-
// ======= Utility =======
|
| 242 |
const gallery = document.getElementById("gallery");
|
| 243 |
const q = document.getElementById("q");
|
| 244 |
const searchBtn = document.getElementById("searchBtn");
|
|
@@ -293,7 +286,6 @@
|
|
| 293 |
</div>`;
|
| 294 |
}
|
| 295 |
|
| 296 |
-
// ======= Safe Resize Function =======
|
| 297 |
async function resizeImage(file, maxWidth = 1024, maxHeight = 1024){
|
| 298 |
return new Promise((resolve)=>{
|
| 299 |
const img = new Image();
|
|
@@ -315,7 +307,6 @@
|
|
| 315 |
});
|
| 316 |
}
|
| 317 |
|
| 318 |
-
// ======= Upload Hook =======
|
| 319 |
uploadFile.addEventListener("change", async (e)=>{
|
| 320 |
const file = e.target.files[0];
|
| 321 |
if(!file) return;
|
|
@@ -327,7 +318,6 @@
|
|
| 327 |
}
|
| 328 |
});
|
| 329 |
|
| 330 |
-
// ======= Filters =======
|
| 331 |
function renderFilters(){
|
| 332 |
const chips = [];
|
| 333 |
for(const [k,v] of Object.entries(activeFilters)){
|
|
@@ -420,7 +410,6 @@
|
|
| 420 |
function closeUpload(){ uploadModal.style.display="none"; }
|
| 421 |
function closePolicy(){ policyModal.style.display="none"; }
|
| 422 |
|
| 423 |
-
// ======= Search & Filters Hooks =======
|
| 424 |
searchBtn.onclick=()=>{ activeFilters.text=q.value.trim(); resetGallery(); };
|
| 425 |
imgSearch.onchange=async (e)=>{
|
| 426 |
const f=e.target.files[0];
|
|
@@ -467,14 +456,12 @@
|
|
| 467 |
|
| 468 |
function showToast(msg){ toast.textContent=msg; toast.classList.add("show"); setTimeout(()=>toast.classList.remove("show"),2500); }
|
| 469 |
|
| 470 |
-
// ======= Infinite Scroll =======
|
| 471 |
window.addEventListener("scroll", ()=>{
|
| 472 |
if((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200){
|
| 473 |
loadGalleryBatch();
|
| 474 |
}
|
| 475 |
});
|
| 476 |
|
| 477 |
-
// ======= Initial Load =======
|
| 478 |
resetGallery();
|
| 479 |
</script>
|
| 480 |
</body>
|
|
|
|
| 172 |
<input name="title" placeholder="Title" required />
|
| 173 |
<textarea name="description" placeholder="Description"></textarea>
|
| 174 |
<select name="category">
|
| 175 |
+
<option>Fan Art</option>
|
| 176 |
+
<option>Anime</option>
|
| 177 |
+
<option>Cosplay</option>
|
| 178 |
+
<option>Sketch</option>
|
| 179 |
+
<option>3D Art</option>
|
| 180 |
+
<option>Original</option>
|
| 181 |
+
<option>Animation</option>
|
| 182 |
+
<option>Wallpaper</option>
|
| 183 |
+
<option>Portrait</option>
|
| 184 |
+
<option>Photography</option>
|
| 185 |
+
<option>Fashion</option>
|
| 186 |
+
<option>Nature</option>
|
| 187 |
+
<option>Lifestyle</option>
|
| 188 |
+
<option>Food</option>
|
| 189 |
+
<option>Travel</option>
|
| 190 |
+
<option>Meme</option>
|
| 191 |
+
<option>Video</option>
|
| 192 |
+
<option>AI</option>
|
| 193 |
+
<option>Business & Finance</option>
|
| 194 |
+
<option>Technology</option>
|
| 195 |
+
<option>Health & Wellness</option>
|
| 196 |
+
<option>Diversity & Innovation</option>
|
| 197 |
+
<option>Other</option>
|
| 198 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
<input name="tags" placeholder="Tags (comma separated)" />
|
| 200 |
<input name="uploader" placeholder="Your name (optional)" />
|
| 201 |
<input type="file" name="file" accept="image/*,video/*" required id="uploadFile" />
|
|
|
|
| 232 |
</div>
|
| 233 |
|
| 234 |
<script>
|
|
|
|
| 235 |
const gallery = document.getElementById("gallery");
|
| 236 |
const q = document.getElementById("q");
|
| 237 |
const searchBtn = document.getElementById("searchBtn");
|
|
|
|
| 286 |
</div>`;
|
| 287 |
}
|
| 288 |
|
|
|
|
| 289 |
async function resizeImage(file, maxWidth = 1024, maxHeight = 1024){
|
| 290 |
return new Promise((resolve)=>{
|
| 291 |
const img = new Image();
|
|
|
|
| 307 |
});
|
| 308 |
}
|
| 309 |
|
|
|
|
| 310 |
uploadFile.addEventListener("change", async (e)=>{
|
| 311 |
const file = e.target.files[0];
|
| 312 |
if(!file) return;
|
|
|
|
| 318 |
}
|
| 319 |
});
|
| 320 |
|
|
|
|
| 321 |
function renderFilters(){
|
| 322 |
const chips = [];
|
| 323 |
for(const [k,v] of Object.entries(activeFilters)){
|
|
|
|
| 410 |
function closeUpload(){ uploadModal.style.display="none"; }
|
| 411 |
function closePolicy(){ policyModal.style.display="none"; }
|
| 412 |
|
|
|
|
| 413 |
searchBtn.onclick=()=>{ activeFilters.text=q.value.trim(); resetGallery(); };
|
| 414 |
imgSearch.onchange=async (e)=>{
|
| 415 |
const f=e.target.files[0];
|
|
|
|
| 456 |
|
| 457 |
function showToast(msg){ toast.textContent=msg; toast.classList.add("show"); setTimeout(()=>toast.classList.remove("show"),2500); }
|
| 458 |
|
|
|
|
| 459 |
window.addEventListener("scroll", ()=>{
|
| 460 |
if((window.innerHeight + window.scrollY) >= document.body.offsetHeight - 200){
|
| 461 |
loadGalleryBatch();
|
| 462 |
}
|
| 463 |
});
|
| 464 |
|
|
|
|
| 465 |
resetGallery();
|
| 466 |
</script>
|
| 467 |
</body>
|