Download script.js from stat2025/map1: direct link, hf CLI and curl.
- Browser
- Download file 11.5 kB
-
https://huggingface.co/spaces/stat2025/map1/resolve/main/script.js
- Command line
-
hf download hf://spaces/stat2025/map1/script.js
-
curl -L -o script.js https://huggingface.co/spaces/stat2025/map1/resolve/main/script.js
11.5 kB
| const DATA = [ | |
| { | |
| "name": "أبرار ناصر ابن ثامر المطيري", | |
| "url": "https://stat2025-map.static.hf.space/n/01.html" | |
| }, | |
| { | |
| "name": "أحمد جابر بن احمد الشهري", | |
| "url": "https://stat2025-map.static.hf.space/n/02.html" | |
| }, | |
| { | |
| "name": "أحمد يحي علي هزازي", | |
| "url": "https://stat2025-map.static.hf.space/n/03.html" | |
| }, | |
| { | |
| "name": "أروى عبدالله سعد العقيل", | |
| "url": "https://stat2025-map.static.hf.space/n/04.html" | |
| }, | |
| { | |
| "name": "أشواق سابر زايد الشهري", | |
| "url": "https://stat2025-map.static.hf.space/n/05.html" | |
| }, | |
| { | |
| "name": "أمل احمد مبارك الحمادي", | |
| "url": "https://stat2025-map.static.hf.space/n/06.html" | |
| }, | |
| { | |
| "name": "إيناس ناصر الشريف", | |
| "url": "https://stat2025-map.static.hf.space/n/07.html" | |
| }, | |
| { | |
| "name": "احمد متعب بن عوض الحربي", | |
| "url": "https://stat2025-map.static.hf.space/n/08.html" | |
| }, | |
| { | |
| "name": "اسامه عمر عبده حمدي", | |
| "url": "https://stat2025-map.static.hf.space/n/09.html" | |
| }, | |
| { | |
| "name": "اشواق عبدالكريم الحنطي", | |
| "url": "https://stat2025-map.static.hf.space/n/10.html" | |
| }, | |
| { | |
| "name": "اشواق فيحان شوردي المطيري", | |
| "url": "https://stat2025-map.static.hf.space/n/11.html" | |
| }, | |
| { | |
| "name": "الهنوف صالح محمد المبارك", | |
| "url": "https://stat2025-map.static.hf.space/n/12.html" | |
| }, | |
| { | |
| "name": "اميرةعبدالله احمد الرشيد", | |
| "url": "https://stat2025-map.static.hf.space/n/13.html" | |
| }, | |
| { | |
| "name": "بدر عبدالعزيز بن عبدالرحمن العبدالعظيم", | |
| "url": "https://stat2025-map.static.hf.space/n/14.html" | |
| }, | |
| { | |
| "name": "بدور محمد بن علي الحربي", | |
| "url": "https://stat2025-map.static.hf.space/n/15.html" | |
| }, | |
| { | |
| "name": "جمانة محمد بن علي ال دغرير", | |
| "url": "https://stat2025-map.static.hf.space/n/16.html" | |
| }, | |
| { | |
| "name": "حسن باسم بن علي الفاضل", | |
| "url": "https://stat2025-map.static.hf.space/n/17.html" | |
| }, | |
| { | |
| "name": "حسن عبدالله ابوكبوس", | |
| "url": "https://stat2025-map.static.hf.space/n/18.html" | |
| }, | |
| { | |
| "name": "حسين بن علي بن منصور الدهان", | |
| "url": "https://stat2025-map.static.hf.space/n/19.html" | |
| }, | |
| { | |
| "name": "حصه جاسم بن احمد القرناس", | |
| "url": "https://stat2025-map.static.hf.space/n/20.html" | |
| }, | |
| { | |
| "name": "خديجة حسين هنبوبه", | |
| "url": "https://stat2025-map.static.hf.space/n/21.html" | |
| }, | |
| { | |
| "name": "خلود سعود بن خليوي الخالدي", | |
| "url": "https://stat2025-map.static.hf.space/n/22.html" | |
| }, | |
| { | |
| "name": "دانه احمد الدريب", | |
| "url": "https://stat2025-map.static.hf.space/n/23.html" | |
| }, | |
| { | |
| "name": "روابي محمد حمد الزبيران", | |
| "url": "https://stat2025-map.static.hf.space/n/24.html" | |
| }, | |
| { | |
| "name": "ريم جعفر ال مسعود القحطاني", | |
| "url": "https://stat2025-map.static.hf.space/n/25.html" | |
| }, | |
| { | |
| "name": "ريم مساعد عثمان السبت", | |
| "url": "https://stat2025-map.static.hf.space/n/26.html" | |
| }, | |
| { | |
| "name": "سارة صالح القحطاني", | |
| "url": "https://stat2025-map.static.hf.space/n/27.html" | |
| }, | |
| { | |
| "name": "سكينة حسين علي ال خلف", | |
| "url": "https://stat2025-map.static.hf.space/n/28.html" | |
| }, | |
| { | |
| "name": "شيماء نجم بن عبدالله الرويشد", | |
| "url": "https://stat2025-map.static.hf.space/n/29.html" | |
| }, | |
| { | |
| "name": "صالحه محمد بن مزراق مجرشي", | |
| "url": "https://stat2025-map.static.hf.space/n/30.html" | |
| }, | |
| { | |
| "name": "عالية محمد علي الربيع", | |
| "url": "https://stat2025-map.static.hf.space/n/31.html" | |
| }, | |
| { | |
| "name": "عبد الملك عبدالرحمن محمد العصيل", | |
| "url": "https://stat2025-map.static.hf.space/n/32.html" | |
| }, | |
| { | |
| "name": "عبدالله سالم الهاجري", | |
| "url": "https://stat2025-map.static.hf.space/n/33.html" | |
| }, | |
| { | |
| "name": "عبدالمجيد مشعل محمد الحربي", | |
| "url": "https://stat2025-map.static.hf.space/n/34.html" | |
| }, | |
| { | |
| "name": "علي إبراهيم محمد الغامدي", | |
| "url": "https://stat2025-map.static.hf.space/n/35.html" | |
| }, | |
| { | |
| "name": "علي حبيب بن عبدالله الحبيب", | |
| "url": "https://stat2025-map.static.hf.space/n/36.html" | |
| }, | |
| { | |
| "name": "علي حسين بن جعفر آل مبيريك", | |
| "url": "https://stat2025-map.static.hf.space/n/37.html" | |
| }, | |
| { | |
| "name": "عمران فخري عمران الشرفا", | |
| "url": "https://stat2025-map.static.hf.space/n/38.html" | |
| }, | |
| { | |
| "name": "غيداء يحي بن دحباش سودي", | |
| "url": "https://stat2025-map.static.hf.space/n/39.html" | |
| }, | |
| { | |
| "name": "فاطمة سعد مبارك القحطاني", | |
| "url": "https://stat2025-map.static.hf.space/n/40.html" | |
| }, | |
| { | |
| "name": "فاطمة نعمة سلمان الهاشم", | |
| "url": "https://stat2025-map.static.hf.space/n/41.html" | |
| }, | |
| { | |
| "name": "فهد عبد الخالق الغامدي", | |
| "url": "https://stat2025-map.static.hf.space/n/42.html" | |
| }, | |
| { | |
| "name": "محاسن سلطان عبدالله الأحمد", | |
| "url": "https://stat2025-map.static.hf.space/n/43.html" | |
| }, | |
| { | |
| "name": "محمد عبدالعزيز بن احمد العرفه", | |
| "url": "https://stat2025-map.static.hf.space/n/44.html" | |
| }, | |
| { | |
| "name": "محمد ماجد بن محمد القصاب", | |
| "url": "https://stat2025-map.static.hf.space/n/45.html" | |
| }, | |
| { | |
| "name": "مرتضى محمد عبدالله السيهاتي", | |
| "url": "https://stat2025-map.static.hf.space/n/46.html" | |
| }, | |
| { | |
| "name": "منال احمد القحطاني", | |
| "url": "https://stat2025-map.static.hf.space/n/47.html" | |
| }, | |
| { | |
| "name": "ميعاد سند محمد الهاجري", | |
| "url": "https://stat2025-map.static.hf.space/n/48.html" | |
| }, | |
| { | |
| "name": "ناهد عبداللطيف محمد الخوفي", | |
| "url": "https://stat2025-map.static.hf.space/n/49.html" | |
| }, | |
| { | |
| "name": "نجاح شوعي محمد حكمي", | |
| "url": "https://stat2025-map.static.hf.space/n/50.html" | |
| }, | |
| { | |
| "name": "نوت فواز حميد الشمري", | |
| "url": "https://stat2025-map.static.hf.space/n/51.html" | |
| }, | |
| { | |
| "name": "نور عيد على الثاني", | |
| "url": "https://stat2025-map.static.hf.space/n/52.html" | |
| }, | |
| { | |
| "name": "هيله خالد بن عبدالله العليط", | |
| "url": "https://stat2025-map.static.hf.space/n/53.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"; | |