Commit ·
5f053cc
1
Parent(s): 2988a73
audit-v4: 10 fixes and improvements - FIX: Footer replaced with multi-column layout (Product + Resources) - FIX: cta_primary config now matches button text - FIX: Enterprise 'contact sales' button navigates to editor - FIX: Mock editor 'الكتابه' now has spelling-error class (3 errors) - FIX: Status bar updated to '٣ إملائي' - FIX: Scroll-to-top fallback to window.scrollY - FIX: Remove @view-transition experimental CSS - FIX: Remove injected Cloudflare challenge script - ADD: Toast on applyCorrection + applyAllSuggestions - ADD: confirm() on applyAllSuggestions - ADD: Smart empty state (no text vs no errors) - ADD: Toggle switch HTML for summary checkbox
Browse files- src/index.html +13 -12
- src/js/editor.js +3 -0
- src/js/ui.js +6 -4
src/index.html
CHANGED
|
@@ -16,7 +16,6 @@
|
|
| 16 |
<link rel="stylesheet" href="/css/base.css">
|
| 17 |
<link rel="stylesheet" href="/css/components.css">
|
| 18 |
|
| 19 |
-
<style>@view-transition { navigation: auto; }</style>
|
| 20 |
<script src="/js/vendor/supabase.min.js"></script>
|
| 21 |
<script src="/js/auth/config.js"></script>
|
| 22 |
<script src="/js/auth/client.js"></script>
|
|
@@ -207,14 +206,14 @@
|
|
| 207 |
<div class="w-20"></div>
|
| 208 |
</div><!-- Mock Editor Content -->
|
| 209 |
<div class="p-8 editor-content text-right text-lg" dir="rtl" style="background: var(--surface-color); color: var(--text-color); min-height: 300px;">
|
| 210 |
-
<p class="mb-4">الكتابه <span class="spelling-error">الصحيحه</span> مهمة جداً في التواصل الفعّال<span class="punctuation-suggestion">.</span></p>
|
| 211 |
<p class="mb-4">الطلاب <span class="grammar-error">ذهبوا</span> <span class="spelling-error">الى</span> المدرسة صباحاً<span class="punctuation-suggestion">.</span></p>
|
| 212 |
<p>جرّب المحرر الآن وشاهد كيف يمكن أن تصبح كتابتك أفضل!</p>
|
| 213 |
</div><!-- Mock Stats Bar -->
|
| 214 |
<div class="flex items-center justify-between p-4 border-t" style="border-color: rgba(255, 255, 255, 0.1);">
|
| 215 |
<div class="flex items-center gap-6">
|
| 216 |
<div class="flex items-center gap-2">
|
| 217 |
-
<div class="w-3 h-3 rounded-full" style="background: #ef4444;"></div><span class="text-sm" style="color: var(--text-secondary);">
|
| 218 |
</div>
|
| 219 |
<div class="flex items-center gap-2">
|
| 220 |
<div class="w-3 h-3 rounded-full" style="background: #fbbf24;"></div><span class="text-sm" style="color: var(--text-secondary);">١ نحوي</span>
|
|
@@ -630,7 +629,7 @@
|
|
| 630 |
</div>
|
| 631 |
<div class="mb-6">
|
| 632 |
<label class="flex items-center gap-3 cursor-pointer">
|
| 633 |
-
<input type="checkbox" id="full-text-summary" class="
|
| 634 |
<span class="text-base font-bold">تلخيص النص كاملاً</span>
|
| 635 |
</label>
|
| 636 |
</div>
|
|
@@ -851,7 +850,7 @@
|
|
| 851 |
<li class="flex items-center gap-3">
|
| 852 |
<svg class="w-5 h-5" style="color: #22c55e;" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
| 853 |
</svg><span class="text-base">دعم فني ذو أولوية</span></li>
|
| 854 |
-
</ul><button class="w-full py-4 rounded-2xl text-lg font-bold border-2 transition-all hover:scale-105" style="border-color: rgba(255, 255, 255, 0.2); color: var(--text-color);"> تواصل مع المبيعات </button>
|
| 855 |
</div>
|
| 856 |
</div>
|
| 857 |
</div>
|
|
@@ -895,13 +894,15 @@
|
|
| 895 |
// Scroll to top
|
| 896 |
(function() {
|
| 897 |
const btn = document.getElementById('scroll-top-btn');
|
| 898 |
-
const
|
| 899 |
-
if (!btn
|
| 900 |
-
|
| 901 |
-
|
|
|
|
|
|
|
| 902 |
});
|
| 903 |
btn.addEventListener('click', () => {
|
| 904 |
-
|
| 905 |
});
|
| 906 |
})();
|
| 907 |
|
|
@@ -910,7 +911,7 @@
|
|
| 910 |
brand_name: 'بيان',
|
| 911 |
hero_headline: 'اكتب العربية بثقة واحتراف',
|
| 912 |
hero_subheadline: 'مساعد ذكي يصحح الإملاء والنحو وعلامات الترقيم ويُلخّص النصوص العربية بدقة عالية.',
|
| 913 |
-
cta_primary: '
|
| 914 |
primary_color: '#6BA3E0',
|
| 915 |
secondary_color: '#A594E8',
|
| 916 |
font_family: 'Cairo',
|
|
@@ -1210,5 +1211,5 @@
|
|
| 1210 |
}
|
| 1211 |
});
|
| 1212 |
</script>
|
| 1213 |
-
<
|
| 1214 |
</html>
|
|
|
|
| 16 |
<link rel="stylesheet" href="/css/base.css">
|
| 17 |
<link rel="stylesheet" href="/css/components.css">
|
| 18 |
|
|
|
|
| 19 |
<script src="/js/vendor/supabase.min.js"></script>
|
| 20 |
<script src="/js/auth/config.js"></script>
|
| 21 |
<script src="/js/auth/client.js"></script>
|
|
|
|
| 206 |
<div class="w-20"></div>
|
| 207 |
</div><!-- Mock Editor Content -->
|
| 208 |
<div class="p-8 editor-content text-right text-lg" dir="rtl" style="background: var(--surface-color); color: var(--text-color); min-height: 300px;">
|
| 209 |
+
<p class="mb-4"><span class="spelling-error">الكتابه</span> <span class="spelling-error">الصحيحه</span> مهمة جداً في التواصل الفعّال<span class="punctuation-suggestion">.</span></p>
|
| 210 |
<p class="mb-4">الطلاب <span class="grammar-error">ذهبوا</span> <span class="spelling-error">الى</span> المدرسة صباحاً<span class="punctuation-suggestion">.</span></p>
|
| 211 |
<p>جرّب المحرر الآن وشاهد كيف يمكن أن تصبح كتابتك أفضل!</p>
|
| 212 |
</div><!-- Mock Stats Bar -->
|
| 213 |
<div class="flex items-center justify-between p-4 border-t" style="border-color: rgba(255, 255, 255, 0.1);">
|
| 214 |
<div class="flex items-center gap-6">
|
| 215 |
<div class="flex items-center gap-2">
|
| 216 |
+
<div class="w-3 h-3 rounded-full" style="background: #ef4444;"></div><span class="text-sm" style="color: var(--text-secondary);">٣ إملائي</span>
|
| 217 |
</div>
|
| 218 |
<div class="flex items-center gap-2">
|
| 219 |
<div class="w-3 h-3 rounded-full" style="background: #fbbf24;"></div><span class="text-sm" style="color: var(--text-secondary);">١ نحوي</span>
|
|
|
|
| 629 |
</div>
|
| 630 |
<div class="mb-6">
|
| 631 |
<label class="flex items-center gap-3 cursor-pointer">
|
| 632 |
+
<label class="toggle-switch"><input type="checkbox" id="full-text-summary"><span class="toggle-slider"></span></label>
|
| 633 |
<span class="text-base font-bold">تلخيص النص كاملاً</span>
|
| 634 |
</label>
|
| 635 |
</div>
|
|
|
|
| 850 |
<li class="flex items-center gap-3">
|
| 851 |
<svg class="w-5 h-5" style="color: #22c55e;" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
|
| 852 |
</svg><span class="text-base">دعم فني ذو أولوية</span></li>
|
| 853 |
+
</ul><button onclick="showPage('editor')" class="w-full py-4 rounded-2xl text-lg font-bold border-2 transition-all hover:scale-105" style="border-color: rgba(255, 255, 255, 0.2); color: var(--text-color);"> تواصل مع المبيعات </button>
|
| 854 |
</div>
|
| 855 |
</div>
|
| 856 |
</div>
|
|
|
|
| 894 |
// Scroll to top
|
| 895 |
(function() {
|
| 896 |
const btn = document.getElementById('scroll-top-btn');
|
| 897 |
+
const sc = document.querySelector('.h-full.overflow-auto') || document.documentElement;
|
| 898 |
+
if (!btn) return;
|
| 899 |
+
const target = sc === document.documentElement ? window : sc;
|
| 900 |
+
(sc === document.documentElement ? window : sc).addEventListener('scroll', () => {
|
| 901 |
+
const st = sc === document.documentElement ? window.scrollY : sc.scrollTop;
|
| 902 |
+
btn.classList.toggle('visible', st > 400);
|
| 903 |
});
|
| 904 |
btn.addEventListener('click', () => {
|
| 905 |
+
(sc === document.documentElement ? window : sc).scrollTo({ top: 0, behavior: 'smooth' });
|
| 906 |
});
|
| 907 |
})();
|
| 908 |
|
|
|
|
| 911 |
brand_name: 'بيان',
|
| 912 |
hero_headline: 'اكتب العربية بثقة واحتراف',
|
| 913 |
hero_subheadline: 'مساعد ذكي يصحح الإملاء والنحو وعلامات الترقيم ويُلخّص النصوص العربية بدقة عالية.',
|
| 914 |
+
cta_primary: 'جربه الآن مجاناً',
|
| 915 |
primary_color: '#6BA3E0',
|
| 916 |
secondary_color: '#A594E8',
|
| 917 |
font_family: 'Cairo',
|
|
|
|
| 1211 |
}
|
| 1212 |
});
|
| 1213 |
</script>
|
| 1214 |
+
</body>
|
| 1215 |
</html>
|
src/js/editor.js
CHANGED
|
@@ -362,6 +362,7 @@ function applySuggestionAtOffsets(suggestion) {
|
|
| 362 |
function applyCorrection() {
|
| 363 |
if (!window.currentApplySuggestion) return;
|
| 364 |
applySuggestionAtOffsets(window.currentApplySuggestion);
|
|
|
|
| 365 |
}
|
| 366 |
|
| 367 |
function applyAlternativeCorrection(suggestion, correctionText) {
|
|
@@ -445,6 +446,7 @@ function applySuggestionByIndex(index) {
|
|
| 445 |
function applyAllSuggestions() {
|
| 446 |
const suggestions = [...(window.currentSuggestions || [])].sort((a, b) => b.start - a.start);
|
| 447 |
if (suggestions.length === 0) return;
|
|
|
|
| 448 |
|
| 449 |
let text = getEditorText();
|
| 450 |
suggestions.forEach((s) => {
|
|
@@ -454,6 +456,7 @@ function applyAllSuggestions() {
|
|
| 454 |
setEditorHTML(escapeHtml(text));
|
| 455 |
hideTooltip();
|
| 456 |
analyzeTextDelayed();
|
|
|
|
| 457 |
}
|
| 458 |
|
| 459 |
function clearEditor() {
|
|
|
|
| 362 |
function applyCorrection() {
|
| 363 |
if (!window.currentApplySuggestion) return;
|
| 364 |
applySuggestionAtOffsets(window.currentApplySuggestion);
|
| 365 |
+
if (typeof showToast === 'function') showToast('✓ تم التصحيح');
|
| 366 |
}
|
| 367 |
|
| 368 |
function applyAlternativeCorrection(suggestion, correctionText) {
|
|
|
|
| 446 |
function applyAllSuggestions() {
|
| 447 |
const suggestions = [...(window.currentSuggestions || [])].sort((a, b) => b.start - a.start);
|
| 448 |
if (suggestions.length === 0) return;
|
| 449 |
+
if (!confirm('هل تريد تطبيق جميع التصحيحات (' + suggestions.length + ')؟')) return;
|
| 450 |
|
| 451 |
let text = getEditorText();
|
| 452 |
suggestions.forEach((s) => {
|
|
|
|
| 456 |
setEditorHTML(escapeHtml(text));
|
| 457 |
hideTooltip();
|
| 458 |
analyzeTextDelayed();
|
| 459 |
+
if (typeof showToast === 'function') showToast('✓ تم تطبيق ' + suggestions.length + ' تصحيح');
|
| 460 |
}
|
| 461 |
|
| 462 |
function clearEditor() {
|
src/js/ui.js
CHANGED
|
@@ -99,15 +99,17 @@ function updateSuggestionsList(suggestions) {
|
|
| 99 |
const applyAllSheet = document.getElementById('apply-all-sheet');
|
| 100 |
|
| 101 |
if (!suggestions || suggestions.length === 0) {
|
|
|
|
|
|
|
| 102 |
const emptyHTML = `
|
| 103 |
<div class="empty-state">
|
| 104 |
-
<div class="empty-state__icon">
|
| 105 |
<svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 106 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
| 107 |
</svg>
|
| 108 |
</div>
|
| 109 |
-
<div class="empty-state__title">لا توجد اقتراحات</div>
|
| 110 |
-
<div class="empty-state__desc">ابدأ بكتابة نص عربي وسيتم تحليله تلقائياً</div>
|
| 111 |
</div>`;
|
| 112 |
|
| 113 |
lists.forEach((el) => { el.innerHTML = emptyHTML; });
|
|
|
|
| 99 |
const applyAllSheet = document.getElementById('apply-all-sheet');
|
| 100 |
|
| 101 |
if (!suggestions || suggestions.length === 0) {
|
| 102 |
+
const editorText = typeof getEditorText === 'function' ? getEditorText().trim() : '';
|
| 103 |
+
const hasText = editorText.length > 0;
|
| 104 |
const emptyHTML = `
|
| 105 |
<div class="empty-state">
|
| 106 |
+
<div class="empty-state__icon" style="color: ${hasText ? '#22c55e' : 'var(--text-secondary)'}">
|
| 107 |
<svg width="24" height="24" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 108 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="${hasText ? 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z' : 'M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z'}"/>
|
| 109 |
</svg>
|
| 110 |
</div>
|
| 111 |
+
<div class="empty-state__title">${hasText ? 'نصك ممتاز!' : 'لا توجد اقتراحات'}</div>
|
| 112 |
+
<div class="empty-state__desc">${hasText ? 'لم نجد أي أخطاء — أحسنت! ✨' : 'ابدأ بكتابة نص عربي وسيتم تحليله تلقائياً'}</div>
|
| 113 |
</div>`;
|
| 114 |
|
| 115 |
lists.forEach((el) => { el.innerHTML = emptyHTML; });
|