Spaces:
Running
Running
Update index.html
Browse files- index.html +23 -10
index.html
CHANGED
|
@@ -113,6 +113,7 @@
|
|
| 113 |
display: flex; flex-direction: column; justify-content: center;
|
| 114 |
align-items: center; min-height: 280px;
|
| 115 |
}
|
|
|
|
| 116 |
#drop-zone::before {
|
| 117 |
content: ''; position: absolute; inset: -2px; border-radius: 1.5rem;
|
| 118 |
background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end)) border-box;
|
|
@@ -164,7 +165,7 @@
|
|
| 164 |
button#submit-btn:hover:not(:disabled) {
|
| 165 |
transform: translateY(-4px);
|
| 166 |
box-shadow: 0 10px 25px -5px var(--shadow-color-light);
|
| 167 |
-
background-position: right center;
|
| 168 |
}
|
| 169 |
button#submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
| 170 |
.loader-dots {
|
|
@@ -237,6 +238,7 @@
|
|
| 237 |
display: grid; grid-template-columns: repeat(2, 1fr);
|
| 238 |
gap: 0.75rem; width: 100%; height: 100%;
|
| 239 |
}
|
|
|
|
| 240 |
@keyframes popIn-spring {
|
| 241 |
0% { opacity: 0; transform: scale(0.8) translateY(20px); }
|
| 242 |
80% { opacity: 1; transform: scale(1.05) translateY(-5px); }
|
|
@@ -254,22 +256,25 @@
|
|
| 254 |
|
| 255 |
#error-message { color: #ef4444; text-align: center; margin-top: 1rem; display: none; font-weight: 500; }
|
| 256 |
|
|
|
|
| 257 |
#lightbox {
|
| 258 |
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
| 259 |
background-color: rgba(10, 20, 40, 0.85); z-index: 1000; display: none;
|
| 260 |
justify-content: center; align-items: center; padding: 2rem;
|
| 261 |
box-sizing: border-box; backdrop-filter: blur(8px);
|
| 262 |
}
|
| 263 |
-
#lightbox-img { max-width: 90vw; max-height:
|
|
|
|
| 264 |
#lightbox-close, #lightbox-download {
|
| 265 |
position: absolute; top: -50px; background-color: rgba(255, 255, 255, 0.1);
|
| 266 |
color: white; border: 1px solid rgba(255,255,255,0.2); width: 40px; height: 40px; border-radius: 50%;
|
| 267 |
cursor: pointer; font-size: 1.5rem; display: flex; justify-content: center; align-items: center; transition: all 0.2s;
|
| 268 |
}
|
| 269 |
-
#lightbox-close {
|
| 270 |
#lightbox-download { right: 10px; }
|
| 271 |
#lightbox-close:hover, #lightbox-download:hover { background-color: rgba(255, 255, 255, 0.2); transform: scale(1.1); }
|
| 272 |
|
|
|
|
| 273 |
@media (max-width: 600px) {
|
| 274 |
body { padding: 1.5rem 1rem; }
|
| 275 |
main { padding: 1.5rem; }
|
|
@@ -288,12 +293,14 @@
|
|
| 288 |
<main>
|
| 289 |
<div class="panel">
|
| 290 |
<h2>
|
| 291 |
-
|
|
|
|
| 292 |
۱. تصویر خود را انتخاب کنید
|
| 293 |
</h2>
|
| 294 |
<div id="drop-zone">
|
| 295 |
<div id="drop-zone-content">
|
| 296 |
-
|
|
|
|
| 297 |
<span id="drop-zone-text">تصویر را اینجا بکشید یا برای انتخاب کلیک کنید</span>
|
| 298 |
</div>
|
| 299 |
<img id="image-preview" src="#" alt="پیشنمایش تصویر" />
|
|
@@ -303,7 +310,8 @@
|
|
| 303 |
|
| 304 |
<div class="controls">
|
| 305 |
<h2>
|
| 306 |
-
|
|
|
|
| 307 |
۲. دستور ویرایش را بنویسید
|
| 308 |
</h2>
|
| 309 |
<textarea id="prompt-input" rows="3" placeholder="مثال: پسزمینه را حذف کن و یک ساحل آفتابی قرار بده"></textarea>
|
|
@@ -315,7 +323,8 @@
|
|
| 315 |
|
| 316 |
<div class="panel">
|
| 317 |
<h2>
|
| 318 |
-
|
|
|
|
| 319 |
۳. نتیجه را ببینید
|
| 320 |
</h2>
|
| 321 |
<div id="result-container">
|
|
@@ -342,7 +351,10 @@
|
|
| 342 |
<div id="lightbox">
|
| 343 |
<div id="lightbox-content">
|
| 344 |
<img id="lightbox-img" src="">
|
| 345 |
-
|
|
|
|
|
|
|
|
|
|
| 346 |
<a id="lightbox-download" href="#" download="edited-image.png" title="دانلود تصویر">
|
| 347 |
<svg fill="white" width="20px" height="20px" viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>
|
| 348 |
</a>
|
|
@@ -350,7 +362,7 @@
|
|
| 350 |
</div>
|
| 351 |
|
| 352 |
<script>
|
| 353 |
-
// The JavaScript logic remains unchanged
|
| 354 |
const API_URL = 'https://alfa-editor-worker.onrender.com/api/edit';
|
| 355 |
const dropZone = document.getElementById('drop-zone');
|
| 356 |
const dropZoneContent = document.getElementById('drop-zone-content');
|
|
@@ -420,7 +432,7 @@
|
|
| 420 |
|
| 421 |
function setLoading(isLoading) {
|
| 422 |
if (isLoading) {
|
| 423 |
-
resultContainer.classList.add('loading');
|
| 424 |
btnText.classList.add('hidden');
|
| 425 |
const loader = document.createElement('div');
|
| 426 |
loader.className = 'loader-dots';
|
|
@@ -444,6 +456,7 @@
|
|
| 444 |
const img = document.createElement('img');
|
| 445 |
img.src = url;
|
| 446 |
img.alt = 'تصویر ویرایش شده';
|
|
|
|
| 447 |
img.style.animationDelay = `${index * 120}ms`;
|
| 448 |
img.addEventListener('click', () => openLightbox(url));
|
| 449 |
resultGrid.appendChild(img);
|
|
|
|
| 113 |
display: flex; flex-direction: column; justify-content: center;
|
| 114 |
align-items: center; min-height: 280px;
|
| 115 |
}
|
| 116 |
+
/* --- NEW: Cool gradient border on hover --- */
|
| 117 |
#drop-zone::before {
|
| 118 |
content: ''; position: absolute; inset: -2px; border-radius: 1.5rem;
|
| 119 |
background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end)) border-box;
|
|
|
|
| 165 |
button#submit-btn:hover:not(:disabled) {
|
| 166 |
transform: translateY(-4px);
|
| 167 |
box-shadow: 0 10px 25px -5px var(--shadow-color-light);
|
| 168 |
+
background-position: right center; /* --- NEW: Gradient slide effect --- */
|
| 169 |
}
|
| 170 |
button#submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
|
| 171 |
.loader-dots {
|
|
|
|
| 238 |
display: grid; grid-template-columns: repeat(2, 1fr);
|
| 239 |
gap: 0.75rem; width: 100%; height: 100%;
|
| 240 |
}
|
| 241 |
+
/* --- NEW: Satisfying pop-in animation for results --- */
|
| 242 |
@keyframes popIn-spring {
|
| 243 |
0% { opacity: 0; transform: scale(0.8) translateY(20px); }
|
| 244 |
80% { opacity: 1; transform: scale(1.05) translateY(-5px); }
|
|
|
|
| 256 |
|
| 257 |
#error-message { color: #ef4444; text-align: center; margin-top: 1rem; display: none; font-weight: 500; }
|
| 258 |
|
| 259 |
+
/* --- NEW: Improved Lightbox styles --- */
|
| 260 |
#lightbox {
|
| 261 |
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
| 262 |
background-color: rgba(10, 20, 40, 0.85); z-index: 1000; display: none;
|
| 263 |
justify-content: center; align-items: center; padding: 2rem;
|
| 264 |
box-sizing: border-box; backdrop-filter: blur(8px);
|
| 265 |
}
|
| 266 |
+
#lightbox-img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 1rem; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
|
| 267 |
+
#lightbox-content { position: relative; }
|
| 268 |
#lightbox-close, #lightbox-download {
|
| 269 |
position: absolute; top: -50px; background-color: rgba(255, 255, 255, 0.1);
|
| 270 |
color: white; border: 1px solid rgba(255,255,255,0.2); width: 40px; height: 40px; border-radius: 50%;
|
| 271 |
cursor: pointer; font-size: 1.5rem; display: flex; justify-content: center; align-items: center; transition: all 0.2s;
|
| 272 |
}
|
| 273 |
+
#lightbox-close { right: 60px; /* Positioned to the right of download */ }
|
| 274 |
#lightbox-download { right: 10px; }
|
| 275 |
#lightbox-close:hover, #lightbox-download:hover { background-color: rgba(255, 255, 255, 0.2); transform: scale(1.1); }
|
| 276 |
|
| 277 |
+
|
| 278 |
@media (max-width: 600px) {
|
| 279 |
body { padding: 1.5rem 1rem; }
|
| 280 |
main { padding: 1.5rem; }
|
|
|
|
| 293 |
<main>
|
| 294 |
<div class="panel">
|
| 295 |
<h2>
|
| 296 |
+
<!-- NEW SVG ICON -->
|
| 297 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.12 5.57a2.25 2.25 0 0 0-2.24-2.24l-1.13.3a2.25 2.25 0 0 1-2.61-2.61l.3-1.13a2.25 2.25 0 0 0-2.24-2.24l-.3 1.13a2.25 2.25 0 0 1-2.61-2.61l1.13-.3A2.25 2.25 0 0 0 8.43.37l-1.13.3a2.25 2.25 0 0 1-2.61-2.61l.3-1.13A2.25 2.25 0 0 0 .37 2.88l.3 1.13a2.25 2.25 0 0 1 2.61 2.61l-1.13.3a2.25 2.25 0 0 0 2.24 2.24l1.13-.3a2.25 2.25 0 0 1 2.61 2.61l-.3 1.13a2.25 2.25 0 0 0 2.24 2.24l.3-1.13a2.25 2.25 0 0 1 2.61 2.61l-1.13.3a2.25 2.25 0 0 0 2.24 2.24l1.13-.3a2.25 2.25 0 0 1 2.61 2.61l-.3 1.13a2.25 2.25 0 0 0 2.24 2.24l.3-1.13a2.25 2.25 0 0 1 2.61-2.61l-1.13-.3a2.25 2.25 0 0 0-2.24-2.24Z"/><path d="m12 12.5 2.5 2.5"/><path d="M12 12.5 9.5 9.5"/><circle cx="12" cy="12" r="5"/><path d="M2.88 15.57a2.25 2.25 0 0 0 2.24 2.24l.3-1.13a2.25 2.25 0 0 1 2.61-2.61l-1.13-.3A2.25 2.25 0 0 0 4.58 12l-1.13.3a2.25 2.25 0 0 1-2.61 2.61Z"/></svg>
|
| 298 |
۱. تصویر خود را انتخاب کنید
|
| 299 |
</h2>
|
| 300 |
<div id="drop-zone">
|
| 301 |
<div id="drop-zone-content">
|
| 302 |
+
<!-- NEW SVG ICON -->
|
| 303 |
+
<svg id="drop-zone-icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4Z"/></svg>
|
| 304 |
<span id="drop-zone-text">تصویر را اینجا بکشید یا برای انتخاب کلیک کنید</span>
|
| 305 |
</div>
|
| 306 |
<img id="image-preview" src="#" alt="پیشنمایش تصویر" />
|
|
|
|
| 310 |
|
| 311 |
<div class="controls">
|
| 312 |
<h2>
|
| 313 |
+
<!-- NEW SVG ICON -->
|
| 314 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v10"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10.4 12.6a2 2 0 1 1 3 3L8 21l-4 1 1-4Z"/></svg>
|
| 315 |
۲. دستور ویرایش را بنویسید
|
| 316 |
</h2>
|
| 317 |
<textarea id="prompt-input" rows="3" placeholder="مثال: پسزمینه را حذف کن و یک ساحل آفتابی قرار بده"></textarea>
|
|
|
|
| 323 |
|
| 324 |
<div class="panel">
|
| 325 |
<h2>
|
| 326 |
+
<!-- NEW SVG ICON -->
|
| 327 |
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.9 5.8-5.9 1.2 4.4 4.3-1 6.1L12 17l5.4 3.5-1-6.1 4.4-4.3-5.9-1.2L12 3z"/><path d="M22 19l-1.9 2.8-2.9.2 2.1 2.3-1 3.1L22 25l2.4 1.5-1-3.1 2.1-2.3-2.9-.2L22 19z"/><path d="M5 3 3.1 5.8 0 7l2.1 2.3-1 3.1L5 11l2.4 1.5-1-3.1L8.5 7 5.6 5.8 5 3z"/></svg>
|
| 328 |
۳. نتیجه را ببینید
|
| 329 |
</h2>
|
| 330 |
<div id="result-container">
|
|
|
|
| 351 |
<div id="lightbox">
|
| 352 |
<div id="lightbox-content">
|
| 353 |
<img id="lightbox-img" src="">
|
| 354 |
+
<!-- NEW Buttons -->
|
| 355 |
+
<button id="lightbox-close" title="بستن">
|
| 356 |
+
<svg fill="white" width="20px" height="20px" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
|
| 357 |
+
</button>
|
| 358 |
<a id="lightbox-download" href="#" download="edited-image.png" title="دانلود تصویر">
|
| 359 |
<svg fill="white" width="20px" height="20px" viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>
|
| 360 |
</a>
|
|
|
|
| 362 |
</div>
|
| 363 |
|
| 364 |
<script>
|
| 365 |
+
// The JavaScript logic remains unchanged, but now it powers a much more dynamic UI!
|
| 366 |
const API_URL = 'https://alfa-editor-worker.onrender.com/api/edit';
|
| 367 |
const dropZone = document.getElementById('drop-zone');
|
| 368 |
const dropZoneContent = document.getElementById('drop-zone-content');
|
|
|
|
| 432 |
|
| 433 |
function setLoading(isLoading) {
|
| 434 |
if (isLoading) {
|
| 435 |
+
resultContainer.classList.add('loading'); // This now triggers the creative loader
|
| 436 |
btnText.classList.add('hidden');
|
| 437 |
const loader = document.createElement('div');
|
| 438 |
loader.className = 'loader-dots';
|
|
|
|
| 456 |
const img = document.createElement('img');
|
| 457 |
img.src = url;
|
| 458 |
img.alt = 'تصویر ویرایش شده';
|
| 459 |
+
// NEW: Add staggered animation delay
|
| 460 |
img.style.animationDelay = `${index * 120}ms`;
|
| 461 |
img.addEventListener('click', () => openLightbox(url));
|
| 462 |
resultGrid.appendChild(img);
|