stat2025 commited on
Commit
6a905b8
·
verified ·
1 Parent(s): 43005bd

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +45 -39
index.html CHANGED
@@ -36,7 +36,7 @@
36
  </div>
37
  <div class="step">
38
  <span class="step-number">2</span>
39
- <span class="step-text">رتّب الملفات، واحذف أي ملف لا ترغب بوجوده.</span>
40
  </div>
41
  <div class="step">
42
  <span class="step-number">3</span>
@@ -47,55 +47,57 @@
47
  <!-- الكارد الرئيسي -->
48
  <section class="card main-card">
49
 
50
- <!-- اختيار الملفات -->
51
- <div class="card-row">
52
- <h2 class="card-title">اختر الملفات المراد دمجها</h2>
53
  <p class="hint">
54
  يدعم:
55
  <strong>ملفات PDF</strong>،
56
  <strong>صور JPG / PNG</strong>،
57
  أو
58
  <strong>الدمج بينهما</strong> في ملف واحد.
59
- يتم الدمج وفق الترتيب الظاهر في القائمة، مع استخدام صفحات A4 ثابتة.
60
  </p>
61
 
62
  <label class="file-picker">
63
  <span class="file-picker-icon">📂</span>
64
- <span class="file-picker-text">اضغط هنا لاختيار الملفات من جهازك (يمكن التكرار)</span>
65
  <input id="files" type="file" multiple accept=".pdf,image/*" />
66
  </label>
67
  </div>
68
 
69
- <!-- قائمة الملفات المختارة -->
70
- <div id="fileList" class="file-list hidden"></div>
71
-
72
- <!-- اسم الملف الناتج -->
73
- <div class="card-row inline">
74
- <label for="outputName" class="card-label">اسم ملف الإخراج (اختياري)</label>
75
- <input
76
- id="outputName"
77
- type="text"
78
- class="output-input"
79
- placeholder="مثال: group-merged.pdf"
80
- />
81
  </div>
82
 
83
- <!-- الأزرار -->
84
- <div class="actions">
85
- <button id="mergeBtn" class="btn-main">دمج وإنشاء ملف PDF واحد</button>
86
- <button id="clearBtn" class="btn-secondary" type="button">مسح جميع الملفات</button>
87
- </div>
 
 
 
 
 
 
 
 
 
 
 
88
 
89
- <!-- حالة العملية -->
90
- <div id="status" class="status"></div>
91
 
92
- <!-- شريط التقدم -->
93
- <div id="progress" class="progress hidden">
94
- <div id="progressText" class="progress-text">جاري المعالجة...</div>
95
- <div class="progress-bar">
96
- <div id="progressFill" class="progress-fill"></div>
97
  </div>
98
  </div>
 
99
  </section>
100
  </main>
101
  </div>
@@ -200,9 +202,9 @@
200
  <span class="name" title="${f.name}">${f.name}</span>
201
  <span class="size">${(f.size / 1024).toFixed(1)} كيلوبايت</span>
202
  <div class="row-actions">
203
- <button class="move-btn" data-index="${i}" data-dir="up" title="نقل لأعلى"></button>
204
- <button class="move-btn" data-index="${i}" data-dir="down" title="نقل لأسفل"></button>
205
- <button class="delete-btn" data-index="${i}" title="حذف الملف">🗑️</button>
206
  </div>
