Spaces:
Running
Running
Update index.html
Browse files- index.html +189 -136
index.html
CHANGED
|
@@ -1,192 +1,245 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>مترجم اللغة الأمازيغية
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
-
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap" rel="stylesheet">
|
| 9 |
<style>
|
| 10 |
body {
|
| 11 |
font-family: 'Tajawal', sans-serif;
|
| 12 |
-
background-color: #
|
| 13 |
}
|
| 14 |
.tifinagh-font {
|
| 15 |
-
font-family: 'Segoe UI Historic', 'Ebrima', sans-serif;
|
|
|
|
| 16 |
}
|
| 17 |
-
.
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
border-radius: 50%;
|
| 21 |
-
display: inline-block;
|
| 22 |
}
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
</style>
|
| 29 |
</head>
|
| 30 |
<body class="min-h-screen flex flex-col">
|
| 31 |
|
| 32 |
-
<
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
<
|
| 36 |
-
<p class="mt-2 text-blue-100">قاعدة البيانات: dictionary (1).json</p>
|
| 37 |
-
<div id="dbStatus" class="mt-3 text-sm inline-flex items-center bg-blue-800 px-3 py-1 rounded-full">
|
| 38 |
-
<span id="statusDot" class="status-dot bg-red-500 ml-2"></span>
|
| 39 |
-
<span id="statusText">جاري تحميل البيانات...</span>
|
| 40 |
-
</div>
|
| 41 |
</div>
|
| 42 |
</header>
|
| 43 |
|
| 44 |
-
<
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
<
|
| 54 |
-
</
|
| 55 |
</div>
|
| 56 |
|
| 57 |
-
<div class="
|
| 58 |
-
<
|
| 59 |
-
<
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
<
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
</select>
|
| 69 |
-
</div>
|
| 70 |
-
</div>
|
| 71 |
-
|
| 72 |
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-0">
|
| 73 |
-
<div class="p-4 border-l">
|
| 74 |
-
<label class="block mb-2 text-xs font-bold text-blue-600 uppercase">النص المراد بحثه:</label>
|
| 75 |
-
<textarea id="sourceText" rows="6" class="w-full p-3 text-lg border-0 focus:ring-0 outline-none resize-none" placeholder="اكتب الكلمة هنا..."></textarea>
|
| 76 |
-
</div>
|
| 77 |
-
<div class="p-4 bg-blue-50/30">
|
| 78 |
-
<label class="block mb-2 text-xs font-bold text-blue-600 uppercase">النتيجة من القاموس:</label>
|
| 79 |
-
<div id="targetText" class="w-full p-3 text-2xl font-bold text-blue-900 tifinagh-font">
|
| 80 |
-
...
|
| 81 |
</div>
|
| 82 |
</div>
|
| 83 |
</div>
|
| 84 |
|
| 85 |
-
<
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
</button>
|
| 89 |
-
<div class="flex flex-col items-end">
|
| 90 |
-
<span id="wordCount" class="text-[10px] text-gray-400 font-bold uppercase tracking-wider">عدد المدخلات: 0</span>
|
| 91 |
-
<button id="toggleKbd" class="text-blue-600 hover:text-blue-800 text-xs font-bold mt-1">لوحة التيفيناغ</button>
|
| 92 |
-
</div>
|
| 93 |
</div>
|
| 94 |
|
| 95 |
-
<
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
</div>
|
| 98 |
</div>
|
| 99 |
</main>
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
<script>
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
const wordCountDisplay = document.getElementById('wordCount');
|
|
|
|
| 108 |
|
| 109 |
-
|
| 110 |
-
function clean(str) {
|
| 111 |
-
return str ? str.toString().trim() : "";
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
// جلب ملف الـ JSON
|
| 115 |
-
async function fetchDictionary() {
|
| 116 |
-
const fileName = "dictionary (1).json";
|
| 117 |
-
try {
|
| 118 |
-
const response = await fetch(encodeURIComponent(fileName));
|
| 119 |
-
if (!response.ok) throw new Error("File not found");
|
| 120 |
-
|
| 121 |
-
const data = await response.json();
|
| 122 |
-
|
| 123 |
-
// معالجة البيانات لتناسب الصيغة المطلوبة { AR: "...", TAM: "..." }
|
| 124 |
-
dictionary = data.map(item => ({
|
| 125 |
-
ar: clean(item.AR),
|
| 126 |
-
tam: clean(item.TAM)
|
| 127 |
-
})).filter(item => item.ar && item.tam);
|
| 128 |
-
|
| 129 |
-
statusDot.className = "status-dot bg-green-500 ml-2";
|
| 130 |
-
statusText.innerText = "قاعدة البيانات متصلة (JSON)";
|
| 131 |
-
wordCountDisplay.innerText = `عدد المدخلات: ${dictionary.length}`;
|
| 132 |
-
targetOutput.innerText = "ابحث عن كلمة...";
|
| 133 |
-
} catch (error) {
|
| 134 |
-
statusDot.className = "status-dot bg-red-500 ml-2";
|
| 135 |
-
statusText.innerText = "فشل تحميل الملف dictionary (1).json";
|
| 136 |
-
targetOutput.innerText = "يرجى التأكد من وجود ملف JSON في نفس المجلد.";
|
| 137 |
-
}
|
| 138 |
-
}
|
| 139 |
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
if (
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
return;
|
| 146 |
}
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
item.
|
|
|
|
| 152 |
);
|
| 153 |
|
| 154 |
-
if (
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
<
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
} else {
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
}
|
|
|
|
|
|
|
| 164 |
}
|
| 165 |
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
const kbdContainer = document.getElementById('kbdButtons');
|
| 169 |
-
|
|
|
|
| 170 |
const btn = document.createElement('button');
|
| 171 |
-
btn.className = "bg-white
|
| 172 |
-
btn.
|
| 173 |
-
btn.onclick = () => {
|
| 174 |
-
sourceInput.value += char;
|
| 175 |
-
|
| 176 |
sourceInput.focus();
|
| 177 |
};
|
| 178 |
kbdContainer.appendChild(btn);
|
| 179 |
});
|
| 180 |
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
document.getElementById('
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
-
// التحميل عند بدء الصفحة
|
| 189 |
-
window.onload = fetchDictionary;
|
| 190 |
</script>
|
| 191 |
</body>
|
| 192 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
<html lang="ar" dir="rtl">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>مترجم اللغة الأمازيغية</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap" rel="stylesheet">
|
| 9 |
<style>
|
| 10 |
body {
|
| 11 |
font-family: 'Tajawal', sans-serif;
|
| 12 |
+
background-color: #f0f2f5;
|
| 13 |
}
|
| 14 |
.tifinagh-font {
|
| 15 |
+
font-family: 'Segoe UI Historic', 'Ebrima', 'Noto Sans Tifinagh', sans-serif;
|
| 16 |
+
letter-spacing: 1px;
|
| 17 |
}
|
| 18 |
+
.result-card {
|
| 19 |
+
transition: all 0.3s ease;
|
| 20 |
+
border-right: 5px solid transparent;
|
|
|
|
|
|
|
| 21 |
}
|
| 22 |
+
.result-card:hover {
|
| 23 |
+
border-right-color: #1d4ed8;
|
| 24 |
+
background-color: #f1f5f9;
|
| 25 |
+
transform: translateX(-5px);
|
| 26 |
+
}
|
| 27 |
+
/* تحسين مظهر التمرير */
|
| 28 |
+
#targetText::-webkit-scrollbar {
|
| 29 |
+
width: 8px;
|
| 30 |
+
}
|
| 31 |
+
#targetText::-webkit-scrollbar-track {
|
| 32 |
+
background: #f1f1f1;
|
| 33 |
+
}
|
| 34 |
+
#targetText::-webkit-scrollbar-thumb {
|
| 35 |
+
background: #94a3b8;
|
| 36 |
+
border-radius: 10px;
|
| 37 |
+
}
|
| 38 |
+
.highlight {
|
| 39 |
+
background-color: #fde047;
|
| 40 |
+
font-weight: 800;
|
| 41 |
+
padding: 0 2px;
|
| 42 |
+
border-radius: 2px;
|
| 43 |
+
}
|
| 44 |
+
/* خط غليظ مخصص للنتائج */
|
| 45 |
+
.font-bold-custom {
|
| 46 |
+
font-weight: 800;
|
| 47 |
}
|
| 48 |
</style>
|
| 49 |
</head>
|
| 50 |
<body class="min-h-screen flex flex-col">
|
| 51 |
|
| 52 |
+
<header class="bg-blue-800 text-white pt-8 pb-12 shadow-lg">
|
| 53 |
+
<div class="container mx-auto text-center px-4">
|
| 54 |
+
<h1 class="text-4xl font-extrabold mb-2">المعجم الأمازيغي التفاعلي</h1>
|
| 55 |
+
<p class="text-blue-100 opacity-90 text-lg">البحث الفوري بخطوط واضحة وعريضة</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
</div>
|
| 57 |
</header>
|
| 58 |
|
| 59 |
+
<main class="flex-grow container mx-auto p-4 -mt-8">
|
| 60 |
+
<div class="max-w-4xl mx-auto">
|
| 61 |
+
<!-- صندوق البحث -->
|
| 62 |
+
<div class="bg-white rounded-t-2xl shadow-2xl p-6 border-b">
|
| 63 |
+
<div class="relative">
|
| 64 |
+
<textarea id="sourceInput" rows="2"
|
| 65 |
+
class="w-full p-4 text-2xl font-bold border-2 border-blue-100 rounded-xl focus:border-blue-600 focus:ring-0 outline-none transition-all resize-none shadow-sm"
|
| 66 |
+
placeholder="اكتب هنا للبحث..."></textarea>
|
| 67 |
+
<div id="loader" class="absolute left-4 top-4 hidden">
|
| 68 |
+
<div class="animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"></div>
|
| 69 |
+
</div>
|
| 70 |
</div>
|
| 71 |
|
| 72 |
+
<div class="flex justify-between items-center mt-4">
|
| 73 |
+
<div class="flex gap-2">
|
| 74 |
+
<button id="clearBtn" class="px-5 py-2 text-sm font-bold text-red-600 hover:bg-red-50 rounded-lg transition-colors border border-red-100">
|
| 75 |
+
مسح البحث
|
| 76 |
+
</button>
|
| 77 |
+
<button id="toggleKbd" class="px-5 py-2 text-sm font-bold text-blue-700 border border-blue-200 hover:bg-blue-50 rounded-lg transition-colors">
|
| 78 |
+
لوحة تيفيناغ
|
| 79 |
+
</button>
|
| 80 |
+
</div>
|
| 81 |
+
<div id="wordCount" class="text-xs font-black text-blue-900 bg-blue-50 px-4 py-1.5 rounded-full border border-blue-100">
|
| 82 |
+
جاري التحميل...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
</div>
|
| 84 |
</div>
|
| 85 |
</div>
|
| 86 |
|
| 87 |
+
<!-- لوحة مفاتيح تيفيناغ -->
|
| 88 |
+
<div id="tifinaghKeyboard" class="hidden bg-white border-x p-5 transition-all shadow-inner">
|
| 89 |
+
<div class="flex flex-wrap gap-2 justify-center" id="kbdButtons"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
</div>
|
| 91 |
|
| 92 |
+
<!-- منطقة النتائج -->
|
| 93 |
+
<div id="targetText" class="bg-white rounded-b-2xl shadow-2xl min-h-[450px] max-h-[600px] overflow-y-auto p-3">
|
| 94 |
+
<div class="flex flex-col items-center justify-center h-full text-gray-400 py-20">
|
| 95 |
+
<svg class="w-20 h-20 mb-4 opacity-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 96 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
| 97 |
+
</svg>
|
| 98 |
+
<p class="text-xl font-bold">ابدأ الكتابة لعرض النتائج بخط عريض</p>
|
| 99 |
+
</div>
|
| 100 |
</div>
|
| 101 |
</div>
|
| 102 |
</main>
|
| 103 |
|
| 104 |
+
<footer class="mt-8 pb-8 text-center text-gray-500">
|
| 105 |
+
<p class="text-sm font-bold">المعجم الأمازيغي الشامل © 2024</p>
|
| 106 |
+
</footer>
|
| 107 |
+
|
| 108 |
<script>
|
| 109 |
+
const dictionary = [
|
| 110 |
+
{"AR": "كتاب", "TAM": "ⴰⴷⵍⵉⵙ"},
|
| 111 |
+
{"AR": "قلم رصاص", "TAM": "ⴰⴽⵕⵕⵊ"},
|
| 112 |
+
{"AR": "المحفظة", "TAM": "ⴰⵇⵇⵕⴰⴱ/ⵜⴰⵛⵛⴽⴰⵕⵜ"},
|
| 113 |
+
{"AR": "دفتر", "TAM": "ⴰⵍⵓⴳ"},
|
| 114 |
+
{"AR": "تباشر", "TAM": "ⴰⵏⴳﻤⵉⵔⵙ"},
|
| 115 |
+
{"AR": "قلم جاف", "TAM": "ⴰⵖⴰⵏⵉﺐ"},
|
| 116 |
+
{"AR": "منجرة", "TAM": "ⵜⴰⵙⵔⵔⴰⵎⵜ"},
|
| 117 |
+
{"AR": "لساق", "TAM": "ⴰ��ⵍⵖⴰⵖ"},
|
| 118 |
+
{"AR": "لوحة", "TAM": "ⵜⵉⴼⵉيلت"},
|
| 119 |
+
{"AR": "مسطرة", "TAM": "ⵜⴰⵖⴷⴰ"},
|
| 120 |
+
{"AR": "وزرة", "TAM": "ⵜⴰⴱﻨⴽⴰ"},
|
| 121 |
+
{"AR": "ممحاة", "TAM": "ⵜⴰⵚⴼⴼⴰⴹⵜ"},
|
| 122 |
+
{"AR": "السبورة", "TAM": "ⵜⴰⴼⵍⵡⵉⵜ"},
|
| 123 |
+
{"AR": "الوزير", "TAM": "ⴰⵎⴰⵡⴰⵙ- ⴰⵏⴼﻠⴰⵙ"},
|
| 124 |
+
{"AR": "السلطة - الحكومة", "TAM": "ⵜⴰନⴱⴰⴹⵜ"},
|
| 125 |
+
{"AR": "الحكم / الحكام", "TAM": "ⴰⵏⴱⴰⴹن / ⵉⵏⴱⴰⴹن"},
|
| 126 |
+
{"AR": "القائد", "TAM": "ⵎⵣⵓⴰⵔ"},
|
| 127 |
+
{"AR": "الزعيم", "TAM": "ⴰⵎⴰⵍⵓⴰⵢ - ⴰଖⴰⵜⴰⵔ"},
|
| 128 |
+
{"AR": "الرئيس", "TAM": "ⴰⵙⵍⵓⴰⵢ"},
|
| 129 |
+
{"AR": "التاريخ", "TAM": "ⴰⵎⵣⵔⵓⵢ"},
|
| 130 |
+
{"AR": "المؤرخ", "TAM": "ⴰⵎⴰⵣⵔⴰⵢ"},
|
| 131 |
+
{"AR": "تاريخي", "TAM": "ⴰⵎⴰⵣⵔⴰⵢ"},
|
| 132 |
+
{"AR": "أسطورة", "TAM": "ⵡⵎⵢⴰ - ⴷⵢⵎⵢⵏ"},
|
| 133 |
+
{"AR": "السنة / السنوات", "TAM": "ⴰⵙⴳⴳⴰⵙ / ⵉⵙⴳⴳⵯⴰⵙن"},
|
| 134 |
+
{"AR": "أبيض", "TAM": "ⵓⵎⵍⵉⵍ / ⴰⵎⵍⵍⴰⵍ"},
|
| 135 |
+
{"AR": "أسود", "TAM": "ⵓⵏⴳⴰⵍ / ⴰⵙⴳⴳⴰن / ⴰⴱﺨﺨⴰن"},
|
| 136 |
+
{"AR": "أصفر", "TAM": "ⴰⵡⵔⴰⵖ"},
|
| 137 |
+
{"AR": "أخضر", "TAM": "ⴰⴷⴰⵍ / ⴰⵣⵉⴳⵣⴰⵡ / ⴰⵣⵉⵣⴰⵡ"},
|
| 138 |
+
{"AR": "أزرق", "TAM": "ⴰⵣⵔⵡⴰⵍ / ⴰⵊⵏⵊⴰⵍⵉⵢ"},
|
| 139 |
+
{"AR": "بنفسجي", "TAM": "ⴰⵎⴰⴳⵥⴰⵢ"},
|
| 140 |
+
{"AR": "وردي", "TAM": "ⴰⵣⵡⵉⵡⵉⵖ"},
|
| 141 |
+
{"AR": "بني", "TAM": "ⴰⵡⵔⴰⵙ"},
|
| 142 |
+
{"AR": "برتقالي", "TAM": "ⴰⵍⵜⵛⵛⵉⵏⵉ / ⴰⵍⵉⵎⵓنⵉ"},
|
| 143 |
+
{"AR": "الهوية", "TAM": "ⵜⴰⵎⴰⴳⵉⵜ / ⴰⵙⵍⴰⵢ"},
|
| 144 |
+
{"AR": "الجنسية", "TAM": "ⵜⴰⵖⵍⴰⵏⵜ"},
|
| 145 |
+
{"AR": "التراث", "TAM": "ⵜⵉⵏⴽⵉⵙⵉ / ⵜⴰⵢⵙⵉ"},
|
| 146 |
+
{"AR": "الحضارة", "TAM": "ⵜⴰⵖⵔⵎⴰ"},
|
| 147 |
+
{"AR": "المجتمع", "TAM": "ⴰⵎⵓن"},
|
| 148 |
+
{"AR": "الشعب", "TAM": "ⴰⵎⴰⴷⴰن / ⴰⵖⵔⵉⴼ"},
|
| 149 |
+
{"AR": "المقاومة", "TAM": "ⵜⴰⵏⵣⴱⴰⵢⵜ"},
|
| 150 |
+
{"AR": "الاستقلال", "TAM": "ⴰⵣⵔⵓⴳ"},
|
| 151 |
+
{"AR": "العدل", "TAM": "ⵜⴰⵏⵣⴳⴰⵎⵜ / ⴰⵣⵔⴼ"}
|
| 152 |
+
];
|
| 153 |
+
|
| 154 |
+
const sourceInput = document.getElementById('sourceInput');
|
| 155 |
+
const targetText = document.getElementById('targetText');
|
| 156 |
const wordCountDisplay = document.getElementById('wordCount');
|
| 157 |
+
const loader = document.getElementById('loader');
|
| 158 |
|
| 159 |
+
wordCountDisplay.innerText = `عدد المصطلحات: ${dictionary.length}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
+
function handleSearch() {
|
| 162 |
+
const query = sourceInput.value.trim().toLowerCase();
|
| 163 |
+
|
| 164 |
+
if (query.length === 0) {
|
| 165 |
+
targetText.innerHTML = `
|
| 166 |
+
<div class="flex flex-col items-center justify-center h-full text-gray-400 py-20">
|
| 167 |
+
<svg class="w-20 h-20 mb-4 opacity-10" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 168 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
|
| 169 |
+
</svg>
|
| 170 |
+
<p class="text-xl font-bold">ابدأ الكتابة لعرض النتائج بخط عريض</p>
|
| 171 |
+
</div>`;
|
| 172 |
return;
|
| 173 |
}
|
| 174 |
|
| 175 |
+
loader.classList.remove('hidden');
|
| 176 |
+
|
| 177 |
+
const filtered = dictionary.filter(item =>
|
| 178 |
+
item.AR.toLowerCase().includes(query) ||
|
| 179 |
+
item.TAM.toLowerCase().includes(query)
|
| 180 |
);
|
| 181 |
|
| 182 |
+
if (filtered.length > 0) {
|
| 183 |
+
const html = filtered.map(item => `
|
| 184 |
+
<div class="result-card p-5 border-b last:border-0 hover:shadow-md cursor-default">
|
| 185 |
+
<div class="flex justify-between items-center gap-4">
|
| 186 |
+
<div class="flex-1">
|
| 187 |
+
<div class="text-[10px] font-black text-blue-400 uppercase tracking-widest mb-1">الكلمة العربية</div>
|
| 188 |
+
<div class="text-2xl font-black text-gray-900 leading-tight">${highlightText(item.AR, query)}</div>
|
| 189 |
+
</div>
|
| 190 |
+
<div class="flex-1 text-left border-r border-gray-100 pr-4">
|
| 191 |
+
<div class="text-[10px] font-black text-green-500 uppercase tracking-widest mb-1">تيفيناغ</div>
|
| 192 |
+
<div class="text-3xl font-bold-custom text-blue-800 tifinagh-font leading-normal">${highlightText(item.TAM, query)}</div>
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
</div>
|
| 196 |
+
`).join('');
|
| 197 |
+
targetText.innerHTML = html;
|
| 198 |
} else {
|
| 199 |
+
targetText.innerHTML = `
|
| 200 |
+
<div class="p-20 text-center">
|
| 201 |
+
<div class="text-5xl mb-4 opacity-20">🔍</div>
|
| 202 |
+
<div class="text-gray-500 font-bold text-lg">لا توجد نتائج لـ "${query}"</div>
|
| 203 |
+
</div>`;
|
| 204 |
}
|
| 205 |
+
|
| 206 |
+
loader.classList.add('hidden');
|
| 207 |
}
|
| 208 |
|
| 209 |
+
function highlightText(text, query) {
|
| 210 |
+
if (!query) return text;
|
| 211 |
+
const re = new RegExp(`(${query})`, "gi");
|
| 212 |
+
return text.replace(re, `<span class="highlight">$1</span>`);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
const alphabet = "ⴰⴱⴳⴷⴹⴻⴼⴽⵯⵀⵃⵄⵅⵇⵉⵊⵍⵎⵏⵓⵔⵕⵙⵚⵜⵟⵡⵢⵣⵥ";
|
| 216 |
const kbdContainer = document.getElementById('kbdButtons');
|
| 217 |
+
|
| 218 |
+
alphabet.split('').forEach(char => {
|
| 219 |
const btn = document.createElement('button');
|
| 220 |
+
btn.className = "bg-white hover:bg-blue-700 hover:text-white w-14 h-14 flex items-center justify-center rounded-xl border-2 border-gray-100 text-2xl transition-all active:scale-95 font-black tifinagh-font shadow-sm";
|
| 221 |
+
btn.textContent = char;
|
| 222 |
+
btn.onclick = () => {
|
| 223 |
+
sourceInput.value += char;
|
| 224 |
+
handleSearch();
|
| 225 |
sourceInput.focus();
|
| 226 |
};
|
| 227 |
kbdContainer.appendChild(btn);
|
| 228 |
});
|
| 229 |
|
| 230 |
+
sourceInput.addEventListener('input', handleSearch);
|
| 231 |
+
|
| 232 |
+
document.getElementById('clearBtn').onclick = () => {
|
| 233 |
+
sourceInput.value = "";
|
| 234 |
+
handleSearch();
|
| 235 |
+
sourceInput.focus();
|
| 236 |
+
};
|
| 237 |
+
|
| 238 |
+
document.getElementById('toggleKbd').onclick = () => {
|
| 239 |
+
const kbd = document.getElementById('tifinaghKeyboard');
|
| 240 |
+
kbd.classList.toggle('hidden');
|
| 241 |
+
};
|
| 242 |
|
|
|
|
|
|
|
| 243 |
</script>
|
| 244 |
</body>
|
| 245 |
</html>
|