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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
"url": "https://stat2025-map.static.hf.space/BCS/14.html"
|
| 205 |
}
|
| 206 |
];
|
| 207 |
+
|
| 208 |
+
// بيانات الروابط (تم توليدها من ملف Excel)
|
| 209 |
+
const DATA = [{"name": "أحمد حمود محمد الحربي", "url": "https://stat2025-map.static.hf.space/BCS/59.html"}, {"name": "أروى سعيد بن عبدالله القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/29.html"}, {"name": "أماني مصطفى بن عبدالله الطيب", "url": "https://stat2025-map.static.hf.space/BCS/42.html"}, {"name": "أمل احمد محمد مجرشي", "url": "https://stat2025-map.static.hf.space/BCS/01.html"}, {"name": "أمل بنت علي بن علي السماعيل", "url": "https://stat2025-map.static.hf.space/BCS/50.html"}, {"name": "أمل جعفر بن علي آل حماد", "url": "https://stat2025-map.static.hf.space/BCS/40.html"}, {"name": "أمل صالح بن احمد آل مزعل", "url": "https://stat2025-map.static.hf.space/BCS/06.html"}, {"name": "احلام صالح معيوض العصيمي", "url": "https://stat2025-map.static.hf.space/BCS/43.html"}, {"name": "احمد متعب بن عوض الحربي", "url": "https://stat2025-map.static.hf.space/BCS/56.html"}, {"name": "اسراء محمد بن علي الاصيل", "url": "https://stat2025-map.static.hf.space/BCS/39.html"}, {"name": "اسعد بن ماجد بن احمد الهاشم", "url": "https://stat2025-map.static.hf.space/BCS/37.html"}, {"name": "اسماء بنت محمد بن حسين العدساني", "url": "https://stat2025-map.static.hf.space/BCS/52.html"}, {"name": "الجازي معيض هادي ال دعلان", "url": "https://stat2025-map.static.hf.space/BCS/36.html"}, {"name": "ايمان عبدالعزيز بن صالح الصالح", "url": "https://stat2025-map.static.hf.space/BCS/09.html"}, {"name": "ايمان عبدالعزيز بن صالح الصالح", "url": "https://stat2025-map.static.hf.space/BCS/23.html"}, {"name": "باسمه احمد بن محمد القرني", "url": "https://stat2025-map.static.hf.space/BCS/31.html"}, {"name": "باقر عبدالله بن هاشم الهاشم", "url": "https://stat2025-map.static.hf.space/BCS/47.html"}, {"name": "بخيته عادل احمد الدوسري", "url": "https://stat2025-map.static.hf.space/BCS/12.html"}, {"name": "حسن عادل بن حسين الوصيبعي", "url": "https://stat2025-map.static.hf.space/BCS/48.html"}, {"name": "حسين علي بن صالح الربيعه", "url": "https://stat2025-map.static.hf.space/BCS/19.html"}, {"name": "حنين محمد مبارك آل مبارك", "url": "https://stat2025-map.static.hf.space/BCS/28.html"}, {"name": "روان سعود بن مرشد الرحيلي", "url": "https://stat2025-map.static.hf.space/BCS/45.html"}, {"name": "ريم بنت محمد بن عبدالعزيز الملحم", "url": "https://stat2025-map.static.hf.space/BCS/04.html"}, {"name": "زهراء بنت عايش بن علي الصاهود", "url": "https://stat2025-map.static.hf.space/BCS/13.html"}, {"name": "ساره حسين بن عبدالهادي بوخمسين", "url": "https://stat2025-map.static.hf.space/BCS/18.html"}, {"name": "ساره خالد سليمان المحيسن", "url": "https://stat2025-map.static.hf.space/BCS/20.html"}, {"name": "سراب حميد عبدالمجيد السليمان", "url": "https://stat2025-map.static.hf.space/BCS/25.html"}, {"name": "سلافه عباس محمد العلوي", "url": "https://stat2025-map.static.hf.space/BCS/30.html"}, {"name": "سميه سامى بن احمد النعيم", "url": "https://stat2025-map.static.hf.space/BCS/51.html"}, {"name": "شريفه ابراهيم بن عبدالله العقيل", "url": "https://stat2025-map.static.hf.space/BCS/33.html"}, {"name": "شيماء عبدالرحمن بن دحباش سودي", "url": "https://stat2025-map.static.hf.space/BCS/26.html"}, {"name": "صالح دلي بن عقلاء الشمري", "url": "https://stat2025-map.static.hf.space/BCS/46.html"}, {"name": "طيبه فالح بن عبدالله الرويشد", "url": "https://stat2025-map.static.hf.space/BCS/11.html"}, {"name": "عائشه سليمان بن نايف الحربي", "url": "https://stat2025-map.static.hf.space/BCS/44.html"}, {"name": "عبدالمجيد مشعل محمد الحربي", "url": "https://stat2025-map.static.hf.space/BCS/58.html"}, {"name": "عبدالهادي عون بن سعييد القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/05.html"}, {"name": "عقيله محمدحسين بن علي الجباره", "url": "https://stat2025-map.static.hf.space/BCS/53.html"}, {"name": "غاده سعد بن عبدالرحمن القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/08.html"}, {"name": "غشمه محمد بن سعد الشهراني", "url": "https://stat2025-map.static.hf.space/BCS/14.html"}, {"name": "فايزه محمد مسعود الحازمي", "url": "https://stat2025-map.static.hf.space/BCS/22.html"}, {"name": "فوز عائد نومان المطيري", "url": "https://stat2025-map.static.hf.space/BCS/61.html"}, {"name": "فيصل تركي فيصل القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/34.html"}, {"name": "قنوت محمد بن عبدالله آل حماد", "url": "https://stat2025-map.static.hf.space/BCS/03.html"}, {"name": "لطيفه صالح بن عبدالرحمن العبد القادر", "url": "https://stat2025-map.static.hf.space/BCS/32.html"}, {"name": "لطيفه علي بن حسين النعيم", "url": "https://stat2025-map.static.hf.space/BCS/16.html"}, {"name": "لولوه بدر بن حمد الصياح", "url": "https://stat2025-map.static.hf.space/BCS/21.html"}, {"name": "لين أحمد بن عبدالعزيز القصير", "url": "https://stat2025-map.static.hf.space/BCS/35.html"}, {"name": "محمد فهد محمد الحربي", "url": "https://stat2025-map.static.hf.space/BCS/60.html"}, {"name": "مرتضى عبدالجليل بن عيسى الحكيم", "url": "https://stat2025-map.static.hf.space/BCS/38.html"}, {"name": "مصطفى احمد بن جمعه الرمضان", "url": "https://stat2025-map.static.hf.space/BCS/49.html"}, {"name": "منيره سعد بن احمد الجديدي", "url": "https://stat2025-map.static.hf.space/BCS/54.html"}, {"name": "ناصر عبدالله بن ناصر القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/57.html"}, {"name": "نبأ عادل بن عبدالكريم آل رضوان", "url": "https://stat2025-map.static.hf.space/BCS/15.html"}, {"name": "نجود عبدالعزيز بن عقيل العمري", "url": "https://stat2025-map.static.hf.space/BCS/24.html"}, {"name": "ندى ابراهيم بن علي المنصور", "url": "https://stat2025-map.static.hf.space/BCS/17.html"}, {"name": "نوره عبدالله بن زهير الرزقي", "url": "https://stat2025-map.static.hf.space/BCS/10.html"}, {"name": "نوف سعود بن سالم الخثعمي", "url": "https://stat2025-map.static.hf.space/BCS/02.html"}, {"name": "نوف صالح بن محمد السميح", "url": "https://stat2025-map.static.hf.space/BCS/55.html"}, {"name": "نيللي حسين عبدالله الجعص", "url": "https://stat2025-map.static.hf.space/BCS/27.html"}, {"name": "وضحاء نائف سعد الشريف", "url": "https://stat2025-map.static.hf.space/BCS/07.html"}, {"name": "يحي علي بن يحي المسين", "url": "https://stat2025-map.static.hf.space/BCS/41.html"}];
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
function normalizeArabic(s) {
|
| 213 |
+
if (!s) return "";
|
| 214 |
+
return String(s)
|
| 215 |
+
.trim()
|
| 216 |
+
.toLowerCase()
|
| 217 |
+
.replace(/[\u064B-\u065F\u0670\u06D6-\u06ED]/g, "")
|
| 218 |
+
.replace(/\u0640/g, "")
|
| 219 |
+
.replace(/[إأآٱ]/g, "ا")
|
| 220 |
+
.replace(/ى/g, "ي")
|
| 221 |
+
.replace(/ة/g, "ه")
|
| 222 |
+
.replace(/^ال\s+/g, "")
|
| 223 |
+
.replace(/\s+/g, " ");
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
function escapeHtml(str) {
|
| 227 |
+
return String(str)
|
| 228 |
+
.replaceAll("&", "&")
|
| 229 |
+
.replaceAll("<", "<")
|
| 230 |
+
.replaceAll(">", ">")
|
| 231 |
+
.replaceAll('"', """)
|
| 232 |
+
.replaceAll("'", "'");
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
function highlightMatch(name, rawQuery) {
|
| 236 |
+
if (!rawQuery) return escapeHtml(name);
|
| 237 |
+
const tokens = rawQuery.trim().split(/\s+/).filter(Boolean);
|
| 238 |
+
if (!tokens.length) return escapeHtml(name);
|
| 239 |
+
|
| 240 |
+
const t = tokens[0];
|
| 241 |
+
const idx = name.indexOf(t);
|
| 242 |
+
if (idx === -1) return escapeHtml(name);
|
| 243 |
+
|
| 244 |
+
const before = escapeHtml(name.slice(0, idx));
|
| 245 |
+
const mid = escapeHtml(name.slice(idx, idx + t.length));
|
| 246 |
+
const after = escapeHtml(name.slice(idx + t.length));
|
| 247 |
+
return `${before}<mark>${mid}</mark>${after}`;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
const elQ = document.getElementById("q");
|
| 251 |
+
const elResults = document.getElementById("results");
|
| 252 |
+
const elCount = document.getElementById("countPill");
|
| 253 |
+
const elTotal = document.getElementById("totalChip");
|
| 254 |
+
const toast = document.getElementById("toast");
|
| 255 |
+
const toastText = document.getElementById("toastText");
|
| 256 |
+
|
| 257 |
+
elTotal.innerHTML = `إجمالي: <b>${DATA.length}</b>`;
|
| 258 |
+
|
| 259 |
+
function showToast(msg = "تم نسخ الرابط") {
|
| 260 |
+
toastText.textContent = msg;
|
| 261 |
+
toast.classList.add("show");
|
| 262 |
+
clearTimeout(window.__toastT);
|
| 263 |
+
window.__toastT = setTimeout(() => toast.classList.remove("show"), 1200);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
async function copyLink(url) {
|
| 267 |
+
try {
|
| 268 |
+
await navigator.clipboard.writeText(url);
|
| 269 |
+
showToast();
|
| 270 |
+
} catch (e) {
|
| 271 |
+
const ta = document.createElement("textarea");
|
| 272 |
+
ta.value = url;
|
| 273 |
+
document.body.appendChild(ta);
|
| 274 |
+
ta.select();
|
| 275 |
+
document.execCommand("copy");
|
| 276 |
+
document.body.removeChild(ta);
|
| 277 |
+
showToast();
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
function renderResults(list, rawQuery) {
|
| 282 |
+
elResults.innerHTML = "";
|
| 283 |
+
|
| 284 |
+
if (!list.length) {
|
| 285 |
+
elCount.textContent = "النتائج: 0";
|
| 286 |
+
elResults.innerHTML = `<div class="empty">لا توجد نتائج</div>`;
|
| 287 |
+
return;
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
elCount.textContent = `النتائج: ${list.length}`;
|
| 291 |
+
const frag = document.createDocumentFragment();
|
| 292 |
+
|
| 293 |
+
list.forEach(item => {
|
| 294 |
+
const row = document.createElement("div");
|
| 295 |
+
row.className = "result";
|
| 296 |
+
|
| 297 |
+
const nm = document.createElement("div");
|
| 298 |
+
nm.className = "name";
|
| 299 |
+
nm.innerHTML = highlightMatch(item.name, rawQuery);
|
| 300 |
+
|
| 301 |
+
const actions = document.createElement("div");
|
| 302 |
+
actions.className = "actions";
|
| 303 |
+
|
| 304 |
+
const open = document.createElement("a");
|
| 305 |
+
open.className = "openBtn";
|
| 306 |
+
open.href = item.url;
|
| 307 |
+
open.target = "_blank";
|
| 308 |
+
open.rel = "noopener";
|
| 309 |
+
open.innerHTML = `فتح <span aria-hidden="true">↗</span>`;
|
| 310 |
+
|
| 311 |
+
const copy = document.createElement("button");
|
| 312 |
+
copy.className = "copyBtn";
|
| 313 |
+
copy.type = "button";
|
| 314 |
+
copy.innerHTML = `نسخ <span aria-hidden="true">⧉</span>`;
|
| 315 |
+
copy.addEventListener("click", () => copyLink(item.url));
|
| 316 |
+
|
| 317 |
+
actions.appendChild(open);
|
| 318 |
+
actions.appendChild(copy);
|
| 319 |
+
|
| 320 |
+
row.appendChild(nm);
|
| 321 |
+
row.appendChild(actions);
|
| 322 |
+
|
| 323 |
+
frag.appendChild(row);
|
| 324 |
+
});
|
| 325 |
+
|
| 326 |
+
elResults.appendChild(frag);
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
function doSearch() {
|
| 330 |
+
const raw = (elQ.value || "").trim();
|
| 331 |
+
const q = normalizeArabic(raw);
|
| 332 |
+
|
| 333 |
+
if (!q) {
|
| 334 |
+
elCount.textContent = "النتائج: 0";
|
| 335 |
+
elResults.innerHTML = "";
|
| 336 |
+
return;
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
const tokens = q.split(" ").filter(Boolean);
|
| 340 |
+
|
| 341 |
+
const matched = DATA.filter(d => {
|
| 342 |
+
const nameNorm = normalizeArabic(d.name);
|
| 343 |
+
return tokens.every(t => nameNorm.includes(t));
|
| 344 |
+
});
|
| 345 |
+
|
| 346 |
+
matched.sort((a, b) => {
|
| 347 |
+
const al = (a.name || "").length;
|
| 348 |
+
const bl = (b.name || "").length;
|
| 349 |
+
if (al !== bl) return al - bl;
|
| 350 |
+
return (a.name || "").localeCompare(b.name || "", "ar");
|
| 351 |
+
});
|
| 352 |
+
|
| 353 |
+
renderResults(matched, raw);
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
document.getElementById("btnSearch").addEventListener("click", doSearch);
|
| 357 |
+
document.getElementById("btnClear").addEventListener("click", () => {
|
| 358 |
+
elQ.value = "";
|
| 359 |
+
elQ.focus();
|
| 360 |
+
elResults.innerHTML = "";
|
| 361 |
+
elCount.textContent = "النتائج: 0";
|
| 362 |
+
});
|
| 363 |
+
|
| 364 |
+
let t = null;
|
| 365 |
+
elQ.addEventListener("input", () => {
|
| 366 |
+
clearTimeout(t);
|
| 367 |
+
t = setTimeout(doSearch, 140);
|
| 368 |
+
});
|
| 369 |
+
|
| 370 |
+
elQ.addEventListener("keydown", (e) => {
|
| 371 |
+
if (e.key === "Enter") doSearch();
|
| 372 |
+
});
|
| 373 |
+
|
| 374 |
+
// Persist last query (invisible)
|
| 375 |
+
try {
|
| 376 |
+
const last = localStorage.getItem("maps_last_query");
|
| 377 |
+
if (last) {
|
| 378 |
+
elQ.value = last;
|
| 379 |
+
doSearch();
|
| 380 |
+
}
|
| 381 |
+
elQ.addEventListener("input", () => {
|
| 382 |
+
localStorage.setItem("maps_last_query", elQ.value || "");
|
| 383 |
+
});
|
| 384 |
+
} catch(_){}
|
| 385 |
+
|
| 386 |
+
elCount.textContent = "النتائج: 0";
|