Update index.html
Browse files- index.html +80 -94
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>
|
@@ -226,30 +226,22 @@
|
|
226 |
(function() {
|
227 |
"use strict";
|
228 |
|
229 |
-
/* تحسين
|
230 |
-
- مهمتك: مقارنة النص المصدر
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
• قم بتمييز اختلاف المعنى باستخدام العلامتين [MEANING] و [/MEANING].
|
240 |
-
تعليمات إضافية:
|
241 |
-
• إذا كان هناك اختلاف في ترتيب الفقرات أو الكلمات، يرجى الإشارة إليه.
|
242 |
-
• تأكد من عدم تكرار الإشارات لنفس المشكلة في نفس السياق.
|
243 |
-
• في حال وجود اختلافات طفيفة لا تؤثر على المعنى، يمكن تجاهلها.
|
244 |
-
• قدم الناتج في شكل قائمة مرتبة لكل اختلاف مع شرح مختصر ورقم السطر إن أمكن.
|
245 |
-
|
246 |
-
النص المصدر:
|
247 |
-
{source}
|
248 |
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
|
|
253 |
const API_URL = 'https://api.deepseek.com/chat/completions';
|
254 |
const API_KEY = 'sk-15606736ed9e4aea8b7cc11a195d2b01';
|
255 |
|
@@ -262,70 +254,64 @@
|
|
262 |
const escapeRegExp = string =>
|
263 |
string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
264 |
|
265 |
-
// تقسيم النص إلى فقرات
|
266 |
const splitIntoLines = text =>
|
267 |
text.split(/\n+/).map((line, i) => {
|
268 |
line = line.trim();
|
269 |
-
if(line &&
|
270 |
return `<div class="line-item"><span class="line-number">${i+1}:</span><span class="line-text">${line}</span></div>`;
|
271 |
}).join('');
|
272 |
|
273 |
-
// الحصول على رقم السطر الذي يحتوي على عبارة معينة
|
274 |
const getLineNumber = (text, substring) => {
|
275 |
-
const
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
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 |
-
|
290 |
-
if (phrase
|
|
|
|
|
|
|
|
|
291 |
}
|
292 |
-
|
293 |
const numberRegex = /<([^<>]+)>/g;
|
294 |
while ((match = numberRegex.exec(analysisOutput)) !== null) {
|
295 |
-
|
296 |
-
if (phrase
|
|
|
|
|
|
|
|
|
297 |
}
|
298 |
-
|
299 |
const meaningRegex = /\[MEANING\](.*?)\[\/MEANING\]/g;
|
300 |
while ((match = meaningRegex.exec(analysisOutput)) !== null) {
|
301 |
-
|
302 |
-
if (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 |
-
// توليد شرح تفصيلي للاختلافات مع أيقونات
|
329 |
const generateExplanation = (sourceText, analysisOutput) => {
|
330 |
let steps = [];
|
331 |
let match;
|
@@ -360,7 +346,7 @@
|
|
360 |
}
|
361 |
}
|
362 |
if (steps.length === 0) {
|
363 |
-
return `<p><i class="fas fa-check-circle mr-2"></i>
|
364 |
}
|
365 |
return `<ol class="list-decimal ml-6 space-y-2">${steps.join('')}</ol>`;
|
366 |
};
|
@@ -457,9 +443,9 @@
|
|
457 |
|
458 |
try {
|
459 |
const progressDiv = document.createElement('div');
|
460 |
-
progressDiv.className = "bg-
|
461 |
progressDiv.innerHTML = `<div class="flex items-center">
|
462 |
-
<div class="animate-spin h-6 w-6 border-4 border-
|
463 |
<span>جارٍ التحليل...</span>
|
464 |
</div>`;
|
465 |
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: #f87171; /* أحمر */
|
40 |
color: #fff;
|
41 |
padding: 0 4px;
|
42 |
border-radius: 3px;
|
43 |
font-weight: bold;
|
44 |
}
|
45 |
.highlight-number {
|
46 |
+
background-color: #facc15; /* أصفر */
|
47 |
color: #000;
|
48 |
padding: 0 4px;
|
49 |
border-radius: 3px;
|
50 |
font-weight: bold;
|
51 |
}
|
52 |
.highlight-meaning {
|
53 |
+
background-color: #60a5fa; /* أزرق */
|
54 |
color: #fff;
|
55 |
padding: 0 4px;
|
56 |
border-radius: 3px;
|
|
|
67 |
}
|
68 |
.line-number {
|
69 |
font-weight: bold;
|
70 |
+
color: #4B5563;
|
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 #f3f4f6;
|
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-100 to-indigo-100 min-h-screen">
|
93 |
<div class="min-h-screen pb-12">
|
94 |
<!-- رأس الصفحة -->
|
95 |
+
<header class="bg-gradient-to-r from-indigo-700 via-purple-700 to-pink-700 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-indigo-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-indigo-300 rounded-xl p-8 text-center bg-indigo-50 hover:bg-indigo-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-indigo-500 mb-4"></i>
|
119 |
+
<span class="text-lg text-indigo-600 group-hover:text-indigo-700">ملف المصدر</span>
|
120 |
</label>
|
121 |
</div>
|
122 |
<!-- ملف الهدف -->
|
123 |
+
<div class="group border-2 border-dashed border-pink-300 rounded-xl p-8 text-center bg-pink-50 hover:bg-pink-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-pink-500 mb-4"></i>
|
127 |
+
<span class="text-lg text-pink-600 group-hover:text-pink-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-indigo-100 rounded-xl p-4">
|
133 |
+
<div class="animate-spin h-8 w-8 border-4 border-indigo-600 rounded-full border-t-transparent"></div>
|
134 |
+
<span class="text-lg text-indigo-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-indigo-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-indigo-200 focus:border-indigo-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-pink-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-pink-200 focus:border-pink-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-indigo-600 to-pink-600 hover:from-indigo-700 hover:to-pink-700 text-white font-bold py-5 px-8 rounded-xl transition-all transform hover:scale-105 focus:ring-indigo-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-indigo-600"></i> النص المصدر (مع التعليم)
|
200 |
</h4>
|
201 |
+
<div id="sourceTextReview" class="bg-indigo-50 rounded-xl p-6 min-h-[200px] border-2 border-indigo-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-pink-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>
|
|
|
226 |
(function() {
|
227 |
"use strict";
|
228 |
|
229 |
+
/* تحسين البرومبت:
|
230 |
+
- مهمتك: مقارنة النص المصدر والنص الهدف واستخراج الاختلافات التالية بدقة:
|
231 |
+
1. **النصوص المفقودة:** الكلمات أو العبارات التي لم تُترجم من النص المصدر.
|
232 |
+
2. **الأرقام والتواريخ:** التي لا تتطابق بين النص المصدر والنص الهدف.
|
233 |
+
3. **اختلاف المعنى:** في حال وجود اختلاف في معنى النص أو سياقه.
|
234 |
+
- التنسيق المطلوب:
|
235 |
+
• ضع النصوص المفقودة بين علامتي __ والنص المفقود__.
|
236 |
+
• ضع الأرقام والتواريخ بين علامتي < والرقم/التاريخ>.
|
237 |
+
• ضع اختلاف المعنى بين [MEANING] و [/MEANING].
|
238 |
+
- يُرجى تضمين رقم السطر لكل اختلاف إن أمكن وتقديم النتائج في قائمة مفصلة مع شرح مختصر.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
|
240 |
+
النص المصدر:
|
241 |
+
{source}
|
242 |
+
|
243 |
+
النص الهدف:
|
244 |
+
{target}`;
|
245 |
const API_URL = 'https://api.deepseek.com/chat/completions';
|
246 |
const API_KEY = 'sk-15606736ed9e4aea8b7cc11a195d2b01';
|
247 |
|
|
|
254 |
const escapeRegExp = string =>
|
255 |
string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
256 |
|
257 |
+
// تقسيم النص إلى فقرات مع ترقيم السطور
|
258 |
const splitIntoLines = text =>
|
259 |
text.split(/\n+/).map((line, i) => {
|
260 |
line = line.trim();
|
261 |
+
if(line && !/[.?!]$/.test(line)) { line += '.'; }
|
262 |
return `<div class="line-item"><span class="line-number">${i+1}:</span><span class="line-text">${line}</span></div>`;
|
263 |
}).join('');
|
264 |
|
265 |
+
// الحصول على رقم السطر الذي يحتوي على عبارة معينة (مع تحسين حساسية الأحرف والمسافات)
|
266 |
const getLineNumber = (text, substring) => {
|
267 |
+
const regex = new RegExp(escapeRegExp(substring.trim()), 'i');
|
268 |
+
const lines = text.split(/\n+/);
|
269 |
+
for (let i = 0; i < lines.length; i++) {
|
270 |
+
if (regex.test(lines[i])) return i + 1;
|
271 |
+
}
|
272 |
+
return "غير محدد";
|
273 |
};
|
274 |
|
275 |
/* -------------------------------
|
276 |
+
دوال تظليل الاختلافات (باستخدام العلامات المحددة)
|
277 |
------------------------------- */
|
278 |
const applyHighlights = (originalText, analysisOutput) => {
|
279 |
+
let highlightedText = originalText;
|
|
|
280 |
let match;
|
281 |
+
// تظليل النصوص المفقودة
|
282 |
const missingRegex = /__(.*?)__/g;
|
283 |
while ((match = missingRegex.exec(analysisOutput)) !== null) {
|
284 |
+
const phrase = match[1].trim();
|
285 |
+
if (phrase) {
|
286 |
+
const replacement = `<span class="highlight-missing">${phrase}</span>`;
|
287 |
+
const phraseRegex = new RegExp(escapeRegExp(phrase), 'gi');
|
288 |
+
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
289 |
+
}
|
290 |
}
|
291 |
+
// تظليل الأرقام والتواريخ
|
292 |
const numberRegex = /<([^<>]+)>/g;
|
293 |
while ((match = numberRegex.exec(analysisOutput)) !== null) {
|
294 |
+
const phrase = match[1].trim();
|
295 |
+
if (phrase) {
|
296 |
+
const replacement = `<span class="highlight-number">${phrase}</span>`;
|
297 |
+
const phraseRegex = new RegExp(escapeRegExp(phrase), 'gi');
|
298 |
+
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
299 |
+
}
|
300 |
}
|
301 |
+
// تظليل اختلاف المعنى
|
302 |
const meaningRegex = /\[MEANING\](.*?)\[\/MEANING\]/g;
|
303 |
while ((match = meaningRegex.exec(analysisOutput)) !== null) {
|
304 |
+
const phrase = match[1].trim();
|
305 |
+
if (phrase) {
|
306 |
+
const replacement = `<span class="highlight-meaning">${phrase}</span>`;
|
307 |
+
const phraseRegex = new RegExp(escapeRegExp(phrase), 'gi');
|
308 |
+
highlightedText = highlightedText.replace(phraseRegex, replacement);
|
309 |
+
}
|
310 |
}
|
311 |
+
return highlightedText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
};
|
313 |
|
314 |
+
// توليد شرح تفصيلي للاختلافات مع أيقونات مميزة
|
315 |
const generateExplanation = (sourceText, analysisOutput) => {
|
316 |
let steps = [];
|
317 |
let match;
|
|
|
346 |
}
|
347 |
}
|
348 |
if (steps.length === 0) {
|
349 |
+
return `<p><i class="fas fa-check-circle mr-2"></i> النصوص متطابقة ولا يوجد اختلاف يُذكر.</p>`;
|
350 |
}
|
351 |
return `<ol class="list-decimal ml-6 space-y-2">${steps.join('')}</ol>`;
|
352 |
};
|
|
|
443 |
|
444 |
try {
|
445 |
const progressDiv = document.createElement('div');
|
446 |
+
progressDiv.className = "bg-indigo-100 p-4 rounded-xl mb-4";
|
447 |
progressDiv.innerHTML = `<div class="flex items-center">
|
448 |
+
<div class="animate-spin h-6 w-6 border-4 border-indigo-600 rounded-full border-t-transparent mr-3"></div>
|
449 |
<span>جارٍ التحليل...</span>
|
450 |
</div>`;
|
451 |
document.getElementById('errorsList').appendChild(progressDiv);
|