File size: 10,728 Bytes
7fd37cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | // بيانات الروابط (تم توليدها من ملف Excel)
const DATA = [{"name": "أروى سعيد بن عبدالله القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/37.html"}, {"name": "أسماء درويش سالم الدوسري", "url": "https://stat2025-map.static.hf.space/BCS/15.html"}, {"name": "أمل احمد محمد مجرشي", "url": "https://stat2025-map.static.hf.space/BCS/28.html"}, {"name": "أمل بنت علي بن علي السماعيل", "url": "https://stat2025-map.static.hf.space/BCS/07.html"}, {"name": "أمل جعفر بن علي آل حماد", "url": "https://stat2025-map.static.hf.space/BCS/30.html"}, {"name": "أمل صالح بن احمد آل مزعل", "url": "https://stat2025-map.static.hf.space/BCS/47.html"}, {"name": "ابرار بنت يوسف بن علي آل حماد", "url": "https://stat2025-map.static.hf.space/BCS/44.html"}, {"name": "احلام صالح معيوض العصيمي", "url": "https://stat2025-map.static.hf.space/BCS/16.html"}, {"name": "اسعد بن ماجد بن احمد الهاشم", "url": "https://stat2025-map.static.hf.space/BCS/46.html"}, {"name": "اسماء بنت محمد بن حسين العدساني", "url": "https://stat2025-map.static.hf.space/BCS/09.html"}, {"name": "ايمان عبدالعزيز بن صالح الصالح", "url": "https://stat2025-map.static.hf.space/BCS/40.html"}, {"name": "باسمه احمد بن محمد القرني", "url": "https://stat2025-map.static.hf.space/BCS/21.html"}, {"name": "باقر عبدالله بن هاشم الهاشم", "url": "https://stat2025-map.static.hf.space/BCS/11.html"}, {"name": "تركي وحيد بن عيسى المحيفيظ", "url": "https://stat2025-map.static.hf.space/BCS/01.html"}, {"name": "حسن عادل بن حسين الوصيبعي", "url": "https://stat2025-map.static.hf.space/BCS/03.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/35.html"}, {"name": "ساره راشد عبدالله المديني", "url": "https://stat2025-map.static.hf.space/BCS/34.html"}, {"name": "ساره عبدالحميد بن حسين البوحمد", "url": "https://stat2025-map.static.hf.space/BCS/12.html"}, {"name": "سميه رياض بن عبدالله البراك", "url": "https://stat2025-map.static.hf.space/BCS/39.html"}, {"name": "سميه سامى بن احمد النعيم", "url": "https://stat2025-map.static.hf.space/BCS/05.html"}, {"name": "شريفه ابراهيم بن عبدالله العقيل", "url": "https://stat2025-map.static.hf.space/BCS/41.html"}, {"name": "شيماء عبدالرحمن بن دحباش سودي", "url": "https://stat2025-map.static.hf.space/BCS/19.html"}, {"name": "صالح دلي الشمري", "url": "https://stat2025-map.static.hf.space/BCS/48.html"}, {"name": "طيبه فالح بن عبدالله الرويشد", "url": "https://stat2025-map.static.hf.space/BCS/31.html"}, {"name": "عائشه سليمان بن نايف الحربي", "url": "https://stat2025-map.static.hf.space/BCS/13.html"}, {"name": "عبدالله خلف الجدعان", "url": "https://stat2025-map.static.hf.space/BCS/49.html"}, {"name": "عقيله محمدحسين بن علي الجباره", "url": "https://stat2025-map.static.hf.space/BCS/06.html"}, {"name": "علياء فيصل بن محمد الكثيري", "url": "https://stat2025-map.static.hf.space/BCS/36.html"}, {"name": "غدير عبدالعزيز بن سعد القاسم", "url": "https://stat2025-map.static.hf.space/BCS/38.html"}, {"name": "فارس ثاني الشمري", "url": "https://stat2025-map.static.hf.space/BCS/50.html"}, {"name": "فاطمه حسين بن ابراهيم القرقوش", "url": "https://stat2025-map.static.hf.space/BCS/45.html"}, {"name": "فايزه محمد مسعود الحازمي", "url": "https://stat2025-map.static.hf.space/BCS/32.html"}, {"name": "فيصل تركي فيصل القحطاني", "url": "https://stat2025-map.static.hf.space/BCS/18.html"}, {"name": "لطيفه صالح بن عبدالرحمن العبد القادر", "url": "https://stat2025-map.static.hf.space/BCS/25.html"}, {"name": "لطيفه علي بن حسين النعيم", "url": "https://stat2025-map.static.hf.space/BCS/29.html"}, {"name": "لين أحمد بن عبدالعزيز القصير", "url": "https://stat2025-map.static.hf.space/BCS/22.html"}, {"name": "محمد دبيان بن مفرج الشمري", "url": "https://stat2025-map.static.hf.space/BCS/27.html"}, {"name": "مرتضى عبدالجليل بن عيسى الحكيم", "url": "https://stat2025-map.static.hf.space/BCS/43.html"}, {"name": "مصطفى احمد بن جمعه الرمضان", "url": "https://stat2025-map.static.hf.space/BCS/10.html"}, {"name": "ممدوح مشعل ضيف الله الصخري", "url": "https://stat2025-map.static.hf.space/BCS/26.html"}, {"name": "منيره سعد بن احمد الجديدي", "url": "https://stat2025-map.static.hf.space/BCS/04.html"}, {"name": "منيره سعود بن عبدالعزيز القوز", "url": "https://stat2025-map.static.hf.space/BCS/42.html"}, {"name": "نبأ عادل بن عبدالكريم آل رضوان", "url": "https://stat2025-map.static.hf.space/BCS/23.html"}, {"name": "نجود عبدالعزيز بن عقيل العمري", "url": "https://stat2025-map.static.hf.space/BCS/20.html"}, {"name": "نوره عبدالله بن زهير الرزقي", "url": "https://stat2025-map.static.hf.space/BCS/24.html"}, {"name": "نوره عبدالله بن مانع الخالدي", "url": "https://stat2025-map.static.hf.space/BCS/02.html"}, {"name": "نوف صالح بن محمد السميح", "url": "https://stat2025-map.static.hf.space/BCS/08.html"}, {"name": "نيللي حسين عبدالله الجعص", "url": "https://stat2025-map.static.hf.space/BCS/17.html"}, {"name": "وضحه خالد بن مشرف الخالدي", "url": "https://stat2025-map.static.hf.space/BCS/14.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, " ");
}
function highlightMatch(name, query) {
// تظليل بسيط بناءً على النص الأصلي (بدون تطبيع كامل لتفادي تعقيد الفهارس)
if (!query) return escapeHtml(name);
const q = query.trim();
if (!q) return escapeHtml(name);
// نبحث عن أول ظهور لنفس سلسلة المستخدم في الاسم الأصلي (حرفيًا)
const idx = name.indexOf(q);
if (idx === -1) return escapeHtml(name);
const before = escapeHtml(name.slice(0, idx));
const mid = escapeHtml(name.slice(idx, idx + q.length));
const after = escapeHtml(name.slice(idx + q.length));
return `${before}<mark>${mid}</mark>${after}`;
}
function escapeHtml(str) {
return String(str)
.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll('"', """)
.replaceAll("'", "'");
}
// --------- منطق البحث ----------
const elQ = document.getElementById("q");
const elResults = document.getElementById("results");
const elBadge = document.getElementById("countBadge");
const btnSearch = document.getElementById("btnSearch");
const btnClear = document.getElementById("btnClear");
function renderResults(list, rawQuery) {
elResults.innerHTML = "";
if (!list.length) {
elBadge.textContent = "النتائج: 0";
elResults.innerHTML = `<div class="empty">لا توجد نتائج مطابقة. جرّب كتابة جزء آخر من الاسم.</div>`;
return;
}
elBadge.textContent = `النتائج: ${list.length}`;
const frag = document.createDocumentFragment();
list.forEach(item => {
const div = document.createElement("div");
div.className = "item";
const left = document.createElement("div");
const nm = document.createElement("div");
nm.className = "name";
nm.innerHTML = highlightMatch(item.name, rawQuery);
const hint = document.createElement("div");
hint.className = "hint";
hint.textContent = "اضغط فتح الخريطة لزيارة الصفحة";
left.appendChild(nm);
left.appendChild(hint);
const a = document.createElement("a");
a.className = "open";
a.href = item.url;
a.target = "_blank";
a.rel = "noopener";
a.textContent = "فتح الخريطة";
div.appendChild(left);
div.appendChild(a);
frag.appendChild(div);
});
elResults.appendChild(frag);
}
function doSearch() {
const raw = elQ.value || "";
const q = normalizeArabic(raw);
if (!q) {
renderResults([], raw);
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.trim());
}
btnSearch.addEventListener("click", doSearch);
btnClear.addEventListener("click", () => {
elQ.value = "";
elQ.focus();
elResults.innerHTML = "";
elBadge.textContent = "النتائج: 0";
});
// بحث تلقائي أثناء الكتابة (مع تأخير بسيط)
let t = null;
elQ.addEventListener("input", () => {
clearTimeout(t);
t = setTimeout(doSearch, 150);
});
// Enter للبحث
elQ.addEventListener("keydown", (e) => {
if (e.key === "Enter") doSearch();
});
// تحميل أولي: إظهار حالة فارغة
elBadge.textContent = "النتائج: 0";
|