| const DATA = [ |
| { |
| "name": "لا يوجد اسم", |
| "url": "https://stat2025-map.static.hf.space/Rahn/01.html" |
| }, |
| { |
| "name": "أماني مصطفى عبدالله الطيب", |
| "url": "https://stat2025-map.static.hf.space/Rahn/02.html" |
| }, |
| { |
| "name": "اسعد بن ماجد بن", |
| "url": "https://stat2025-map.static.hf.space/Rahn/03.html" |
| }, |
| { |
| "name": "اسماعيل خليفه السماعيل", |
| "url": "https://stat2025-map.static.hf.space/Rahn/04.html" |
| }, |
| { |
| "name": "ريم بنت محمد بن عبدالعزيز الملحم", |
| "url": "https://stat2025-map.static.hf.space/Rahn/05.html" |
| }, |
| { |
| "name": "زكي بن عيسى بن", |
| "url": "https://stat2025-map.static.hf.space/Rahn/06.html" |
| }, |
| { |
| "name": "ساره حسين بن عبدالهادي بوخمسين", |
| "url": "https://stat2025-map.static.hf.space/Rahn/07.html" |
| }, |
| { |
| "name": "ساره خالد سليمان المحيسن", |
| "url": "https://stat2025-map.static.hf.space/Rahn/08.html" |
| }, |
| { |
| "name": "طيبه فالح بن عبدالله الرويشد", |
| "url": "https://stat2025-map.static.hf.space/Rahn/09.html" |
| }, |
| { |
| "name": "عبدالعزيز فهد عبدالعزيز العبلان", |
| "url": "https://stat2025-map.static.hf.space/Rahn/10.html" |
| }, |
| { |
| "name": "علي جابر بن علي", |
| "url": "https://stat2025-map.static.hf.space/Rahn/11.html" |
| }, |
| { |
| "name": "عماد بن عيسى بن", |
| "url": "https://stat2025-map.static.hf.space/Rahn/12.html" |
| }, |
| { |
| "name": "عمران فخري بن عمران", |
| "url": "https://stat2025-map.static.hf.space/Rahn/13.html" |
| }, |
| { |
| "name": "فهد علي بن عبدالخالق الغامدي", |
| "url": "https://stat2025-map.static.hf.space/Rahn/14.html" |
| }, |
| { |
| "name": "فوز عائد نومان المطيري", |
| "url": "https://stat2025-map.static.hf.space/Rahn/15.html" |
| }, |
| { |
| "name": "قنوت محمد بن عبدالله آل حماد", |
| "url": "https://stat2025-map.static.hf.space/Rahn/16.html" |
| }, |
| { |
| "name": "لولوه بدر بن حمد الصياح", |
| "url": "https://stat2025-map.static.hf.space/Rahn/17.html" |
| }, |
| { |
| "name": "لين أحمد بن عبدالعزيز القصير", |
| "url": "https://stat2025-map.static.hf.space/Rahn/18.html" |
| }, |
| { |
| "name": "ماجد سعد ناصر السبيعي", |
| "url": "https://stat2025-map.static.hf.space/Rahn/19.html" |
| }, |
| { |
| "name": "مرتضى عبدالجليل بن عيسى", |
| "url": "https://stat2025-map.static.hf.space/Rahn/20.html" |
| }, |
| { |
| "name": "نبأ عادل بن عبدالكريم", |
| "url": "https://stat2025-map.static.hf.space/Rahn/21.html" |
| }, |
| { |
| "name": "نوف سعود بن سالم الخثعمي", |
| "url": "https://stat2025-map.static.hf.space/Rahn/22.html" |
| }, |
| { |
| "name": "نيللي حسين عبدالله الجعص", |
| "url": "https://stat2025-map.static.hf.space/Rahn/23.html" |
| }, |
| { |
| "name": "هبه عبدالعزيز", |
| "url": "https://stat2025-map.static.hf.space/Rahn/24.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}<mark>${mid}</mark>${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 = `إجمالي: <b>${DATA.length}</b>`; |
|
|
| 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 = `<div class="empty">لا توجد نتائج</div>`; |
| 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 = `فتح <span aria-hidden="true">↗</span>`; |
|
|
| const copy = document.createElement("button"); |
| copy.className = "copyBtn"; |
| copy.type = "button"; |
| copy.innerHTML = `نسخ <span aria-hidden="true">⧉</span>`; |
| 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"; |
|
|