Skydata001 commited on
Commit
c9fa4a0
·
verified ·
1 Parent(s): ef45822

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +47 -115
index.html CHANGED
@@ -20,7 +20,7 @@
20
  --text-muted: #aaa;
21
  --border-color: #333;
22
  --error-color: #EF665B;
23
- --success-color: #28a745;
24
  }
25
  * {
26
  box-sizing: border-box;
@@ -66,45 +66,7 @@
66
  50% { background-position: 100% 50%; }
67
  100% { background-position: 0% 50%; }
68
  }
69
- header {
70
- display: flex; justify-content: space-between; align-items: center;
71
- padding: 15px 20px;
72
- background-color: rgba(26, 26, 46, 0.7);
73
- backdrop-filter: blur(10px);
74
- border-bottom: 1px solid var(--border-color);
75
- box-shadow: 0 2px 10px rgba(0,0,0,0.3);
76
- width: 100%;
77
- position: sticky;
78
- top: 0;
79
- z-index: 100;
80
- }
81
- .logo-container { display: flex; align-items: center; }
82
- .logo-container img { height: 35px; margin-left: 10px; }
83
- .logo-shine {
84
- position: relative;
85
- overflow: hidden;
86
- }
87
- .logo-shine::after {
88
- content: '';
89
- position: absolute;
90
- top: 0;
91
- left: -100%;
92
- width: 50%;
93
- height: 100%;
94
- background: linear-gradient(
95
- 90deg,
96
- transparent,
97
- rgba(255, 255, 255, 0.3),
98
- transparent
99
- );
100
- transform: skewX(-25deg);
101
- animation: shine-effect 5s infinite linear;
102
- }
103
- @keyframes shine-effect {
104
- 0% { left: -100%; }
105
- 50% { left: 150%; }
106
- 100% { left: 150%; }
107
- }
108
  main {
109
  flex-grow: 1;
110
  display: flex;
@@ -119,7 +81,7 @@
119
  .form {
120
  display: flex;
121
  flex-direction: column;
122
- gap: 15px; /* (تم تعديل المسافة) */
123
  padding: 30px;
124
  border-radius: 10px;
125
  position: relative;
@@ -172,7 +134,8 @@
172
  display: flex;
173
  align-items: center;
174
  justify-content: center;
175
- text-align: center; /* (للعنصر label) */
 
176
  }
177
  .submit i { margin-left: 10px; }
178
  [dir="rtl"] .submit i { margin-left: 0; margin-right: 10px; }
@@ -182,6 +145,14 @@
182
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
183
  }
184
  .submit:disabled { background: #555; cursor: not-allowed; box-shadow: none; }
 
 
 
 
 
 
 
 
185
  .cancel-button {
186
  display: block;
187
  width: 100%;
@@ -198,7 +169,7 @@
198
  margin-top: 10px;
199
  transition: all 0.3s ease;
200
  text-align: center;
201
- display: flex; /* (لإضافة الأيقونة) */
202
  align-items: center;
203
  justify-content: center;
204
  }
@@ -217,14 +188,14 @@
217
  height: 20px;
218
  animation: spin 1s linear infinite;
219
  display: none;
220
- margin: 15px auto 0; /* (توسيط) */
221
  }
222
  #result-area {
223
  display:none;
224
  margin-top: 25px;
225
  border-top: 1px solid var(--border-color);
226
  padding-top: 25px;
227
- text-align: center; /* (توسيط النتيجة) */
228
  }
229
  #result-img {
230
  max-width: 100%;
@@ -287,7 +258,7 @@
287
  font-size: 14px;
288
  width: 100%;
289
  line-height: 1.4;
290
- direction: rtl; /* (ضمان الاتجاه داخل الـ Toast) */
291
  }
292
  .toast-close-btn {
293
  background: none;
@@ -306,52 +277,15 @@
306
  }
307
  #global-toast.success .toast-close-btn { color: #155724; }
