Commit ·
7e7ca7c
1
Parent(s): 9c3f41f
ux: Escape closes Quran modal + char counter on dialect textarea (red when >5000)
Browse files- src/index.html +21 -1
src/index.html
CHANGED
|
@@ -859,7 +859,10 @@
|
|
| 859 |
</div>
|
| 860 |
<p class="text-sm mb-4" style="color: var(--text-secondary);">اكتب نصًا بأي لهجة عربية (مصرية، خليجية، شامية...) وسنحوّله إلى لغة عربية فصحى سليمة.</p>
|
| 861 |
</div>
|
| 862 |
-
<textarea id="dialect-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>
|
|
|
|
|
|
|
|
|
|
| 863 |
<button id="dialect-convert-btn" onclick="convertDialect()" class="btn-primary w-full py-4 text-lg mt-4 mb-4" type="button">تحويل إلى الفصحى</button>
|
| 864 |
<div id="dialect-result-card" class="is-hidden" style="background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 1rem; padding: 1.5rem;">
|
| 865 |
<div class="flex items-center justify-between mb-3">
|
|
@@ -1256,6 +1259,16 @@
|
|
| 1256 |
if (typeof showToast === 'function') showToast('✓ تم تطبيق النص الفصيح في المحرر');
|
| 1257 |
}
|
| 1258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1259 |
/* ═══════════════════════════════════════════
|
| 1260 |
Quran Verification & Translation
|
| 1261 |
═══════════════════════════════════════════ */
|
|
@@ -1410,11 +1423,18 @@
|
|
| 1410 |
}
|
| 1411 |
|
| 1412 |
// Ctrl+Q → Quran verification shortcut (e.code works with any keyboard language)
|
|
|
|
| 1413 |
document.addEventListener('keydown', (e) => {
|
| 1414 |
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyQ') {
|
| 1415 |
e.preventDefault();
|
| 1416 |
verifyQuranText();
|
| 1417 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1418 |
});
|
| 1419 |
|
| 1420 |
function copyQuranTranslation() {
|
|
|
|
| 859 |
</div>
|
| 860 |
<p class="text-sm mb-4" style="color: var(--text-secondary);">اكتب نصًا بأي لهجة عربية (مصرية، خليجية، شامية...) وسنحوّله إلى لغة عربية فصحى سليمة.</p>
|
| 861 |
</div>
|
| 862 |
+
<textarea id="dialect-input" class="w-full p-4 rounded-xl text-right text-lg editor-content" dir="rtl" rows="6" placeholder="اكتب النص باللهجة هنا..." oninput="updateDialectCharCount()" style="background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-primary); resize: vertical; font-family: inherit;"></textarea>
|
| 863 |
+
<div class="flex items-center justify-between mt-1 mb-2" dir="rtl">
|
| 864 |
+
<span id="dialect-char-count" class="text-xs" style="color: var(--text-secondary);">٠ / ٥٬٠٠٠ حرف</span>
|
| 865 |
+
</div>
|
| 866 |
<button id="dialect-convert-btn" onclick="convertDialect()" class="btn-primary w-full py-4 text-lg mt-4 mb-4" type="button">تحويل إلى الفصحى</button>
|
| 867 |
<div id="dialect-result-card" class="is-hidden" style="background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 1rem; padding: 1.5rem;">
|
| 868 |
<div class="flex items-center justify-between mb-3">
|
|
|
|
| 1259 |
if (typeof showToast === 'function') showToast('✓ تم تطبيق النص الفصيح في المحرر');
|
| 1260 |
}
|
| 1261 |
|
| 1262 |
+
function updateDialectCharCount() {
|
| 1263 |
+
var input = document.getElementById('dialect-input');
|
| 1264 |
+
var counter = document.getElementById('dialect-char-count');
|
| 1265 |
+
if (!input || !counter) return;
|
| 1266 |
+
var len = input.value.length;
|
| 1267 |
+
var arabicLen = len.toLocaleString('ar-EG');
|
| 1268 |
+
counter.textContent = arabicLen + ' / ٥٬٠٠٠ حرف';
|
| 1269 |
+
counter.style.color = len > 5000 ? '#ef4444' : 'var(--text-secondary)';
|
| 1270 |
+
}
|
| 1271 |
+
|
| 1272 |
/* ═══════════════════════════════════════════
|
| 1273 |
Quran Verification & Translation
|
| 1274 |
═══════════════════════════════════════════ */
|
|
|
|
| 1423 |
}
|
| 1424 |
|
| 1425 |
// Ctrl+Q → Quran verification shortcut (e.code works with any keyboard language)
|
| 1426 |
+
// Escape → Close Quran modal
|
| 1427 |
document.addEventListener('keydown', (e) => {
|
| 1428 |
if ((e.ctrlKey || e.metaKey) && e.code === 'KeyQ') {
|
| 1429 |
e.preventDefault();
|
| 1430 |
verifyQuranText();
|
| 1431 |
}
|
| 1432 |
+
if (e.key === 'Escape') {
|
| 1433 |
+
var modal = document.getElementById('quran-modal');
|
| 1434 |
+
if (modal && !modal.classList.contains('is-hidden')) {
|
| 1435 |
+
closeQuranModal();
|
| 1436 |
+
}
|
| 1437 |
+
}
|
| 1438 |
});
|
| 1439 |
|
| 1440 |
function copyQuranTranslation() {
|