Commit ·
8d2df6d
1
Parent(s): ed2cae2
fix: Move word count to bottom bar + add clickable UI to set word goal - Word count now in status bar next to chars and sentences - Click on 'كلمة' to set word goal via prompt - Badge shows progress e.g. '50% من 500' - Green when goal reached
Browse files- src/index.html +21 -2
src/index.html
CHANGED
|
@@ -488,8 +488,7 @@
|
|
| 488 |
<span class="analyzing-spinner" aria-hidden="true"></span>
|
| 489 |
<span>جاري التحليل...</span>
|
| 490 |
</div>
|
| 491 |
-
|
| 492 |
-
<span id="auto-save-status" class="text-xs text-secondary" style="opacity:0;transition:opacity 0.3s;"></span>
|
| 493 |
<button id="doc-save-btn" class="doc-save-btn-icon btn-ghost" type="button" aria-label="حفظ المستند" title="حفظ">
|
| 494 |
<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>
|
| 495 |
</button>
|
|
@@ -658,6 +657,8 @@
|
|
| 658 |
<span class="stat-item--sep"></span>
|
| 659 |
<span class="stat-item"><span id="char-count">٠</span> حرف</span>
|
| 660 |
<span class="stat-item"><span id="sentence-count">٠</span> جملة</span>
|
|
|
|
|
|
|
| 661 |
<span class="stat-item--sep"></span>
|
| 662 |
<span class="stat-item">⏱ <span id="reading-time">٠</span> د قراءة</span>
|
| 663 |
</div>
|
|
@@ -1142,6 +1143,24 @@
|
|
| 1142 |
el._timer = setTimeout(() => { el.style.opacity = '0'; }, 3000);
|
| 1143 |
}
|
| 1144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1145 |
// Element SDK Integration
|
| 1146 |
async function onConfigChange(cfg) {
|
| 1147 |
config = { ...defaultConfig, ...cfg };
|
|
|
|
| 488 |
<span class="analyzing-spinner" aria-hidden="true"></span>
|
| 489 |
<span>جاري التحليل...</span>
|
| 490 |
</div>
|
| 491 |
+
<span id="auto-save-status" class="text-xs text-secondary" style="opacity:0;transition:opacity 0.3s;"></span>
|
|
|
|
| 492 |
<button id="doc-save-btn" class="doc-save-btn-icon btn-ghost" type="button" aria-label="حفظ المستند" title="حفظ">
|
| 493 |
<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>
|
| 494 |
</button>
|
|
|
|
| 657 |
<span class="stat-item--sep"></span>
|
| 658 |
<span class="stat-item"><span id="char-count">٠</span> حرف</span>
|
| 659 |
<span class="stat-item"><span id="sentence-count">٠</span> جملة</span>
|
| 660 |
+
<span class="stat-item" style="cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتحديد هدف عدد الكلمات"><span id="word-count" class="font-bold">٠</span> كلمة</span>
|
| 661 |
+
<span id="word-goal-indicator" class="word-goal-badge" style="display:none;cursor:pointer;" onclick="setWordGoalUI()" title="اضغط لتغيير الهدف"></span>
|
| 662 |
<span class="stat-item--sep"></span>
|
| 663 |
<span class="stat-item">⏱ <span id="reading-time">٠</span> د قراءة</span>
|
| 664 |
</div>
|
|
|
|
| 1143 |
el._timer = setTimeout(() => { el.style.opacity = '0'; }, 3000);
|
| 1144 |
}
|
| 1145 |
|
| 1146 |
+
// Word count goal UI
|
| 1147 |
+
function setWordGoalUI() {
|
| 1148 |
+
const current = localStorage.getItem('bayan_word_goal') || '0';
|
| 1149 |
+
const input = prompt('حدد هدف عدد الكلمات (أدخل ٠ لإلغاء الهدف):', current);
|
| 1150 |
+
if (input === null) return;
|
| 1151 |
+
const goal = parseInt(input, 10);
|
| 1152 |
+
if (isNaN(goal) || goal < 0) return;
|
| 1153 |
+
localStorage.setItem('bayan_word_goal', String(goal));
|
| 1154 |
+
if (typeof updateEditorStats === 'function') updateEditorStats();
|
| 1155 |
+
if (goal > 0) {
|
| 1156 |
+
if (typeof showToast === 'function') showToast('✓ تم تحديد الهدف: ' + goal + ' كلمة');
|
| 1157 |
+
} else {
|
| 1158 |
+
if (typeof showToast === 'function') showToast('تم إلغاء هدف الكلمات');
|
| 1159 |
+
const el = document.getElementById('word-goal-indicator');
|
| 1160 |
+
if (el) el.style.display = 'none';
|
| 1161 |
+
}
|
| 1162 |
+
}
|
| 1163 |
+
|
| 1164 |
// Element SDK Integration
|
| 1165 |
async function onConfigChange(cfg) {
|
| 1166 |
config = { ...defaultConfig, ...cfg };
|