308
  #global-toast.error .toast-close-btn { color: #71192F; }
309
- footer {
310
- background-color: rgba(26, 26, 46, 0.7);
311
- backdrop-filter: blur(10px);
312
- color: #fff;
313
- padding: 30px 20px;
314
- text-align: center;
315
- margin-top: auto;
316
- border-top: 1px solid var(--border-color);
317
- width: 100%;
318
- }
319
- .footer-links-card {
320
- margin: 0 auto;
321
- border: 1px solid var(--border-color);
322
- background: rgba(0,0,0,0.2);
323
- padding: 20px;
324
- border-radius: 12px;
325
- max-width: 400px;
326
- box-shadow: 0 0 20px rgba(0,0,0,0.3);
327
- }
328
- .footer-links-card a {
329
- color: var(--text-muted);
330
- text-decoration: none;
331
- font-size: 1.1em;
332
- transition: color 0.2s ease;
333
- display: block;
334
- margin: 10px 0;
335
- }
336
- .footer-links-card a:hover {
337
- color: var(--primary-color);
338
- }
339
- @media (max-width: 380px) {
340
- .logo-container img { height: 30px; }
341
- }
342
  </style>
343
  </head>
344
  <body>
345
 
346
  <div id="app-container">
347
 
348
- <header>
349
- <div class="logo-container">
350
- <img src="https://i.ibb.co/hJ2nq38z/clouddata.webp" alt="شعار CloudData" class="logo-shine">
351
- <img src="https://i.ibb.co/v9zLrFg/skydata.webp" alt="شعار Skydata" class="logo-shine">
352
- </div>
353
- </header>
354
-
355
  <main>
356
  <div class="main-wrapper" id="loginWrapper">
357
 
@@ -378,21 +312,18 @@
378
  <div class="loader-spinner" id="loadingSpinner"></div>
379
 
380
  <div id="result-area">
381
- <h3 style="color: var(--text-color);">النتيجة (اضغط مطولاً للحفظ):</h3>
382
  <img id="result-img" alt="الصورة بعد إزالة الخلفية">
 
 
 
 
383
  </div>
384
  </div>
385
 
386
  </div>
387
  </main>
388
 
389
- <footer>
390
- <div class="footer-links-card">
391
- <a href="Safety.html">شروط الاستخدام وسياسة الخصوصية</a>
392
- <a href="aboutus.html">عن Skydata</a>
393
- </div>
394
- </footer>
395
-
396
  <div id="global-toast">
397
  <svg class="toast-icon" viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
398
  <path d="m13 13h-2v-6h2zm0 4h-2v-2h2zm-1-15c-1.3132 0-2.61358.25866-3.82683.7612-1.21326.50255-2.31565 1.23915-3.24424 2.16773-1.87536 1.87537-2.92893 4.41891-2.92893 7.07107 0 2.6522 1.05357 5.1957 2.92893 7.0711.92859.9286 2.03098 1.6651 3.24424 2.1677 1.21325.5025 2.51363.7612 3.82683.7612 2.6522 0 5.1957-1.0536 7.0711-2.9289 1.8753-1.8754 2.9289-4.4189 2.9289-7.0711 0-1.3132-.2587-2.61358-.7612-3.82683-.5026-1.21326-1.2391-2.31565-2.1677-3.24424-.9286-.92858-2.031-1.66518-3.2443-2.16773-1.2132-.50254-2.5136-.7612-3.8268-.7612z"></path>
@@ -406,10 +337,11 @@
406
  // --- عناصر الواجهة ---
407
  const fileInput = document.getElementById('file-input');
408
  const submitBtn = document.getElementById('submit-btn');
409
- const uploadLabel = document.getElementById('upload-label'); // (الزر الأخضر)
410
  const loadingSpinner = document.getElementById('loadingSpinner');
411
  const resultArea = document.getElementById('result-area');