207
  </li>`
208
  )
@@ -240,9 +242,11 @@
240
  if (isNaN(index)) return;
241
 
242
  if (dir === "up" && index > 0) {
243
- [selectedFiles[index - 1], selectedFiles[index]] = [selectedFiles[index], selectedFiles[index - 1]];
 
244
  } else if (dir === "down" && index < selectedFiles.length - 1) {
245
- [selectedFiles[index + 1], selectedFiles[index]] = [selectedFiles[index], selectedFiles[index + 1]];
 
246
  }
247
  renderFileList(selectedFiles);
248
  });
@@ -318,14 +322,15 @@
318
  showProgress(true);
319
  mergeBtn.disabled = true;
320
  mergeBtn.classList.add("disabled");
 
 
321
 
322
  const pdfDoc = await PDFLib.PDFDocument.create();
323
  const totalSteps = files.length;
324
  let currentStep = 0;
325
 
326
- // مقاس A4 ثابت
327
- const pageWidth = 595.28;
328
- const pageHeight = 841.89;
329
 
330
  for (const file of files) {
331
  const bytes = await file.arrayBuffer();
@@ -353,7 +358,6 @@
353
 
354
  const imgWidth = image.width;
355
  const imgHeight = image.height;
356
-
357
  const scale = Math.min(pageWidth / imgWidth, pageHeight / imgHeight);
358
  const drawWidth = imgWidth * scale;
359
  const drawHeight = imgHeight * scale;
@@ -392,6 +396,8 @@
392
  } finally {
393
  mergeBtn.disabled = false;
394
  mergeBtn.classList.remove("disabled");
 
 
395
  }
396
  });
397
  </script>
 
36
  </div>
37
  <div class="step">
38
  <span class="step-number">2</span>
39
+ <span class="step-text">رتّب الملفات أو احذف ما لا تحتاجه قبل الدمج.</span>
40
  </div>
41
  <div class="step">
42
  <span class="step-number">3</span>
 
47
  <!-- الكارد الرئيسي -->
48
  <section class="card main-card">
49
 
50
+ <!-- القسم 1: اختيار الملفات -->
51
+ <div class="card-section card-select">
52
+ <h2 class="card-title">اختيار الملفات</h2>
53
  <p class="hint">
54
  يدعم:
55
  <strong>ملفات PDF</strong>،
56
  <strong>صور JPG / PNG</strong>،
57
  أو
58
  <strong>الدمج بينهما</strong> في ملف واحد.
59
+ يتم الدمج وفق الترتيب الظاهر في القائمة، مع صفحات A4 ثابتة.
60
  </p>
61
 
62
  <label class="file-picker">
63
  <span class="file-picker-icon">📂</span>
64
+ <span class="file-picker-text">اضغط لاختيار الملفات (يمكن التكرار والإضافة لاحقًا)</span>
65
  <input id="files" type="file" multiple accept=".pdf,image/*" />
66
  </label>
67
  </div>
68
 
69
+ <!-- القسم 2: قائمة الملفات -->
70
+ <div class="card-section">
71
+ <div id="fileList" class="file-list hidden"></div>
 
 
 
 
 
 
 
 
 
72
  </div>
73
 
74
+ <!-- القسم 3: الإخراج والأزرار -->
75
+ <div class="card-section card-output">
76
+ <div class="card-row inline">
77
+ <label for="outputName" class="card-label">اسم ملف الإخراج (اختياري)</label>
78
+ <input
79
+ id="outputName"
80
+ type="text"
81
+ class="output-input"
82
+ placeholder="مثال: group-merged.pdf"
83
+ />
84
+ </div>
85
+
86
+ <div class="actions">
87
+ <button id="mergeBtn" class="btn-main">دمج وإنشاء ملف PDF واحد</button>
88
+ <button id="clearBtn" class="btn-secondary" type="button">مسح جميع الملفات</button>
89
+ </div>
90
 
91
+ <div id="status" class="status"></div>
 
92
 
93
+ <div id="progress" class="progress hidden">
94
+ <div id="progressText" class="progress-text">جاري المعالجة...</div>
95
+ <div class="progress-bar">
96
+ <div id="progressFill" class="progress-fill"></div>
97
+ </div>
98
  </div>
99
  </div>
100
+
101
  </section>
102
  </main>
103
  </div>
 
202
  <span class="name" title="${f.name}">${f.name}</span>
203
  <span class="size">${(f.size / 1024).toFixed(1)} كيلوبايت</span>
204
  <div class="row-actions">
205
+ <button class="move-btn" data-index="${i}" data-dir="up" title="نقل لأعلى"></button>
206
+ <button class="move-btn" data-index="${i}" data-dir="down" title="نقل لأسفل"></button>
207
+ <button class="delete-btn" data-index="${i}" title="حذف الملف">×</button>
208
  </div>
209
  </li>`
210
  )
 
242
  if (isNaN(index)) return;
243
 
244
  if (dir === "up" && index > 0) {
245
+ [selectedFiles[index - 1], selectedFiles[index]] =
246
+ [selectedFiles[index], selectedFiles[index - 1]];
247
  } else if (dir === "down" && index < selectedFiles.length - 1) {
248
+ [selectedFiles[index + 1], selectedFiles[index]] =
249
+ [selectedFiles[index], selectedFiles[index + 1]];
250
  }
251
  renderFileList(selectedFiles);
252
  });
 
322
  showProgress(true);
323
  mergeBtn.disabled = true;
324
  mergeBtn.classList.add("disabled");
325
+ filesInput.disabled = true;
326
+ clearBtn.disabled = true;
327
 
328
  const pdfDoc = await PDFLib.PDFDocument.create();
329
  const totalSteps = files.length;
330
  let currentStep = 0;
331
 
332
+ const pageWidth = 595.28; // A4
333
+ const pageHeight = 841.89; // A4
 
334
 
335
  for (const file of files) {
336
  const bytes = await file.arrayBuffer();
 
358
 
359
  const imgWidth = image.width;
360
  const imgHeight = image.height;
 
361
  const scale = Math.min(pageWidth / imgWidth, pageHeight / imgHeight);
362
  const drawWidth = imgWidth * scale;
363
  const drawHeight = imgHeight * scale;
 
396
  } finally {
397
  mergeBtn.disabled = false;
398
  mergeBtn.classList.remove("disabled");
399
+ filesInput.disabled = false;
400
+ clearBtn.disabled = false;
401
  }
402
  });
403
  </script>