stat2025 commited on
Commit
fb2e13b
·
verified ·
1 Parent(s): edba14b

Delete script.js

Browse files
Files changed (1) hide show
  1. script.js +0 -181
script.js DELETED
@@ -1,181 +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
- .replace(/[\u064B-\u065F\u0670\u06D6-\u06ED]/g, "") // تشكيل
11
- .replace(/\u0640/g, "") // تطويل
12
- .replace(/[إأآٱ]/g, "ا")
13
- .replace(/ى/g, "ي")
14
- .replace(/ة/g, "ه")
15
- .replace(/\s+/g, " ");
16
- }
17
-
18
- function escapeHtml(str) {
19
- return String(str)
20
- .replaceAll("&", "&")
21
- .replaceAll("<", "&lt;")
22
- .replaceAll(">", "&gt;")
23
- .replaceAll('"', "&quot;")
24
- .replaceAll("'", "&#039;");
25
- }
26
-
27
- // تظليل أول توكن فقط (بشكل آمن)
28
- function highlightMatch(name, rawQuery) {
29
- if (!rawQuery) return escapeHtml(name);
30
- const tokens = rawQuery.trim().split(/\s+/).filter(Boolean);
31
- if (!tokens.length) return escapeHtml(name);
32
-
33
- const t = tokens[0];
34
- const idx = name.indexOf(t);
35
- if (idx === -1) return escapeHtml(name);
36
-
37
- const before = escapeHtml(name.slice(0, idx));
38
- const mid = escapeHtml(name.slice(idx, idx + t.length));
39
- const after = escapeHtml(name.slice(idx + t.length));
40
- return `${before}<mark>${mid}</mark>${after}`;
41
- }
42
-
43
- // --------- DOM ----------
44
- const elQ = document.getElementById("q");
45
- const elResults = document.getElementById("results");
46
- const elCount = document.getElementById("countPill");
47
- const elTotal = document.getElementById("totalChip");
48
- const toast = document.getElementById("toast");
49
-
50
- elTotal.innerHTML = `📌 إجمالي الروابط: <b>${DATA.length}</b>`;
51
-
52
- function showToast(msg = "تم نسخ الرابط ✔") {
53
- toast.textContent = msg;
54
- toast.classList.add("show");
55
- clearTimeout(window.__toastT);
56
- window.__toastT = setTimeout(() => toast.classList.remove("show"), 1200);
57
- }
58
-
59
- async function copyLink(url) {
60
- try {
61
- await navigator.clipboard.writeText(url);
62
- showToast("تم نسخ الرابط ✔");
63
- } catch (e) {
64
- // fallback
65
- const ta = document.createElement("textarea");
66
- ta.value = url;
67
- document.body.appendChild(ta);
68
- ta.select();
69
- document.execCommand("copy");
70
- document.body.removeChild(ta);
71
- showToast("تم نسخ الرابط ✔");
72
- }
73
- }
74
-
75
- function renderResults(list, rawQuery) {
76
- elResults.innerHTML = "";
77
-
78
- if (!list.length) {
79
- elCount.textContent = "النتائج: 0";
80
- elResults.innerHTML = `<div class="empty">لا توجد نتائج مطابقة. جرّب كتابة جزء آخر من الاسم.</div>`;
81
- return;
82
- }
83
-
84
- elCount.textContent = `النتائج: ${list.length}`;
85
-
86
- const frag = document.createDocumentFragment();
87
-
88
- list.forEach(item => {
89
- const row = document.createElement("div");
90
- row.className = "resultCard";
91
-
92
- const left = document.createElement("div");
93
- left.className = "rLeft";
94
-
95
- const nm = document.createElement("div");
96
- nm.className = "rName";
97
- nm.innerHTML = highlightMatch(item.name, rawQuery);
98
-
99
- const hint = document.createElement("div");
100
- hint.className = "rHint";
101
- hint.textContent = "رابط خريطة الباحث جاهز للفتح أو النسخ";
102
-
103
- left.appendChild(nm);
104
- left.appendChild(hint);
105
-
106
- const actions = document.createElement("div");
107
- actions.className = "rActions";
108
-
109
- const open = document.createElement("a");
110
- open.className = "linkBtn";
111
- open.href = item.url;
112
- open.target = "_blank";
113
- open.rel = "noopener";
114
- open.innerHTML = `فتح الخريطة <span aria-hidden="true">↗</span>`;
115
-
116
- const copy = document.createElement("button");
117
- copy.className = "copyBtn";
118
- copy.type = "button";
119
- copy.innerHTML = `نسخ الرابط <span aria-hidden="true">⧉</span>`;
120
- copy.addEventListener("click", () => copyLink(item.url));
121
-
122
- actions.appendChild(open);
123
- actions.appendChild(copy);
124
-
125
- row.appendChild(left);
126
- row.appendChild(actions);
127
-
128
- frag.appendChild(row);
129
- });
130
-
131
- elResults.appendChild(frag);
132
- }
133
-
134
- // --------- Search ----------
135
- function doSearch() {
136
- const raw = (elQ.value || "").trim();
137
- const q = normalizeArabic(raw);
138
-
139
- if (!q) {
140
- elCount.textContent = "النتائج: 0";
141
- elResults.innerHTML = "";
142
- return;
143
- }
144
-
145
- const tokens = q.split(" ").filter(Boolean);
146
-
147
- const matched = DATA.filter(d => {
148
- const nameNorm = normalizeArabic(d.name);
149
- return tokens.every(t => nameNorm.includes(t));
150
- });
151
-
152
- matched.sort((a, b) => {
153
- const al = (a.name || "").length;
154
- const bl = (b.name || "").length;
155
- if (al !== bl) return al - bl;
156
- return (a.name || "").localeCompare(b.name || "", "ar");
157
- });
158
-
159
- renderResults(matched, raw);
160
- }
161
-
162
- document.getElementById("btnSearch").addEventListener("click", doSearch);
163
- document.getElementById("btnClear").addEventListener("click", () => {
164
- elQ.value = "";
165
- elQ.focus();
166
- elResults.innerHTML = "";
167
- elCount.textContent = "النتائج: 0";
168
- });
169
-
170
- let t = null;
171
- elQ.addEventListener("input", () => {
172
- clearTimeout(t);
173
- t = setTimeout(doSearch, 140);
174
- });
175
-
176
- elQ.addEventListener("keydown", (e) => {
177
- if (e.key === "Enter") doSearch();
178
- });
179
-
180
- // حالة ابتدائية
181
- elCount.textContent = "النتائج: 0";