412
  const resultImg = document.getElementById('result-img');
 
413
 
414
  // --- عناصر الإشعارات (Toast) ---
415
  const globalToast = document.getElementById('global-toast');
@@ -417,7 +349,7 @@
417
  const toastCloseBtn = document.getElementById('toast-close-btn');
418
  let toastTimer;
419
 
420
- // --- دالة إظهار الإشعارات (من login.html) ---
421
  function showToast(message, type = 'success', duration = 5000) {
422
  if (toastTimer) clearTimeout(toastTimer);
423
 
@@ -440,30 +372,27 @@
440
  });
441
 
442
 
443
- // --- معالج حدث اختيار الملف (مع التحقق من الحجم) ---
444
  fileInput.addEventListener('change', () => {
445
- // إخفاء الـ Toast القديم إذا كان موجوداً
446
  globalToast.classList.remove('show');
447
 
448
  if (fileInput.files.length > 0) {
449
  const file = fileInput.files[0];
450
  const MAX_SIZE = 10 * 1024 * 1024; // 10 MB
451
 
452
- // *************************************
453
- // * 9. التحقق من الحد الأقصى للحجم (10 ميغا)
454
- // *************************************
455
  if (file.size > MAX_SIZE) {
456
- showToast('حجم الملف كبير جداً. الحد الأقصى 10 ميجابايت.', 'error', 0); // (0 = يبقى ولا يختفي)
457
- fileInput.value = ''; // (إلغاء اختيار الملف)
458
  submitBtn.style.display = 'none';
459
  resultArea.style.display = 'none';
460
- return; // (إنهاء الدالة)
 
461
  }
462
 
463
- // إذا كان الحجم مقبولاً
464
- showToast(`تم اختيار: ${file.name}`, 'success', 3000); // (إشعار نجاح)
465
- submitBtn.style.display = 'block';
466
  resultArea.style.display = 'none';
 
467
  }
468
  });
469
 
@@ -471,20 +400,19 @@
471
  submitBtn.addEventListener('click', async () => {
472
  if (fileInput.files.length === 0) return;
473
 
474
- // إخفاء الـ Toast القديم
475
  globalToast.classList.remove('show');
476
 
477
- // استخدام مؤشر التحميل بدلاً من النص
478
  loadingSpinner.style.display = 'block';
479
  submitBtn.disabled = true;
480
- uploadLabel.style.pointerEvents = 'none'; // (منع الضغط على زر الاختيار)
481
  uploadLabel.style.opacity = '0.7';
 
482
 
483
  const formData = new FormData();
484
- formData.append('file', fileInput.files[0]);
 
485
 
486
  try {
487
- // إرسال الصورة إلى /remove-bg في app.py
488
  const response = await fetch('/remove-bg', {
489
  method: 'POST',
490
  body: formData
@@ -492,19 +420,23 @@
492
 
493
  if (!response.ok) throw new Error('فشل المعالجة');
494
 
495
- // استقبال الصورة النظيفة
496
  const imageBlob = await response.blob();
497
  const imageUrl = URL.createObjectURL(imageBlob);
498
 
499
  resultImg.src = imageUrl;
500
  resultArea.style.display = 'block';
 
 
 
 
 
 
501
  showToast('اكتملت المعالجة بنجاح!', 'success', 4000);
502
 
503
  } catch (error) {
504
- // استخدام الـ Toast لعرض الخطأ
505
  showToast('⚠️ حدث خطأ. حاول بصورة أخرى أو تأكد من اتصالك.', 'error', 0);
 
506
  } finally {
507
- // إخفاء مؤشر التحميل وإعادة تفعيل الأزرار
508
  loadingSpinner.style.display = 'none';
509
  submitBtn.disabled = false;
510
  uploadLabel.style.pointerEvents = 'auto';
 
20
  --text-muted: #aaa;
21
  --border-color: #333;
22
  --error-color: #EF665B;
23
+ --success-color: #28a745;
24
  }
25
  * {
26
  box-sizing: border-box;
 
66
  50% { background-position: 100% 50%; }
67
  100% { background-position: 0% 50%; }
68
  }
69
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  main {
71
  flex-grow: 1;
72
  display: flex;
 
81
  .form {
82
  display: flex;
83
  flex-direction: column;
84
+ gap: 15px;
85
  padding: 30px;
86
  border-radius: 10px;
87
  position: relative;
 
134
  display: flex;
135
  align-items: center;
136
  justify-content: center;
137
+ text-align: center;
138
+ text-decoration: none;
139
  }
140
  .submit i { margin-left: 10px; }
141
  [dir="rtl"] .submit i { margin-left: 0; margin-right: 10px; }
 
145
  box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
146
  }
147
  .submit:disabled { background: #555; cursor: not-allowed; box-shadow: none; }
148
+
149
+ #download-btn {
150
+ background-color: var(--success-color);
151
+ }
152
+ #download-btn:hover {
153
+ background-color: #218838;
154
+ }
155
+
156
  .cancel-button {
157
  display: block;
158
  width: 100%;
 
169
  margin-top: 10px;
170
  transition: all 0.3s ease;
171
  text-align: center;
172
+ display: flex;
173
  align-items: center;
174
  justify-content: center;
175
  }
 
188
  height: 20px;
189
  animation: spin 1s linear infinite;
190
  display: none;
191
+ margin: 15px auto 0;
192
  }
193
  #result-area {
194
  display:none;
195
  margin-top: 25px;
196
  border-top: 1px solid var(--border-color);
197
  padding-top: 25px;
198
+ text-align: center;
199
  }
200
  #result-img {
201
  max-width: 100%;
 
258
  font-size: 14px;
259
  width: 100%;
260
  line-height: 1.4;
261
+ direction: rtl;
262
  }
