Update index.html
Browse files- index.html +53 -55
index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
-
<title>أداة دمج ملفات المجموعة | PDF</title>
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
<script src="https://unpkg.com/pdf-lib@1.17.1/dist/pdf-lib.min.js"></script>
|
|
@@ -10,91 +10,93 @@
|
|
| 10 |
<body>
|
| 11 |
<div class="page">
|
| 12 |
|
| 13 |
-
<!-- ال
|
| 14 |
<header class="topbar">
|
| 15 |
-
<div class="
|
| 16 |
-
<div class="logo-
|
| 17 |
<div class="brand-text">
|
| 18 |
<div class="brand-title">أداة دمج ملفات المجموعة</div>
|
| 19 |
-
<div class="brand-sub">
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
-
<
|
| 23 |
-
<span class="
|
| 24 |
-
|
| 25 |
-
</nav>
|
| 26 |
</header>
|
| 27 |
|
| 28 |
-
<!-- م
|
| 29 |
<main class="main">
|
|
|
|
|
|
|
| 30 |
<section class="hero">
|
| 31 |
-
<h1>ادمج ملفاتك بسهولة في
|
| 32 |
<p>
|
| 33 |
-
اختر مجموعة من الصور أو ملفات PDF، و
|
| 34 |
-
|
| 35 |
</p>
|
| 36 |
</section>
|
| 37 |
|
| 38 |
-
<!-- خطوات
|
| 39 |
<section class="steps">
|
| 40 |
<div class="step">
|
| 41 |
-
<
|
| 42 |
-
<
|
| 43 |
</div>
|
| 44 |
<div class="step">
|
| 45 |
-
<
|
| 46 |
-
<
|
| 47 |
</div>
|
| 48 |
<div class="step">
|
| 49 |
-
<
|
| 50 |
-
<
|
| 51 |
</div>
|
| 52 |
</section>
|
| 53 |
|
| 54 |
-
<!-- الكر
|
| 55 |
<section class="card main-card">
|
| 56 |
|
| 57 |
-
<!-- اختيار الملفات -->
|
| 58 |
<div class="card-row">
|
| 59 |
-
<h2 class="card-title">اخت
|
| 60 |
<p class="hint">
|
| 61 |
-
يدعم
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
</p>
|
| 64 |
|
| 65 |
<label class="file-picker">
|
| 66 |
-
<span class="file-picker-
|
|
|
|
| 67 |
<input id="files" type="file" multiple accept=".pdf,image/*" />
|
| 68 |
</label>
|
| 69 |
</div>
|
| 70 |
|
| 71 |
-
<!-- قائمة الملفات -->
|
| 72 |
<div id="fileList" class="file-list hidden"></div>
|
| 73 |
|
| 74 |
-
<!-- اسم ملف ال
|
| 75 |
<div class="card-row inline">
|
| 76 |
-
<label for="outputName" class="card-
|
| 77 |
-
<input
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
</div>
|
| 80 |
|
| 81 |
<!-- زر الدمج -->
|
| 82 |
<div class="actions">
|
| 83 |
-
<button id="mergeBtn" class="btn-main">
|
|
|
|
|
|
|
| 84 |
</div>
|
| 85 |
|
| 86 |
-
<!--
|
| 87 |
<div id="status" class="status"></div>
|
| 88 |
</section>
|
| 89 |
</main>
|
| 90 |
-
|
| 91 |
-
<!-- التذييل -->
|
| 92 |
-
<footer class="footer">
|
| 93 |
-
<span>أداة دمج ملفات المجموعة</span>
|
| 94 |
-
<span class="dot">•</span>
|
| 95 |
-
<span>تصميم وإعداد الدعم الفني: نوف الناصر</span>
|
| 96 |
-
</footer>
|
| 97 |
-
|
| 98 |
</div>
|
| 99 |
|
| 100 |
<script>
|
|
@@ -119,8 +121,8 @@
|
|
| 119 |
fileListDiv.classList.remove("hidden");
|
| 120 |
fileListDiv.innerHTML = `
|
| 121 |
<div class="file-list-header">
|
| 122 |
-
<span>الملفات المختارة
|
| 123 |
-
<span class="file-note">
|
| 124 |
</div>
|
| 125 |
<ul class="file-list-ul">
|
| 126 |
${files
|
|
@@ -139,12 +141,11 @@
|
|
| 139 |
|
| 140 |
function detectMode(files) {
|
| 141 |
const allImages = files.every(f => f.type.startsWith("image/"));
|
| 142 |
-
const allPDFs =
|
| 143 |
-
|
| 144 |
-
f =
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
);
|
| 148 |
if (allImages) return "images";
|
| 149 |
if (allPDFs) return "pdfs";
|
| 150 |
return null;
|
|
@@ -172,13 +173,11 @@
|
|
| 172 |
|
| 173 |
mergeBtn.addEventListener("click", async () => {
|
| 174 |
let files = Array.from(filesInput.files || []);
|
| 175 |
-
|
| 176 |
if (!files.length) {
|
| 177 |
setStatus("الرجاء اختيار الملفات أولاً.", "error");
|
| 178 |
return;
|
| 179 |
}
|
| 180 |
|
| 181 |
-
// ترتيب حسب الاسم
|
| 182 |
files = files.sort((a, b) =>
|
| 183 |
a.name.localeCompare(b.name, undefined, { numeric: true })
|
| 184 |
);
|
|
@@ -219,7 +218,6 @@
|
|
| 219 |
|
| 220 |
const imgWidth = image.width;
|
| 221 |
const imgHeight = image.height;
|
| 222 |
-
|
| 223 |
const pageWidth = 595.28; // A4
|
| 224 |
const pageHeight = 841.89; // A4
|
| 225 |
|
|
@@ -238,7 +236,7 @@
|
|
| 238 |
(outputNameInput.value || "merged-images.pdf").trim() ||
|
| 239 |
"merged-images.pdf";
|
| 240 |
downloadPdf(pdfBytes, outName);
|
| 241 |
-
setStatus("تم إنشاء ملف PDF من الصور
|
| 242 |
}
|
| 243 |
|
| 244 |
if (mode === "pdfs") {
|
|
@@ -259,10 +257,10 @@
|
|
| 259 |
(outputNameInput.value || "merged-pdfs.pdf").trim() ||
|
| 260 |
"merged-pdfs.pdf";
|
| 261 |
downloadPdf(pdfBytes, outName);
|
| 262 |
-
setStatus("تم دمج ملفات PDF
|
| 263 |
}
|
| 264 |
|
| 265 |
-
// ت
|
| 266 |
filesInput.value = "";
|
| 267 |
renderFileList([]);
|
| 268 |
} catch (err) {
|
|
|
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
+
<title>أداة دمج ملفات المجموعة | PDF واحد بسهولة</title>
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 7 |
<link rel="stylesheet" href="style.css" />
|
| 8 |
<script src="https://unpkg.com/pdf-lib@1.17.1/dist/pdf-lib.min.js"></script>
|
|
|
|
| 10 |
<body>
|
| 11 |
<div class="page">
|
| 12 |
|
| 13 |
+
<!-- الهيدر العلوي -->
|
| 14 |
<header class="topbar">
|
| 15 |
+
<div class="top-left">
|
| 16 |
+
<div class="logo-mark">PDF</div>
|
| 17 |
<div class="brand-text">
|
| 18 |
<div class="brand-title">أداة دمج ملفات المجموعة</div>
|
| 19 |
+
<div class="brand-sub">دمج احترافي لصور وملفات PDF في ملف واحد</div>
|
| 20 |
</div>
|
| 21 |
</div>
|
| 22 |
+
<div class="top-right">
|
| 23 |
+
<span class="credit">تصميم وإعداد الدعم الفني: نوف الناصر</span>
|
| 24 |
+
</div>
|
|
|
|
| 25 |
</header>
|
| 26 |
|
| 27 |
+
<!-- المحتوى الرئيسي -->
|
| 28 |
<main class="main">
|
| 29 |
+
|
| 30 |
+
<!-- تعريف بسيط -->
|
| 31 |
<section class="hero">
|
| 32 |
+
<h1>ادمج ملفاتك بسهولة في PDF واحد منسّق.</h1>
|
| 33 |
<p>
|
| 34 |
+
اختر مجموعة من الصور أو ملفات PDF، وسيتم إنشاء ملف PDF واحد مرتب حسب أسماء الملفات،
|
| 35 |
+
للاستخدام الداخلي ضمن مجموعتك.
|
| 36 |
</p>
|
| 37 |
</section>
|
| 38 |
|
| 39 |
+
<!-- خطوات قصيرة -->
|
| 40 |
<section class="steps">
|
| 41 |
<div class="step">
|
| 42 |
+
<span class="step-number">1</span>
|
| 43 |
+
<span class="step-text">اضغط زر اختيار الملفات.</span>
|
| 44 |
</div>
|
| 45 |
<div class="step">
|
| 46 |
+
<span class="step-number">2</span>
|
| 47 |
+
<span class="step-text">اختر صورًا فقط أو ملفات PDF فقط.</span>
|
| 48 |
</div>
|
| 49 |
<div class="step">
|
| 50 |
+
<span class="step-number">3</span>
|
| 51 |
+
<span class="step-text">تحميل ملف PDF النهائي مباشرة.</span>
|
| 52 |
</div>
|
| 53 |
</section>
|
| 54 |
|
| 55 |
+
<!-- الكارد الرئيسي -->
|
| 56 |
<section class="card main-card">
|
| 57 |
|
|
|
|
| 58 |
<div class="card-row">
|
| 59 |
+
<h2 class="card-title">اختر الملفات المراد دمجها</h2>
|
| 60 |
<p class="hint">
|
| 61 |
+
يدعم:
|
| 62 |
+
<strong>عدة ملفات PDF</strong> ➜ ملف PDF واحد،
|
| 63 |
+
أو
|
| 64 |
+
<strong>عدة صور (JPG / PNG)</strong> ➜ ملف PDF واحد.
|
| 65 |
+
يُفضّل عدم خلط النوعين في نفس العملية.
|
| 66 |
</p>
|
| 67 |
|
| 68 |
<label class="file-picker">
|
| 69 |
+
<span class="file-picker-icon">📂</span>
|
| 70 |
+
<span class="file-picker-text">اضغط هنا لاختيار الملفات من جهازك</span>
|
| 71 |
<input id="files" type="file" multiple accept=".pdf,image/*" />
|
| 72 |
</label>
|
| 73 |
</div>
|
| 74 |
|
| 75 |
+
<!-- قائمة الملفات المختارة -->
|
| 76 |
<div id="fileList" class="file-list hidden"></div>
|
| 77 |
|
| 78 |
+
<!-- اسم الملف الناتج -->
|
| 79 |
<div class="card-row inline">
|
| 80 |
+
<label for="outputName" class="card-label">اسم ملف الإخراج (اختياري)</label>
|
| 81 |
+
<input
|
| 82 |
+
id="outputName"
|
| 83 |
+
type="text"
|
| 84 |
+
class="output-input"
|
| 85 |
+
placeholder="مثال: group-report.pdf"
|
| 86 |
+
/>
|
| 87 |
</div>
|
| 88 |
|
| 89 |
<!-- زر الدمج -->
|
| 90 |
<div class="actions">
|
| 91 |
+
<button id="mergeBtn" class="btn-main">
|
| 92 |
+
دمج وإنشاء ملف PDF واحد
|
| 93 |
+
</button>
|
| 94 |
</div>
|
| 95 |
|
| 96 |
+
<!-- حالة العملية -->
|
| 97 |
<div id="status" class="status"></div>
|
| 98 |
</section>
|
| 99 |
</main>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
</div>
|
| 101 |
|
| 102 |
<script>
|
|
|
|
| 121 |
fileListDiv.classList.remove("hidden");
|
| 122 |
fileListDiv.innerHTML = `
|
| 123 |
<div class="file-list-header">
|
| 124 |
+
<span>الملفات المختارة: ${files.length}</span>
|
| 125 |
+
<span class="file-note">الدمج حسب الترتيب الأبجدي لاسم الملف.</span>
|
| 126 |
</div>
|
| 127 |
<ul class="file-list-ul">
|
| 128 |
${files
|
|
|
|
| 141 |
|
| 142 |
function detectMode(files) {
|
| 143 |
const allImages = files.every(f => f.type.startsWith("image/"));
|
| 144 |
+
const allPDFs = files.every(
|
| 145 |
+
f =>
|
| 146 |
+
f.type === "application/pdf" ||
|
| 147 |
+
f.name.toLowerCase().endsWith(".pdf")
|
| 148 |
+
);
|
|
|
|
| 149 |
if (allImages) return "images";
|
| 150 |
if (allPDFs) return "pdfs";
|
| 151 |
return null;
|
|
|
|
| 173 |
|
| 174 |
mergeBtn.addEventListener("click", async () => {
|
| 175 |
let files = Array.from(filesInput.files || []);
|
|
|
|
| 176 |
if (!files.length) {
|
| 177 |
setStatus("الرجاء اختيار الملفات أولاً.", "error");
|
| 178 |
return;
|
| 179 |
}
|
| 180 |
|
|
|
|
| 181 |
files = files.sort((a, b) =>
|
| 182 |
a.name.localeCompare(b.name, undefined, { numeric: true })
|
| 183 |
);
|
|
|
|
| 218 |
|
| 219 |
const imgWidth = image.width;
|
| 220 |
const imgHeight = image.height;
|
|
|
|
| 221 |
const pageWidth = 595.28; // A4
|
| 222 |
const pageHeight = 841.89; // A4
|
| 223 |
|
|
|
|
| 236 |
(outputNameInput.value || "merged-images.pdf").trim() ||
|
| 237 |
"merged-images.pdf";
|
| 238 |
downloadPdf(pdfBytes, outName);
|
| 239 |
+
setStatus("تم إنشاء ملف PDF من الصور بنجاح.", "ok");
|
| 240 |
}
|
| 241 |
|
| 242 |
if (mode === "pdfs") {
|
|
|
|
| 257 |
(outputNameInput.value || "merged-pdfs.pdf").trim() ||
|
| 258 |
"merged-pdfs.pdf";
|
| 259 |
downloadPdf(pdfBytes, outName);
|
| 260 |
+
setStatus("تم دمج ملفات PDF بنجاح.", "ok");
|
| 261 |
}
|
| 262 |
|
| 263 |
+
// إعادة التهيئة
|
| 264 |
filesInput.value = "";
|
| 265 |
renderFileList([]);
|
| 266 |
} catch (err) {
|