Update index.html
Browse files- index.html +86 -90
index.html
CHANGED
@@ -32,25 +32,25 @@
|
|
32 |
}
|
33 |
|
34 |
/* -------------------------------
|
35 |
-
تنسيقات النص والتظليل (
|
36 |
------------------------------- */
|
37 |
.text-comparison { line-height: 1.8; white-space: pre-wrap; }
|
38 |
.highlight-missing {
|
39 |
-
background-color: #
|
40 |
color: #fff;
|
41 |
padding: 0 4px;
|
42 |
border-radius: 3px;
|
43 |
font-weight: bold;
|
44 |
}
|
45 |
.highlight-number {
|
46 |
-
background-color: #
|
47 |
color: #000;
|
48 |
padding: 0 4px;
|
49 |
border-radius: 3px;
|
50 |
font-weight: bold;
|
51 |
}
|
52 |
.highlight-meaning {
|
53 |
-
background-color: #
|
54 |
color: #fff;
|
55 |
padding: 0 4px;
|
56 |
border-radius: 3px;
|
@@ -67,20 +67,20 @@
|
|
67 |
}
|
68 |
.line-number {
|
69 |
font-weight: bold;
|
70 |
-
color: #
|
71 |
margin-left: 0.5rem;
|
72 |
}
|
73 |
.line-text { display: inline-block; }
|
74 |
|
75 |
/* -------------------------------
|
76 |
-
تصميم البطاقات والأيقونات
|
77 |
------------------------------- */
|
78 |
.card {
|
79 |
background-color: #fff;
|
80 |
border-radius: 1rem;
|
81 |
box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
|
82 |
padding: 2rem;
|
83 |
-
border: 1px solid #
|
84 |
}
|
85 |
.card-hover:hover {
|
86 |
box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2);
|
@@ -89,16 +89,16 @@
|
|
89 |
.icon { margin-right: 0.5rem; }
|
90 |
</style>
|
91 |
</head>
|
92 |
-
<body class="bg-gradient-to-br from-gray-100 via-blue-
|
93 |
<div class="min-h-screen pb-12">
|
94 |
<!-- رأس الصفحة -->
|
95 |
-
<header class="bg-gradient-to-r from-
|
96 |
<div class="max-w-6xl mx-auto px-4 text-center">
|
97 |
<h1 class="text-5xl font-bold mb-4 animate-scale">
|
98 |
<i class="fas fa-chart-line icon"></i> نظام المقارنة والتحليل المتقدم
|
99 |
</h1>
|
100 |
<p class="text-xl opacity-90">
|
101 |
-
<i class="fas fa-info-circle icon"></i> تحليل دقيق لاكتشاف النصوص المفقودة،
|
102 |
</p>
|
103 |
</div>
|
104 |
</header>
|
@@ -108,30 +108,30 @@
|
|
108 |
<!-- قسم رفع الملفات -->
|
109 |
<div class="card card-hover">
|
110 |
<h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
|
111 |
-
<i class="fas fa-file-upload icon text-
|
112 |
</h2>
|
113 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
114 |
<!-- ملف المصدر -->
|
115 |
-
<div class="group border-2 border-dashed border-
|
116 |
<label class="cursor-pointer block">
|
117 |
<input type="file" id="sourceFile" accept=".docx,.pdf" class="hidden">
|
118 |
-
<i class="fas fa-upload text-5xl text-
|
119 |
-
<span class="text-lg text-
|
120 |
</label>
|
121 |
</div>
|
122 |
<!-- ملف الهدف -->
|
123 |
-
<div class="group border-2 border-dashed border-
|
124 |
<label class="cursor-pointer block">
|
125 |
<input type="file" id="targetFile" accept=".docx,.pdf" class="hidden">
|
126 |
-
<i class="fas fa-download text-5xl text-
|
127 |
-
<span class="text-lg text-
|
128 |
</label>
|
129 |
</div>
|
130 |
</div>
|
131 |
<div id="processStatus" class="hidden mt-4">
|
132 |
-
<div class="flex items-center justify-center space-x-3 bg-
|
133 |
-
<div class="animate-spin h-8 w-8 border-4 border-
|
134 |
-
<span class="text-lg text-
|
135 |
</div>
|
136 |
</div>
|
137 |
</div>
|
@@ -142,16 +142,16 @@
|
|
142 |
<!-- النص المصدر -->
|
143 |
<div class="group">
|
144 |
<label class="block text-lg font-bold text-gray-700 mb-3">
|
145 |
-
<i class="fas fa-language icon text-
|
146 |
</label>
|
147 |
-
<textarea id="sourceText" dir="rtl" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-
|
148 |
</div>
|
149 |
<!-- النص الهدف -->
|
150 |
<div class="group">
|
151 |
<label class="block text-lg font-bold text-gray-700 mb-3">
|
152 |
-
<i class="fas fa-language icon text-
|
153 |
</label>
|
154 |
-
<textarea id="targetText" dir="ltr" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-
|
155 |
</div>
|
156 |
</div>
|
157 |
</div>
|
@@ -181,7 +181,7 @@
|
|
181 |
</div>
|
182 |
|
183 |
<!-- زر التحليل والمراجعة -->
|
184 |
-
<button id="submitBtn" class="w-full bg-gradient-to-r from-
|
185 |
<div class="flex items-center justify-center">
|
186 |
<i class="fas fa-sync-alt icon ml-2"></i> تحليل ومراجعة النصوص
|
187 |
</div>
|
@@ -196,13 +196,13 @@
|
|
196 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
197 |
<div>
|
198 |
<h4 class="text-lg font-bold text-gray-700 mb-3">
|
199 |
-
<i class="fas fa-file-alt icon text-
|
200 |
</h4>
|
201 |
-
<div id="sourceTextReview" class="bg-
|
202 |
</div>
|
203 |
<div>
|
204 |
<h4 class="text-lg font-bold text-gray-700 mb-3">
|
205 |
-
<i class="fas fa-file-alt icon text-
|
206 |
</h4>
|
207 |
<div id="targetTextReview" class="bg-gray-50 rounded-xl p-6 min-h-[200px] border-2 border-gray-200 text-comparison"></div>
|
208 |
</div>
|
@@ -227,44 +227,31 @@
|
|
227 |
"use strict";
|
228 |
|
229 |
/* تحسين البرومت:
|
230 |
-
- مهمتك: مقارنة النص المصدر
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
const API_URL = 'https://api.deepseek.com/chat/completions';
|
241 |
const API_KEY = 'sk-15606736ed9e4aea8b7cc11a195d2b01';
|
242 |
-
const ANALYSIS_PROMPT = `أنت خبير لغوي وتقني متخصص في مراجعة الترجمة التقنية وتحليل النصوص بدقة. مهمتك هي مقارنة النص المصدر مع النص الهدف واستخراج كافة الاختلافات والتناقضات بينهما، مع اتباع التعليمات التفصيلية التالية:
|
243 |
-
|
244 |
-
النصوص المفقودة:
|
245 |
-
|
246 |
-
تحديد الكلمات أو العبارات التي تظهر في النص المصدر ولا توجد لها مقابل في النص الهدف.
|
247 |
-
قم بتمييز كل نص مفقود عن طريق وضعه بين علامتي __ (مثال: مثال).
|
248 |
-
الأرقام والتواريخ:
|
249 |
-
|
250 |
-
مقارنة الأرقام والتواريخ الموجودة في كلا النصين وتحديد أي اختلافات أو عدم تطابق.
|
251 |
-
قم بتمييز الأرقام أو التواريخ التي لا تتطابق بوضعها بين علامتي < و > (مثال: <2023> أو <15-04-2023>).
|
252 |
-
اختلاف المعنى:
|
253 |
-
|
254 |
-
فحص النصين للتأكد من توافق المعاني، وفي حال وجود اختلاف واضح في المعنى، يجب الإشارة إليه.
|
255 |
-
قم بتمييز الاختلافات في المعنى باستخدام العلامتين [MEANING] و [/MEANING] (مثال: [MEANING]تغيير في الفكرة[/MEANING]).
|
256 |
-
تعليمات إضافية:
|
257 |
-
تنسيق الإخراج:
|
258 |
-
قدم الناتج في شكل قائمة تفصيلية لكل اختلاف.
|
259 |
-
ضمن كل بند من القائمة، اذكر شرحاً مختصراً يوضح طبيعة الاختلاف، مع ذكر رقم السطر أو رقم الفقرة إن أمكن ذلك.
|
260 |
-
الدقة والشمول:
|
261 |
-
تأكد من مراجعة النصوص بدقة، مع تضمين جميع الاختلافات سواء كانت تركيبية، نحوية أو دلالية.
|
262 |
-
لا تقم بتعديل أو تغيير المحتوى الأصلي للنصين؛ فقط قم بتحديد الاختلافات.
|
263 |
-
النص المصدر:
|
264 |
-
{source}
|
265 |
-
|
266 |
-
النص الهدف:
|
267 |
-
{target}`;
|
268 |
|
269 |
/* -------------------------------
|
270 |
دوال مساعدة عامة
|
@@ -291,42 +278,51 @@
|
|
291 |
};
|
292 |
|
293 |
/* -------------------------------
|
294 |
-
دوال تظليل الاختلافات
|
295 |
------------------------------- */
|
296 |
const applyHighlights = (originalText, analysisOutput) => {
|
297 |
-
|
|
|
298 |
let match;
|
299 |
-
// تظليل النصوص المفقودة
|
300 |
const missingRegex = /__(.*?)__/g;
|
301 |
while ((match = missingRegex.exec(analysisOutput)) !== null) {
|
302 |
-
|
303 |
-
if (phrase)
|
304 |
-
const replacement = `<span class="highlight-missing">${phrase}</span>`;
|
305 |
-
const phraseRegex = new RegExp(escapeRegExp(phrase), 'g');
|
306 |
-
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
307 |
-
}
|
308 |
}
|
309 |
-
|
310 |
const numberRegex = /<([^<>]+)>/g;
|
311 |
while ((match = numberRegex.exec(analysisOutput)) !== null) {
|
312 |
-
|
313 |
-
if (phrase)
|
314 |
-
const replacement = `<span class="highlight-number">${phrase}</span>`;
|
315 |
-
const phraseRegex = new RegExp(escapeRegExp(phrase), 'g');
|
316 |
-
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
317 |
-
}
|
318 |
}
|
319 |
-
|
320 |
const meaningRegex = /\[MEANING\](.*?)\[\/MEANING\]/g;
|
321 |
while ((match = meaningRegex.exec(analysisOutput)) !== null) {
|
322 |
-
|
323 |
-
if (phrase)
|
324 |
-
const replacement = `<span class="highlight-meaning">${phrase}</span>`;
|
325 |
-
const phraseRegex = new RegExp(escapeRegExp(phrase), 'g');
|
326 |
-
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
327 |
-
}
|
328 |
}
|
329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
};
|
331 |
|
332 |
// توليد شرح تفصيلي للاختلافات مع أيقونات بسيطة
|
@@ -461,9 +457,9 @@
|
|
461 |
|
462 |
try {
|
463 |
const progressDiv = document.createElement('div');
|
464 |
-
progressDiv.className = "bg-
|
465 |
progressDiv.innerHTML = `<div class="flex items-center">
|
466 |
-
<div class="animate-spin h-6 w-6 border-4 border-
|
467 |
<span>جارٍ التحليل...</span>
|
468 |
</div>`;
|
469 |
document.getElementById('errorsList').appendChild(progressDiv);
|
|
|
32 |
}
|
33 |
|
34 |
/* -------------------------------
|
35 |
+
تنسيقات النص والتظليل (تمييز النصوص ذات المشاكل فقط)
|
36 |
------------------------------- */
|
37 |
.text-comparison { line-height: 1.8; white-space: pre-wrap; }
|
38 |
.highlight-missing {
|
39 |
+
background-color: #fb923c; /* برتقالي مميز */
|
40 |
color: #fff;
|
41 |
padding: 0 4px;
|
42 |
border-radius: 3px;
|
43 |
font-weight: bold;
|
44 |
}
|
45 |
.highlight-number {
|
46 |
+
background-color: #fde047; /* أصفر باهر */
|
47 |
color: #000;
|
48 |
padding: 0 4px;
|
49 |
border-radius: 3px;
|
50 |
font-weight: bold;
|
51 |
}
|
52 |
.highlight-meaning {
|
53 |
+
background-color: #a78bfa; /* بنفسجي */
|
54 |
color: #fff;
|
55 |
padding: 0 4px;
|
56 |
border-radius: 3px;
|
|
|
67 |
}
|
68 |
.line-number {
|
69 |
font-weight: bold;
|
70 |
+
color: #374151;
|
71 |
margin-left: 0.5rem;
|
72 |
}
|
73 |
.line-text { display: inline-block; }
|
74 |
|
75 |
/* -------------------------------
|
76 |
+
تصميم البطاقات والأيقونات وتحديث ألوان الواجهة
|
77 |
------------------------------- */
|
78 |
.card {
|
79 |
background-color: #fff;
|
80 |
border-radius: 1rem;
|
81 |
box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
|
82 |
padding: 2rem;
|
83 |
+
border: 1px solid #e5e7eb;
|
84 |
}
|
85 |
.card-hover:hover {
|
86 |
box-shadow: 0 10px 25px -5px rgba(0,0,0,0.2);
|
|
|
89 |
.icon { margin-right: 0.5rem; }
|
90 |
</style>
|
91 |
</head>
|
92 |
+
<body class="bg-gradient-to-br from-gray-100 via-blue-50 to-indigo-50 min-h-screen">
|
93 |
<div class="min-h-screen pb-12">
|
94 |
<!-- رأس الصفحة -->
|
95 |
+
<header class="bg-gradient-to-r from-teal-500 to-blue-500 animate-gradient text-white py-10 mb-10 shadow-xl">
|
96 |
<div class="max-w-6xl mx-auto px-4 text-center">
|
97 |
<h1 class="text-5xl font-bold mb-4 animate-scale">
|
98 |
<i class="fas fa-chart-line icon"></i> نظام المقارنة والتحليل المتقدم
|
99 |
</h1>
|
100 |
<p class="text-xl opacity-90">
|
101 |
+
<i class="fas fa-info-circle icon"></i> تحليل دقيق لاكتشاف النصوص المفقودة، الأرقام/التواريخ، واختلاف المعاني
|
102 |
</p>
|
103 |
</div>
|
104 |
</header>
|
|
|
108 |
<!-- قسم رفع الملفات -->
|
109 |
<div class="card card-hover">
|
110 |
<h2 class="text-2xl font-bold text-gray-800 border-b pb-3 mb-6">
|
111 |
+
<i class="fas fa-file-upload icon text-blue-600"></i> تحميل الملفات
|
112 |
</h2>
|
113 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
114 |
<!-- ملف المصدر -->
|
115 |
+
<div class="group border-2 border-dashed border-blue-300 rounded-xl p-8 text-center bg-blue-50 hover:bg-blue-100 transition-colors duration-300">
|
116 |
<label class="cursor-pointer block">
|
117 |
<input type="file" id="sourceFile" accept=".docx,.pdf" class="hidden">
|
118 |
+
<i class="fas fa-upload text-5xl text-blue-500 mb-4"></i>
|
119 |
+
<span class="text-lg text-blue-600 group-hover:text-blue-700">ملف المصدر</span>
|
120 |
</label>
|
121 |
</div>
|
122 |
<!-- ملف الهدف -->
|
123 |
+
<div class="group border-2 border-dashed border-purple-300 rounded-xl p-8 text-center bg-purple-50 hover:bg-purple-100 transition-colors duration-300">
|
124 |
<label class="cursor-pointer block">
|
125 |
<input type="file" id="targetFile" accept=".docx,.pdf" class="hidden">
|
126 |
+
<i class="fas fa-download text-5xl text-purple-500 mb-4"></i>
|
127 |
+
<span class="text-lg text-purple-600 group-hover:text-purple-700">ملف الهدف</span>
|
128 |
</label>
|
129 |
</div>
|
130 |
</div>
|
131 |
<div id="processStatus" class="hidden mt-4">
|
132 |
+
<div class="flex items-center justify-center space-x-3 bg-blue-100 rounded-xl p-4">
|
133 |
+
<div class="animate-spin h-8 w-8 border-4 border-blue-600 rounded-full border-t-transparent"></div>
|
134 |
+
<span class="text-lg text-blue-700">جارٍ معالجة الملف...</span>
|
135 |
</div>
|
136 |
</div>
|
137 |
</div>
|
|
|
142 |
<!-- النص المصدر -->
|
143 |
<div class="group">
|
144 |
<label class="block text-lg font-bold text-gray-700 mb-3">
|
145 |
+
<i class="fas fa-language icon text-blue-600"></i> النص المصدر
|
146 |
</label>
|
147 |
+
<textarea id="sourceText" dir="rtl" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-blue-200 focus:border-blue-400 transition-all resize-none text-lg" rows="6" placeholder="اكتب النص المصدر هنا..."></textarea>
|
148 |
</div>
|
149 |
<!-- النص الهدف -->
|
150 |
<div class="group">
|
151 |
<label class="block text-lg font-bold text-gray-700 mb-3">
|
152 |
+
<i class="fas fa-language icon text-purple-600"></i> النص الهدف
|
153 |
</label>
|
154 |
+
<textarea id="targetText" dir="ltr" class="w-full px-6 py-4 border-2 border-gray-200 rounded-xl focus:ring-purple-200 focus:border-purple-400 transition-all resize-none text-lg" rows="6" placeholder="اكتب النص الهدف هنا..."></textarea>
|
155 |
</div>
|
156 |
</div>
|
157 |
</div>
|
|
|
181 |
</div>
|
182 |
|
183 |
<!-- زر التحليل والمراجعة -->
|
184 |
+
<button id="submitBtn" class="w-full bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-bold py-5 px-8 rounded-xl transition-all transform hover:scale-105 focus:ring-blue-200 text-xl shadow-lg hover:shadow-xl pulse-animation">
|
185 |
<div class="flex items-center justify-center">
|
186 |
<i class="fas fa-sync-alt icon ml-2"></i> تحليل ومراجعة النصوص
|
187 |
</div>
|
|
|
196 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
197 |
<div>
|
198 |
<h4 class="text-lg font-bold text-gray-700 mb-3">
|
199 |
+
<i class="fas fa-file-alt icon text-blue-600"></i> النص المصدر (مع التعليم)
|
200 |
</h4>
|
201 |
+
<div id="sourceTextReview" class="bg-blue-50 rounded-xl p-6 min-h-[200px] border-2 border-blue-100 text-comparison"></div>
|
202 |
</div>
|
203 |
<div>
|
204 |
<h4 class="text-lg font-bold text-gray-700 mb-3">
|
205 |
+
<i class="fas fa-file-alt icon text-purple-600"></i> النص الهدف (مع التعليم)
|
206 |
</h4>
|
207 |
<div id="targetTextReview" class="bg-gray-50 rounded-xl p-6 min-h-[200px] border-2 border-gray-200 text-comparison"></div>
|
208 |
</div>
|
|
|
227 |
"use strict";
|
228 |
|
229 |
/* تحسين البرومت:
|
230 |
+
- مهمتك: مقارنة النص المصدر مع النص الهدف واستخراج كافة الاختلافات والتناقضات بينهما وفقاً للتعليمات التفصيلية التالية:
|
231 |
+
1. النصوص المفقودة:
|
232 |
+
• تحديد الكلمات أو العبارات التي تظهر في النص المصدر ولا توجد لها مقابل في النص الهدف.
|
233 |
+
• قم بتمييز النص المفقود عن طريق وضعه بين علامتي __ و __.
|
234 |
+
2. الأرقام والتواريخ:
|
235 |
+
• مقارنة الأرقام والتواريخ الموجودة في كلا النصين وتحديد أي اختلاف أو عدم تطابق.
|
236 |
+
• قم بتمييزها بوضعها بين علامتي < و >.
|
237 |
+
3. اختلاف المعنى:
|
238 |
+
• فحص النصين للتأكد من توافق المعاني، وفي حال وجود اختلاف واضح في المعنى، يجب الإشارة إليه.
|
239 |
+
• قم بتمييز اختلاف المعنى باستخدام العلامتين [MEANING] و [/MEANING].
|
240 |
+
تعليمات إضافية:
|
241 |
+
• إذا كان هناك اختلاف في ترتيب الفقرات أو الكلمات، يرجى الإشارة إليه.
|
242 |
+
• تأكد من عدم تكرار الإشارات لنفس المشكلة في نفس السياق.
|
243 |
+
• في حال وجود اختلافات طفيفة لا تؤثر على المعنى، يمكن تجاهلها.
|
244 |
+
• قدم الناتج في شكل قائمة مرتبة لكل اختلاف مع شرح مختصر ورقم السطر إن أمكن.
|
245 |
+
|
246 |
+
النص المصدر:
|
247 |
+
{source}
|
248 |
+
|
249 |
+
النص الهدف:
|
250 |
+
{target}
|
251 |
+
`;
|
252 |
+
|
253 |
const API_URL = 'https://api.deepseek.com/chat/completions';
|
254 |
const API_KEY = 'sk-15606736ed9e4aea8b7cc11a195d2b01';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
|
256 |
/* -------------------------------
|
257 |
دوال مساعدة عامة
|
|
|
278 |
};
|
279 |
|
280 |
/* -------------------------------
|
281 |
+
دوال تظليل الاختلافات على الأسطر التي بها مشاكل فقط
|
282 |
------------------------------- */
|
283 |
const applyHighlights = (originalText, analysisOutput) => {
|
284 |
+
// استخراج العبارات الخاصة بكل نوع من الاختلافات بدون تكرار
|
285 |
+
let missingMatches = [];
|
286 |
let match;
|
|
|
287 |
const missingRegex = /__(.*?)__/g;
|
288 |
while ((match = missingRegex.exec(analysisOutput)) !== null) {
|
289 |
+
let phrase = match[1].trim();
|
290 |
+
if (phrase && !missingMatches.includes(phrase)) missingMatches.push(phrase);
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
+
let numberMatches = [];
|
293 |
const numberRegex = /<([^<>]+)>/g;
|
294 |
while ((match = numberRegex.exec(analysisOutput)) !== null) {
|
295 |
+
let phrase = match[1].trim();
|
296 |
+
if (phrase && !numberMatches.includes(phrase)) numberMatches.push(phrase);
|
|
|
|
|
|
|
|
|
297 |
}
|
298 |
+
let meaningMatches = [];
|
299 |
const meaningRegex = /\[MEANING\](.*?)\[\/MEANING\]/g;
|
300 |
while ((match = meaningRegex.exec(analysisOutput)) !== null) {
|
301 |
+
let phrase = match[1].trim();
|
302 |
+
if (phrase && !meaningMatches.includes(phrase)) meaningMatches.push(phrase);
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
+
// معالجة كل سطر وتطبيق التظليل إذا احتوى على عبارة مشكلة
|
305 |
+
let lines = originalText.split("\n");
|
306 |
+
let highlightedLines = lines.map(line => {
|
307 |
+
let newLine = line;
|
308 |
+
missingMatches.forEach(phrase => {
|
309 |
+
if(newLine.includes(phrase)){
|
310 |
+
newLine = newLine.replace(new RegExp(escapeRegExp(phrase), 'g'), `<span class="highlight-missing">${phrase}</span>`);
|
311 |
+
}
|
312 |
+
});
|
313 |
+
numberMatches.forEach(phrase => {
|
314 |
+
if(newLine.includes(phrase)){
|
315 |
+
newLine = newLine.replace(new RegExp(escapeRegExp(phrase), 'g'), `<span class="highlight-number">${phrase}</span>`);
|
316 |
+
}
|
317 |
+
});
|
318 |
+
meaningMatches.forEach(phrase => {
|
319 |
+
if(newLine.includes(phrase)){
|
320 |
+
newLine = newLine.replace(new RegExp(escapeRegExp(phrase), 'g'), `<span class="highlight-meaning">${phrase}</span>`);
|
321 |
+
}
|
322 |
+
});
|
323 |
+
return newLine;
|
324 |
+
});
|
325 |
+
return highlightedLines.join("\n");
|
326 |
};
|
327 |
|
328 |
// توليد شرح تفصيلي للاختلافات مع أيقونات بسيطة
|
|
|
457 |
|
458 |
try {
|
459 |
const progressDiv = document.createElement('div');
|
460 |
+
progressDiv.className = "bg-blue-100 p-4 rounded-xl mb-4";
|
461 |
progressDiv.innerHTML = `<div class="flex items-center">
|
462 |
+
<div class="animate-spin h-6 w-6 border-4 border-blue-600 rounded-full border-t-transparent mr-3"></div>
|
463 |
<span>جارٍ التحليل...</span>
|
464 |
</div>`;
|
465 |
document.getElementById('errorsList').appendChild(progressDiv);
|