263
  .toast-close-btn {
264
  background: none;
 
277
  }
278
  #global-toast.success .toast-close-btn { color: #155724; }
279
  #global-toast.error .toast-close-btn { color: #71192F; }
280
+
281
+ /* (تم حذف media query الخاص بـ logo-container) */
282
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  </style>
284
  </head>
285
  <body>
286
 
287
  <div id="app-container">
288
 
 
 
 
 
 
 
 
289
  <main>
290
  <div class="main-wrapper" id="loginWrapper">
291
 
 
312
  <div class="loader-spinner" id="loadingSpinner"></div>
313
 
314
  <div id="result-area">
315
+ <h3 style="color: var(--text-color);">النتيجة:</h3>
316
  <img id="result-img" alt="الصورة بعد إزالة الخلفية">
317
+
318
+ <a href="#" id="download-btn" class="submit" style="display: none; margin-top: 15px;">
319
+ <i class="fas fa-download"></i> تحميل الصورة
320
+ </a>
321
  </div>
322
  </div>
323
 
324
  </div>
325
  </main>
326
 
 
 
 
 
 
 
 
327
  <div id="global-toast">
328
  <svg class="toast-icon" viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
329
  <path d="m13 13h-2v-6h2zm0 4h-2v-2h2zm-1-15c-1.3132 0-2.61358.25866-3.82683.7612-1.21326.50255-2.31565 1.23915-3.24424 2.16773-1.87536 1.87537-2.92893 4.41891-2.92893 7.07107 0 2.6522 1.05357 5.1957 2.92893 7.0711.92859.9286 2.03098 1.6651 3.24424 2.1677 1.21325.5025 2.51363.7612 3.82683.7612 2.6522 0 5.1957-1.0536 7.0711-2.9289 1.8753-1.8754 2.9289-4.4189 2.9289-7.0711 0-1.3132-.2587-2.61358-.7612-3.82683-.5026-1.21326-1.2391-2.31565-2.1677-3.24424-.9286-.92858-2.031-1.66518-3.2443-2.16773-1.2132-.50254-2.5136-.7612-3.8268-.7612z"></path>
 
