Commit ·
a18de37
1
Parent(s): 98c40db
UI: Footer only in write tab, remove Quran toolbar btn, summary always custom with import
Browse files- src/index.html +81 -72
src/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
<html lang="ar" dir="rtl" class="h-full">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
|
@@ -781,13 +781,6 @@
|
|
| 781 |
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4h12v3M12 4v16"/><path stroke-linecap="round" stroke-width="2.5" stroke="currentColor" d="M5 19L19 5" opacity="0.6"/></svg>
|
| 782 |
</button>
|
| 783 |
</div>
|
| 784 |
-
<div class="fmt-divider"></div>
|
| 785 |
-
<!-- Quran verification -->
|
| 786 |
-
<div class="fmt-group">
|
| 787 |
-
<button id="fmt-quran" class="fmt-btn" onclick="verifyQuranText()" type="button" title="تدقيق النص القرآني" style="color: #06b6d4;">
|
| 788 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"/></svg>
|
| 789 |
-
</button>
|
| 790 |
-
</div>
|
| 791 |
</div>
|
| 792 |
<input type="file" id="doc-import-input" class="sr-only" accept=".txt,.docx,text/plain,application/vnd.openxmlformats-officedocument.wordprocessingml.document" aria-hidden="true">
|
| 793 |
<div id="write-area">
|
|
@@ -804,6 +797,44 @@
|
|
| 804 |
<button type="button" class="popover-dismiss" onclick="if(window.currentApplySuggestion){dismissSuggestion(window.currentApplySuggestion);hideTooltip();}" title="تجاهل هذا الاقتراح">تجاهل</button>
|
| 805 |
<p class="popover-hint">اختر التصحيح المناسب · Escape للإغلاق</p>
|
| 806 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 807 |
</div>
|
| 808 |
<div id="summarize-area" class="summarize-panel is-hidden">
|
| 809 |
<!-- Source Toggle: Editor text vs Custom input -->
|
|
@@ -812,14 +843,14 @@
|
|
| 812 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="color: var(--color-primary);"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
| 813 |
<span class="text-base font-bold">تلخيص النصوص</span>
|
| 814 |
</div>
|
| 815 |
-
<div class="summary-source-toggle mb-3">
|
| 816 |
-
<button type="button" class="summary-source-btn active" id="summary-src-editor" onclick="setSummarySource('editor')">نص المحرر</button>
|
| 817 |
-
<button type="button" class="summary-source-btn" id="summary-src-custom" onclick="setSummarySource('custom')">نص مخصص</button>
|
| 818 |
-
</div>
|
| 819 |
-
<div id="summary-custom-input-wrap" class="is-hidden">
|
| 820 |
<textarea id="summary-custom-input" class="w-full p-4 rounded-xl text-right text-lg editor-content" dir="rtl" rows="6" placeholder="الصق أو اكتب النص الذي تريد تلخيصه هنا..." style="background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-primary); resize: vertical; font-family: inherit;"></textarea>
|
| 821 |
-
<div class="flex items-center justify-between mt-
|
| 822 |
-
<span id="summary-char-count" class="text-xs" style="color: var(--text-secondary);">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
</div>
|
| 824 |
</div>
|
| 825 |
</div>
|
|
@@ -942,44 +973,6 @@
|
|
| 942 |
</div>
|
| 943 |
</div>
|
| 944 |
</div>
|
| 945 |
-
<div class="editor-footer">
|
| 946 |
-
<div class="editor-stats" role="status" aria-label="إحصائيات">
|
| 947 |
-
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--spelling" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="spelling-count">٠</span> إملائي</span></div>
|
| 948 |
-
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--grammar" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="grammar-count">٠</span> نحوي</span></div>
|
| 949 |
-
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--punctuation" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="punctuation-count">٠</span> ترقيم</span></div>
|
| 950 |
-
<span class="stat-item--sep"></span>
|
| 951 |
-
<span class="stat-item"><span id="char-count">٠</span> حرف</span>
|
| 952 |
-
<span class="stat-item"><span id="sentence-count">٠</span> جملة</span>
|
| 953 |
-
<span class="stat-item" style="cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتحديد هدف عدد الكلمات"><span id="word-count" class="font-bold">٠</span> كلمة</span>
|
| 954 |
-
<span id="word-goal-indicator" class="word-goal-badge" style="display:none;cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتغيير الهدف"></span>
|
| 955 |
-
<span class="stat-item--sep"></span>
|
| 956 |
-
<span class="stat-item">⏱ <span id="reading-time">٠</span> د قراءة</span>
|
| 957 |
-
</div>
|
| 958 |
-
<div class="editor-actions">
|
| 959 |
-
<button id="doc-save-btn" class="doc-save-btn-icon btn-ghost" type="button" aria-label="حفظ المستند" title="حفظ">
|
| 960 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"/></svg>
|
| 961 |
-
</button>
|
| 962 |
-
<button onclick="clearEditor()" class="btn-ghost" type="button" title="مسح الكل">
|
| 963 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
| 964 |
-
</button>
|
| 965 |
-
<button onclick="copyText()" class="btn-ghost" type="button" title="نسخ النص">
|
| 966 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
| 967 |
-
</button>
|
| 968 |
-
<button id="doc-import-btn" class="btn-ghost" type="button" aria-label="استيراد ملف" title="استيراد">
|
| 969 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/></svg>
|
| 970 |
-
</button>
|
| 971 |
-
<div class="doc-dropdown" style="display:inline-block;">
|
| 972 |
-
<button id="doc-export-trigger" class="btn-ghost" type="button" aria-label="تصدير" title="تصدير" aria-haspopup="true" aria-expanded="false">
|
| 973 |
-
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
|
| 974 |
-
</button>
|
| 975 |
-
<div id="doc-export-menu" class="doc-dropdown__menu" role="menu" aria-label="خيارات التصدير">
|
| 976 |
-
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="txt">نصي (.txt)</button>
|
| 977 |
-
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="docx">Word (.docx)</button>
|
| 978 |
-
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="pdf">PDF (.pdf)</button>
|
| 979 |
-
</div>
|
| 980 |
-
</div>
|
| 981 |
-
</div>
|
| 982 |
-
</div>
|
| 983 |
</div>
|
| 984 |
<button id="mobile-sheet-trigger" class="mobile-sheet-trigger" type="button" aria-expanded="false" aria-controls="bottom-sheet">
|
| 985 |
<span>الاقتراحات (<span id="mobile-suggestion-count">٠</span>)</span>
|
|
@@ -1295,17 +1288,39 @@
|
|
| 1295 |
}
|
| 1296 |
|
| 1297 |
/* ═══════════════════════════════════════════
|
| 1298 |
-
Summarize —
|
| 1299 |
═══════════════════════════════════════════ */
|
| 1300 |
-
window._summarySource = '
|
| 1301 |
-
function setSummarySource(
|
| 1302 |
-
|
| 1303 |
-
|
| 1304 |
-
|
| 1305 |
-
var
|
| 1306 |
-
|
| 1307 |
-
if (
|
| 1308 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1309 |
}
|
| 1310 |
|
| 1311 |
/* ═══════════════════════════════════════════
|
|
@@ -1356,7 +1371,6 @@
|
|
| 1356 |
if (selBar) selBar.classList.add('is-hidden');
|
| 1357 |
if (tool === 'summarize') {
|
| 1358 |
switchTab('summarize');
|
| 1359 |
-
setSummarySource('custom');
|
| 1360 |
var ta = document.getElementById('summary-custom-input');
|
| 1361 |
if (ta) { ta.value = text; }
|
| 1362 |
} else if (tool === 'dialect') {
|
|
@@ -1782,17 +1796,12 @@
|
|
| 1782 |
}
|
| 1783 |
|
| 1784 |
async function generateSummary(event) {
|
| 1785 |
-
|
| 1786 |
-
|
| 1787 |
-
var customInput = document.getElementById('summary-custom-input');
|
| 1788 |
-
text = customInput ? customInput.value.trim() : '';
|
| 1789 |
-
} else {
|
| 1790 |
-
text = (typeof getEditorText === 'function' ? getEditorText() : '').trim();
|
| 1791 |
-
}
|
| 1792 |
|
| 1793 |
if (!text) {
|
| 1794 |
const summaryText = document.getElementById('summary-text');
|
| 1795 |
-
summaryText.innerHTML = '<p class="text-secondary text-center">
|
| 1796 |
document.getElementById('summary-preview').classList.add('show');
|
| 1797 |
return;
|
| 1798 |
}
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
<html lang="ar" dir="rtl" class="h-full">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
|
|
|
| 781 |
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 4h12v3M12 4v16"/><path stroke-linecap="round" stroke-width="2.5" stroke="currentColor" d="M5 19L19 5" opacity="0.6"/></svg>
|
| 782 |
</button>
|
| 783 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 784 |
</div>
|
| 785 |
<input type="file" id="doc-import-input" class="sr-only" accept=".txt,.docx,text/plain,application/vnd.openxmlformats-officedocument.wordprocessingml.document" aria-hidden="true">
|
| 786 |
<div id="write-area">
|
|
|
|
| 797 |
<button type="button" class="popover-dismiss" onclick="if(window.currentApplySuggestion){dismissSuggestion(window.currentApplySuggestion);hideTooltip();}" title="تجاهل هذا الاقتراح">تجاهل</button>
|
| 798 |
<p class="popover-hint">اختر التصحيح المناسب · Escape للإغلاق</p>
|
| 799 |
</div>
|
| 800 |
+
<div class="editor-footer">
|
| 801 |
+
<div class="editor-stats" role="status" aria-label="إحصائيات">
|
| 802 |
+
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--spelling" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="spelling-count">٠</span> إملائي</span></div>
|
| 803 |
+
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--grammar" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="grammar-count">٠</span> نحوي</span></div>
|
| 804 |
+
<div class="flex items-center gap-2"><span class="stat-dot stat-dot--punctuation" aria-hidden="true"></span><span class="text-sm text-secondary"><span id="punctuation-count">٠</span> ترقيم</span></div>
|
| 805 |
+
<span class="stat-item--sep"></span>
|
| 806 |
+
<span class="stat-item"><span id="char-count">٠</span> حرف</span>
|
| 807 |
+
<span class="stat-item"><span id="sentence-count">٠</span> جملة</span>
|
| 808 |
+
<span class="stat-item" style="cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتحديد هدف عدد الكلمات"><span id="word-count" class="font-bold">٠</span> كلمة</span>
|
| 809 |
+
<span id="word-goal-indicator" class="word-goal-badge" style="display:none;cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتغيير الهدف"></span>
|
| 810 |
+
<span class="stat-item--sep"></span>
|
| 811 |
+
<span class="stat-item">⏱ <span id="reading-time">٠</span> د قراءة</span>
|
| 812 |
+
</div>
|
| 813 |
+
<div class="editor-actions">
|
| 814 |
+
<button id="doc-save-btn" class="doc-save-btn-icon btn-ghost" type="button" aria-label="حفظ المستند" title="حفظ">
|
| 815 |
+
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"/></svg>
|
| 816 |
+
</button>
|
| 817 |
+
<button onclick="clearEditor()" class="btn-ghost" type="button" title="مسح الكل">
|
| 818 |
+
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
| 819 |
+
</button>
|
| 820 |
+
<button onclick="copyText()" class="btn-ghost" type="button" title="نسخ النص">
|
| 821 |
+
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
| 822 |
+
</button>
|
| 823 |
+
<button id="doc-import-btn" class="btn-ghost" type="button" aria-label="استيراد ملف" title="استيراد">
|
| 824 |
+
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/></svg>
|
| 825 |
+
</button>
|
| 826 |
+
<div class="doc-dropdown" style="display:inline-block;">
|
| 827 |
+
<button id="doc-export-trigger" class="btn-ghost" type="button" aria-label="تصدير" title="تصدير" aria-haspopup="true" aria-expanded="false">
|
| 828 |
+
<svg width="16" height="16" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
|
| 829 |
+
</button>
|
| 830 |
+
<div id="doc-export-menu" class="doc-dropdown__menu" role="menu" aria-label="خيارات التصدير">
|
| 831 |
+
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="txt">نصي (.txt)</button>
|
| 832 |
+
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="docx">Word (.docx)</button>
|
| 833 |
+
<button type="button" class="doc-dropdown__item" role="menuitem" data-export-format="pdf">PDF (.pdf)</button>
|
| 834 |
+
</div>
|
| 835 |
+
</div>
|
| 836 |
+
</div>
|
| 837 |
+
</div>
|
| 838 |
</div>
|
| 839 |
<div id="summarize-area" class="summarize-panel is-hidden">
|
| 840 |
<!-- Source Toggle: Editor text vs Custom input -->
|
|
|
|
| 843 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="color: var(--color-primary);"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
| 844 |
<span class="text-base font-bold">تلخيص النصوص</span>
|
| 845 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 846 |
<textarea id="summary-custom-input" class="w-full p-4 rounded-xl text-right text-lg editor-content" dir="rtl" rows="6" placeholder="الصق أو اكتب النص الذي تريد تلخيصه هنا..." style="background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-primary); resize: vertical; font-family: inherit;"></textarea>
|
| 847 |
+
<div class="flex items-center justify-between mt-2 mb-2" dir="rtl">
|
| 848 |
+
<span id="summary-char-count" class="text-xs" style="color: var(--text-secondary);">0 حرف</span>
|
| 849 |
+
<label class="btn-ghost" style="cursor:pointer; display:inline-flex; align-items:center; gap:5px; padding:4px 12px; min-height:32px; font-size:12px;">
|
| 850 |
+
<svg width="14" height="14" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/></svg>
|
| 851 |
+
استيراد ملف
|
| 852 |
+
<input type="file" id="summary-import-input" class="sr-only" accept=".txt,.docx" onchange="importSummaryFile(this)">
|
| 853 |
+
</label>
|
| 854 |
</div>
|
| 855 |
</div>
|
| 856 |
</div>
|
|
|
|
| 973 |
</div>
|
| 974 |
</div>
|
| 975 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 976 |
</div>
|
| 977 |
<button id="mobile-sheet-trigger" class="mobile-sheet-trigger" type="button" aria-expanded="false" aria-controls="bottom-sheet">
|
| 978 |
<span>الاقتراحات (<span id="mobile-suggestion-count">٠</span>)</span>
|
|
|
|
| 1288 |
}
|
| 1289 |
|
| 1290 |
/* ═══════════════════════════════════════════
|
| 1291 |
+
Summarize — File Import
|
| 1292 |
═══════════════════════════════════════════ */
|
| 1293 |
+
window._summarySource = 'custom'; // always custom now
|
| 1294 |
+
function setSummarySource() {} // no-op for backward compat
|
| 1295 |
+
|
| 1296 |
+
function importSummaryFile(inputEl) {
|
| 1297 |
+
if (!inputEl || !inputEl.files || !inputEl.files[0]) return;
|
| 1298 |
+
var file = inputEl.files[0];
|
| 1299 |
+
var ta = document.getElementById('summary-custom-input');
|
| 1300 |
+
if (!ta) return;
|
| 1301 |
+
|
| 1302 |
+
if (file.name.endsWith('.txt')) {
|
| 1303 |
+
var reader = new FileReader();
|
| 1304 |
+
reader.onload = function(e) {
|
| 1305 |
+
ta.value = e.target.result;
|
| 1306 |
+
if (typeof showToast === 'function') showToast('✓ تم استيراد الملف');
|
| 1307 |
+
};
|
| 1308 |
+
reader.readAsText(file, 'UTF-8');
|
| 1309 |
+
} else if (file.name.endsWith('.docx')) {
|
| 1310 |
+
// Use mammoth if available, otherwise fallback
|
| 1311 |
+
if (typeof mammoth !== 'undefined') {
|
| 1312 |
+
var reader = new FileReader();
|
| 1313 |
+
reader.onload = function(e) {
|
| 1314 |
+
mammoth.extractRawText({ arrayBuffer: e.target.result })
|
| 1315 |
+
.then(function(result) { ta.value = result.value; if (typeof showToast === 'function') showToast('✓ تم استيراد الملف'); })
|
| 1316 |
+
.catch(function() { if (typeof showToast === 'function') showToast('خطأ في قراءة الملف', 'error'); });
|
| 1317 |
+
};
|
| 1318 |
+
reader.readAsArrayBuffer(file);
|
| 1319 |
+
} else {
|
| 1320 |
+
if (typeof showToast === 'function') showToast('صيغة .docx غير مدعومة حاليًا — استخدم .txt', 'warning');
|
| 1321 |
+
}
|
| 1322 |
+
}
|
| 1323 |
+
inputEl.value = ''; // reset for re-import
|
| 1324 |
}
|
| 1325 |
|
| 1326 |
/* ═══════════════════════════════════════════
|
|
|
|
| 1371 |
if (selBar) selBar.classList.add('is-hidden');
|
| 1372 |
if (tool === 'summarize') {
|
| 1373 |
switchTab('summarize');
|
|
|
|
| 1374 |
var ta = document.getElementById('summary-custom-input');
|
| 1375 |
if (ta) { ta.value = text; }
|
| 1376 |
} else if (tool === 'dialect') {
|
|
|
|
| 1796 |
}
|
| 1797 |
|
| 1798 |
async function generateSummary(event) {
|
| 1799 |
+
var customInput = document.getElementById('summary-custom-input');
|
| 1800 |
+
let text = customInput ? customInput.value.trim() : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1801 |
|
| 1802 |
if (!text) {
|
| 1803 |
const summaryText = document.getElementById('summary-text');
|
| 1804 |
+
summaryText.innerHTML = '<p class="text-secondary text-center">الرجاء كتابة أو لصق نص في مربع الإدخال أولاً</p>';
|
| 1805 |
document.getElementById('summary-preview').classList.add('show');
|
| 1806 |
return;
|
| 1807 |
}
|