Spaces:
Running
Running
Update index.html
Browse files- index.html +9 -4
index.html
CHANGED
|
@@ -129,16 +129,21 @@ async function analyze() {
|
|
| 129 |
|
| 130 |
if (!response.ok) throw new Error('تعذر الاتصال بالـ API');
|
| 131 |
|
| 132 |
-
|
| 133 |
const verdict = data?.verdict || "❌ لم يتم الحصول على النتيجة";
|
| 134 |
-
const confidence = Math.round((data?.confidence || 0) * 100);
|
| 135 |
|
| 136 |
-
//
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
| 138 |
|
|
|
|
| 139 |
resultCard.className = 'result-card ' + (isScam ? 'danger' : 'safe');
|
|
|
|
| 140 |
document.getElementById('verdictText').innerText = verdict;
|
| 141 |
document.getElementById('detailsText').innerText = `نسبة الثقة: ${confidence}%`;
|
|
|
|
| 142 |
|
| 143 |
loader.style.display = 'none';
|
| 144 |
btn.disabled = false;
|
|
|
|
| 129 |
|
| 130 |
if (!response.ok) throw new Error('تعذر الاتصال بالـ API');
|
| 131 |
|
| 132 |
+
const data = await response.json();
|
| 133 |
const verdict = data?.verdict || "❌ لم يتم الحصول على النتيجة";
|
|
|
|
| 134 |
|
| 135 |
+
// تعديل نسبة الثقة هنا
|
| 136 |
+
let confValue = data?.confidence || 0;
|
| 137 |
+
|
| 138 |
+
// إذا كان الرقم عشرياً (أصغر من 1) نضربه في 100، وإذا كان كبيراً نأخذه كما هو
|
| 139 |
+
const confidence = confValue <= 1 ? Math.round(confValue * 100) : Math.round(confValue);
|
| 140 |
|
| 141 |
+
const isScam = verdict.includes("احتيال") || verdict.includes("Phishing");
|
| 142 |
resultCard.className = 'result-card ' + (isScam ? 'danger' : 'safe');
|
| 143 |
+
|
| 144 |
document.getElementById('verdictText').innerText = verdict;
|
| 145 |
document.getElementById('detailsText').innerText = `نسبة الثقة: ${confidence}%`;
|
| 146 |
+
|
| 147 |
|
| 148 |
loader.style.display = 'none';
|
| 149 |
btn.disabled = false;
|