337
  // --- عناصر الواجهة ---
338
  const fileInput = document.getElementById('file-input');
339
  const submitBtn = document.getElementById('submit-btn');
340
+ const uploadLabel = document.getElementById('upload-label');
341
  const loadingSpinner = document.getElementById('loadingSpinner');
342
  const resultArea = document.getElementById('result-area');
343
  const resultImg = document.getElementById('result-img');
344
+ const downloadBtn = document.getElementById('download-btn');
345
 
346
  // --- عناصر الإشعارات (Toast) ---
347
  const globalToast = document.getElementById('global-toast');
 
349
  const toastCloseBtn = document.getElementById('toast-close-btn');
350
  let toastTimer;
351
 
352
+ // --- دالة إظهار الإشعارات ---
353
  function showToast(message, type = 'success', duration = 5000) {
354
  if (toastTimer) clearTimeout(toastTimer);
355
 
 
372
  });
373
 
374
 
375
+ // --- معالج حدث اختيار الملف ---
376
  fileInput.addEventListener('change', () => {
 
377
  globalToast.classList.remove('show');
378
 
379
  if (fileInput.files.length > 0) {
380
  const file = fileInput.files[0];
381
  const MAX_SIZE = 10 * 1024 * 1024; // 10 MB
382
 
 
 
 
383
  if (file.size > MAX_SIZE) {
384
+ showToast('حجم الملف كبير جداً. الحد الأقصى 10 ميجابايت.', 'error', 0);
385
+ fileInput.value = '';
386
  submitBtn.style.display = 'none';
387
  resultArea.style.display = 'none';
388
+ downloadBtn.style.display = 'none';
389
+ return;
390
  }
391
 
392
+ showToast(`تم اختيار: ${file.name}`, 'success', 3000);
393
+ submitBtn.style.display = 'flex';
 
394
  resultArea.style.display = 'none';
395
+ downloadBtn.style.display = 'none';
396
  }
397
  });
398
 
 
400
  submitBtn.addEventListener('click', async () => {
401
  if (fileInput.files.length === 0) return;
402
 
 
403
  globalToast.classList.remove('show');
404
 
 
405
  loadingSpinner.style.display = 'block';
406
  submitBtn.disabled = true;
407
+ uploadLabel.style.pointerEvents = 'none';
408
  uploadLabel.style.opacity = '0.7';
409
+ downloadBtn.style.display = 'none';
410
 
411
  const formData = new FormData();
412
+ const file = fileInput.files[0];
413
+ formData.append('file', file);
414
 
415
  try {
 
416
  const response = await fetch('/remove-bg', {
417
  method: 'POST',
418
  body: formData
 
420
 
421
  if (!response.ok) throw new Error('فشل المعالجة');
422
 
 
423
  const imageBlob = await response.blob();
424
  const imageUrl = URL.createObjectURL(imageBlob);
425
 
426
  resultImg.src = imageUrl;
427
  resultArea.style.display = 'block';
428
+
429
+ const originalFilename = file.name.split('.').slice(0, -1).join('.');
430
+ downloadBtn.download = `${originalFilename}-no-bg.png`;
431
+ downloadBtn.href = imageUrl;
432
+ downloadBtn.style.display = 'flex';
433
+
434
  showToast('اكتملت المعالجة بنجاح!', 'success', 4000);
435
 
436
  } catch (error) {
 
437
  showToast('⚠️ حدث خطأ. حاول بصورة أخرى أو تأكد من اتصالك.', 'error', 0);
438
+ downloadBtn.style.display = 'none';
439
  } finally {
 
440
  loadingSpinner.style.display = 'none';
441
  submitBtn.disabled = false;
442
  uploadLabel.style.pointerEvents = 'auto';