stat2025 commited on
Commit
e80d8a0
·
verified ·
1 Parent(s): 034bc62

Delete script.js

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