const DATA = [ { "name": "مرتضى محمد عبدالله السيهاتي", "url": "https://stat2025-map.static.hf.space/WWS/01.html" }, { "name": "علي حسين بن جعفر آل مبيريك", "url": "https://stat2025-map.static.hf.space/WWS/02.html" }, { "name": "حسين بن علي بن منصور الدهان", "url": "https://stat2025-map.static.hf.space/WWS/03.html" }, { "name": "أحمد طاهر بن عدنان الشرفا", "url": "https://stat2025-map.static.hf.space/WWS/04.html" }, { "name": "مصعب عبداللطيف محمد الجعفري", "url": "https://stat2025-map.static.hf.space/WWS/05.html" }, { "name": "محمد ماجد بن محمد القصاب", "url": "https://stat2025-map.static.hf.space/WWS/06.html" }, { "name": "مصطفي علي ال عباس", "url": "https://stat2025-map.static.hf.space/WWS/07.html" }, { "name": "صالحه محمد بن مزراق مجرشي", "url": "https://stat2025-map.static.hf.space/WWS/08.html" }, { "name": "أحمد يحي علي هزازي", "url": "https://stat2025-map.static.hf.space/WWS/09.html" }, { "name": "فهد عبد الخالق الغامدي", "url": "https://stat2025-map.static.hf.space/WWS/10.html" }, { "name": "جمانه عزيز بن مساعد الخريصي", "url": "https://stat2025-map.static.hf.space/WWS/11.html" }, { "name": "فاطمه راشد بن يوسف العزمان", "url": "https://stat2025-map.static.hf.space/WWS/12.html" }, { "name": "عمران فخري عمران الشرفا", "url": "https://stat2025-map.static.hf.space/WWS/13.html" }, { "name": "حسن باسم بن علي الفاضل", "url": "https://stat2025-map.static.hf.space/WWS/14.html" }, { "name": "أروى عبدالله سعد العقيل", "url": "https://stat2025-map.static.hf.space/WWS/15.html" }, { "name": "علي حسين معتوق ال حاتم", "url": "https://stat2025-map.static.hf.space/WWS/16.html" }, { "name": "محمد يعقوب السبع", "url": "https://stat2025-map.static.hf.space/WWS/17.html" }, { "name": "رنا صقر بن قاسم العنزي", "url": "https://stat2025-map.static.hf.space/WWS/18.html" }, { "name": "خلود سعود بن خليوي الخالدي", "url": "https://stat2025-map.static.hf.space/WWS/19.html" }, { "name": "سعد خالد المسيلم", "url": "https://stat2025-map.static.hf.space/WWS/20.html" }, { "name": "علي إبراهيم محمد الغامدي", "url": "https://stat2025-map.static.hf.space/WWS/21.html" }, { "name": "اميرةعبدالله احمد الرشيد", "url": "https://stat2025-map.static.hf.space/WWS/22.html" }, { "name": "دانه احمد الدريب", "url": "https://stat2025-map.static.hf.space/WWS/23.html" }, { "name": "جمانة محمد بن علي ال دغرير", "url": "https://stat2025-map.static.hf.space/WWS/24.html" }, { "name": "نجاح شوعي محمد حكمي", "url": "https://stat2025-map.static.hf.space/WWS/25.html" }, { "name": "أمل احمد مبارك الحمادي", "url": "https://stat2025-map.static.hf.space/WWS/26.html" }, { "name": "شيماء نجم بن عبدالله الرويشد", "url": "https://stat2025-map.static.hf.space/WWS/27.html" }, { "name": "مروة سلمان بن سلمان العاشور", "url": "https://stat2025-map.static.hf.space/WWS/28.html" }, { "name": "أشواق سابر زايد الشهري", "url": "https://stat2025-map.static.hf.space/WWS/29.html" }, { "name": "أحمد جابر بن احمد الشهري", "url": "https://stat2025-map.static.hf.space/WWS/30.html" }, { "name": "ياسمين عيسى المطوع", "url": "https://stat2025-map.static.hf.space/WWS/31.html" }, { "name": "الوليد مشعل محمد الحربي", "url": "https://stat2025-map.static.hf.space/WWS/32.html" }, { "name": "ريم جعفر ال مسعود القحطاني", "url": "https://stat2025-map.static.hf.space/WWS/33.html" }, { "name": "مريم بنت خالد بن احمد السليمان", "url": "https://stat2025-map.static.hf.space/WWS/34.html" }, { "name": "روابي محمد حمد الزبيران", "url": "https://stat2025-map.static.hf.space/WWS/35.html" }, { "name": "خديجة حسين هنبوبه", "url": "https://stat2025-map.static.hf.space/WWS/36.html" }, { "name": "علي حبيب بن عبدالله الحبيب", "url": "https://stat2025-map.static.hf.space/WWS/37.html" }, { "name": "أحمد عبدالهادي عبدالواحد الحيدر", "url": "https://stat2025-map.static.hf.space/WWS/38.html" }, { "name": "فاطمة نعمة سلمان الهاشم", "url": "https://stat2025-map.static.hf.space/WWS/39.html" }, { "name": "مهدي محمد آل اسماعيل", "url": "https://stat2025-map.static.hf.space/WWS/40.html" }, { "name": "أبرار ناصر ابن ثامر المطيري", "url": "https://stat2025-map.static.hf.space/WWS/41.html" }, { "name": "حصه جاسم بن احمد القرناس", "url": "https://stat2025-map.static.hf.space/WWS/42.html" }, { "name": "وضحه خالد بن مشرف الخالدي", "url": "https://stat2025-map.static.hf.space/WWS/43.html" }, { "name": "ماجد سلطان الشمري", "url": "https://stat2025-map.static.hf.space/WWS/44.html" }, { "name": "محاسن سلطان عبدالله الأحمد", "url": "https://stat2025-map.static.hf.space/WWS/45.html" }, { "name": "إيناس ناصر الشريف", "url": "https://stat2025-map.static.hf.space/WWS/46.html" }, { "name": "بيان سعود الرحيلي", "url": "https://stat2025-map.static.hf.space/WWS/47.html" }, { "name": "نوت فواز حميد الشمري", "url": "https://stat2025-map.static.hf.space/WWS/48.html" }, { "name": "حسن عبدالهادي بن حسين الحواج", "url": "https://stat2025-map.static.hf.space/WWS/49.html" }, { "name": "عبد الملك عبدالرحمن محمد العصيل", "url": "https://stat2025-map.static.hf.space/WWS/50.html" }, { "name": "عبدالهادي حسين بن ابراهيم الهاشم", "url": "https://stat2025-map.static.hf.space/WWS/51.html" }, { "name": "بدر عبدالعزيز بن عبدالرحمن العبدالعظيم", "url": "https://stat2025-map.static.hf.space/WWS/52.html" }, { "name": "امينة حسين صالح الشواكر", "url": "https://stat2025-map.static.hf.space/WWS/53.html" }, { "name": "محمد محمود عبداللطيف العبدالعظيم", "url": "https://stat2025-map.static.hf.space/WWS/54.html" }, { "name": "عبدالرحمن عبدالله بن محمد ابوطويبه", "url": "https://stat2025-map.static.hf.space/WWS/55.html" }, { "name": "ملاك خليفة تركي الحيمود", "url": "https://stat2025-map.static.hf.space/WWS/56.html" }, { "name": "علاء عبدالله جواد الوسمي", "url": "https://stat2025-map.static.hf.space/WWS/57.html" }, { "name": "ناهد عبداللطيف محمد الخوفي", "url": "https://stat2025-map.static.hf.space/WWS/58.html" }, { "name": "محمد دبيان مفرج الشمري", "url": "https://stat2025-map.static.hf.space/WWS/59.html" }, { "name": "ضي جديع هايف السبيعي", "url": "https://stat2025-map.static.hf.space/WWS/60.html" }, { "name": "عوض عبدالله رديني المطيري", "url": "https://stat2025-map.static.hf.space/WWS/61.html" }, { "name": "سعود محمد رديني المطيري", "url": "https://stat2025-map.static.hf.space/WWS/62.html" }, { "name": "عبدالله علي خلف الجدعان", "url": "https://stat2025-map.static.hf.space/WWS/63.html" }, { "name": "وفاء صالح عوض السرور", "url": "https://stat2025-map.static.hf.space/WWS/64.html" }, { "name": "دلال هادي بن عسكر الشمري", "url": "https://stat2025-map.static.hf.space/WWS/65.html" } ]; function normalizeArabic(s) { if (!s) return ""; return String(s) .trim() .toLowerCase() .replace(/[\u064B-\u065F\u0670\u06D6-\u06ED]/g, "") .replace(/\u0640/g, "") .replace(/[إأآٱ]/g, "ا") .replace(/ى/g, "ي") .replace(/ة/g, "ه") .replace(/^ال\s+/g, "") .replace(/\s+/g, " "); } function escapeHtml(str) { return String(str) .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll('"', """) .replaceAll("'", "'"); } function highlightMatch(name, rawQuery) { if (!rawQuery) return escapeHtml(name); const tokens = rawQuery.trim().split(/\s+/).filter(Boolean); if (!tokens.length) return escapeHtml(name); const t = tokens[0]; const idx = name.indexOf(t); if (idx === -1) return escapeHtml(name); const before = escapeHtml(name.slice(0, idx)); const mid = escapeHtml(name.slice(idx, idx + t.length)); const after = escapeHtml(name.slice(idx + t.length)); return `${before}${mid}${after}`; } const elQ = document.getElementById("q"); const elResults = document.getElementById("results"); const elCount = document.getElementById("countPill"); const elTotal = document.getElementById("totalChip"); const toast = document.getElementById("toast"); const toastText = document.getElementById("toastText"); elTotal.innerHTML = `إجمالي: ${DATA.length}`; function showToast(msg = "تم نسخ الرابط") { toastText.textContent = msg; toast.classList.add("show"); clearTimeout(window.__toastT); window.__toastT = setTimeout(() => toast.classList.remove("show"), 1200); } async function copyLink(url) { try { await navigator.clipboard.writeText(url); showToast(); } catch (e) { const ta = document.createElement("textarea"); ta.value = url; document.body.appendChild(ta); ta.select(); document.execCommand("copy"); document.body.removeChild(ta); showToast(); } } function renderResults(list, rawQuery) { elResults.innerHTML = ""; if (!list.length) { elCount.textContent = "النتائج: 0"; elResults.innerHTML = `
لا توجد نتائج
`; return; } elCount.textContent = `النتائج: ${list.length}`; const frag = document.createDocumentFragment(); list.forEach(item => { const row = document.createElement("div"); row.className = "result"; const nm = document.createElement("div"); nm.className = "name"; nm.innerHTML = highlightMatch(item.name, rawQuery); const actions = document.createElement("div"); actions.className = "actions"; const open = document.createElement("a"); open.className = "openBtn"; open.href = item.url; open.target = "_blank"; open.rel = "noopener"; open.innerHTML = `فتح `; const copy = document.createElement("button"); copy.className = "copyBtn"; copy.type = "button"; copy.innerHTML = `نسخ `; copy.addEventListener("click", () => copyLink(item.url)); actions.appendChild(open); actions.appendChild(copy); row.appendChild(nm); row.appendChild(actions); frag.appendChild(row); }); elResults.appendChild(frag); } function doSearch() { const raw = (elQ.value || "").trim(); const q = normalizeArabic(raw); if (!q) { elCount.textContent = "النتائج: 0"; elResults.innerHTML = ""; return; } const tokens = q.split(" ").filter(Boolean); const matched = DATA.filter(d => { const nameNorm = normalizeArabic(d.name); return tokens.every(t => nameNorm.includes(t)); }); matched.sort((a, b) => { const al = (a.name || "").length; const bl = (b.name || "").length; if (al !== bl) return al - bl; return (a.name || "").localeCompare(b.name || "", "ar"); }); renderResults(matched, raw); } document.getElementById("btnSearch").addEventListener("click", doSearch); document.getElementById("btnClear").addEventListener("click", () => { elQ.value = ""; elQ.focus(); elResults.innerHTML = ""; elCount.textContent = "النتائج: 0"; }); let t = null; elQ.addEventListener("input", () => { clearTimeout(t); t = setTimeout(doSearch, 140); }); elQ.addEventListener("keydown", (e) => { if (e.key === "Enter") doSearch(); }); // حفظ آخر بحث try { const last = localStorage.getItem("maps_last_query"); if (last) { elQ.value = last; doSearch(); } elQ.addEventListener("input", () => { localStorage.setItem("maps_last_query", elQ.value || ""); }); } catch(_){} elCount.textContent = "النتائج: 0";