stat2025 commited on
Commit
ea2863f
·
verified ·
1 Parent(s): 2962d3c

Delete script.js

Browse files
Files changed (1) hide show
  1. script.js +0 -154
script.js DELETED
@@ -1,154 +0,0 @@
1
- // بيانات الروابط (تم توليدها من ملف Excel)
2
- 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"}];
3
-
4
- // --------- أدوات مساعدة للتطبيع (لتحسين البحث بالعربية) ----------
5
- function normalizeArabic(s) {
6
- if (!s) return "";
7
- return String(s)
8
- .trim()
9
- .toLowerCase()
10
- // إزالة التشكيل
11
- .replace(/[\u064B-\u065F\u0670\u06D6-\u06ED]/g, "")
12
- // إزالة التطويل
13
- .replace(/\u0640/g, "")
14
- // توحيد الهمزات
15
- .replace(/[إأآٱ]/g, "ا")
16
- // توحيد الياء والألف المقصورة
17
- .replace(/ى/g, "ي")
18
- // توحيد الهاء/التاء المربوطة (يساعد في تطابقات أكثر)
19
- .replace(/ة/g, "ه")
20
- // توحيد المسافات
21
- .replace(/\s+/g, " ");
22
- }
23
-
24
- function escapeHtml(str) {
25
- return String(str)
26
- .replaceAll("&", "&")
27
- .replaceAll("<", "&lt;")
28
- .replaceAll(">", "&gt;")
29
- .replaceAll('"', "&quot;")
30
- .replaceAll("'", "&#039;");
31
- }
32
-
33
- // تظليل سريع: يظلل أول كلمة يطابقها حرفيًا في الاسم الأصلي إن وُجد
34
- function highlightMatch(name, rawQuery) {
35
- if (!rawQuery) return escapeHtml(name);
36
- const tokens = rawQuery.trim().split(/\s+/).filter(Boolean);
37
- if (!tokens.length) return escapeHtml(name);
38
-
39
- let out = escapeHtml(name);
40
- // جرّب تظليل أول توكن فقط (حتى لا نخرب التنسيق)
41
- const t = tokens[0];
42
- const idx = name.indexOf(t);
43
- if (idx === -1) return out;
44
-
45
- const before = escapeHtml(name.slice(0, idx));
46
- const mid = escapeHtml(name.slice(idx, idx + t.length));
47
- const after = escapeHtml(name.slice(idx + t.length));
48
- return `${before}<mark>${mid}</mark>${after}`;
49
- }
50
-
51
- // --------- DOM ----------
52
- const elQ = document.getElementById("q");
53
- const elResults = document.getElementById("results");
54
- const elCount = document.getElementById("countBadge");
55
- const elTotal = document.getElementById("totalPill");
56
- const btnSearch = document.getElementById("btnSearch");
57
- const btnClear = document.getElementById("btnClear");
58
-
59
- elTotal.textContent = `📌 إجمالي الروابط: ${DATA.length}`;
60
-
61
- // --------- Render ----------
62
- function renderResults(list, rawQuery) {
63
- elResults.innerHTML = "";
64
-
65
- if (!list.length) {
66
- elCount.textContent = "النتائج: 0";
67
- elResults.innerHTML = `<div class="empty">لا توجد نتائج مطابقة. جرّب كتابة جزء آخر من الاسم.</div>`;
68
- return;
69
- }
70
-
71
- elCount.textContent = `النتائج: ${list.length}`;
72
-
73
- const frag = document.createDocumentFragment();
74
-
75
- list.forEach(item => {
76
- const row = document.createElement("div");
77
- row.className = "item";
78
-
79
- const left = document.createElement("div");
80
- left.className = "left";
81
-
82
- const nm = document.createElement("div");
83
- nm.className = "name";
84
- nm.innerHTML = highlightMatch(item.name, rawQuery);
85
-
86
- const hint = document.createElement("div");
87
- hint.className = "hint";
88
- hint.textContent = "اضغط فتح الخريطة لزيارة صفحة الباحث";
89
-
90
- left.appendChild(nm);
91
- left.appendChild(hint);
92
-
93
- const a = document.createElement("a");
94
- a.className = "open";
95
- a.href = item.url;
96
- a.target = "_blank";
97
- a.rel = "noopener";
98
- a.innerHTML = `فتح الخريطة <span aria-hidden="true">↗</span>`;
99
-
100
- row.appendChild(left);
101
- row.appendChild(a);
102
- frag.appendChild(row);
103
- });
104
-
105
- elResults.appendChild(frag);
106
- }
107
-
108
- // --------- Search ----------
109
- function doSearch() {
110
- const raw = (elQ.value || "").trim();
111
- const q = normalizeArabic(raw);
112
-
113
- if (!q) {
114
- elCount.textContent = "النتائج: 0";
115
- elResults.innerHTML = "";
116
- return;
117
- }
118
-
119
- const tokens = q.split(" ").filter(Boolean);
120
-
121
- const matched = DATA.filter(d => {
122
- const nameNorm = normalizeArabic(d.name);
123
- return tokens.every(t => nameNorm.includes(t));
124
- });
125
-
126
- // ترتيب: ال��قصر ثم أبجدي
127
- matched.sort((a, b) => {
128
- const al = (a.name || "").length;
129
- const bl = (b.name || "").length;
130
- if (al !== bl) return al - bl;
131
- return (a.name || "").localeCompare(b.name || "", "ar");
132
- });
133
-
134
- renderResults(matched, raw);
135
- }
136
-
137
- btnSearch.addEventListener("click", doSearch);
138
-
139
- btnClear.addEventListener("click", () => {
140
- elQ.value = "";
141
- elQ.focus();
142
- elResults.innerHTML = "";
143
- elCount.textContent = "النتائج: 0";
144
- });
145
-
146
- let t = null;
147
- elQ.addEventListener("input", () => {
148
- clearTimeout(t);
149
- t = setTimeout(doSearch, 140);
150
- });
151
-
152
- elQ.addEventListener("keydown", (e) => {
153
- if (e.key === "Enter") doSearch();
154
- });