-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.html
More file actions
259 lines (240 loc) · 8.06 KB
/
Copy pathsearch.html
File metadata and controls
259 lines (240 loc) · 8.06 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!DOCTYPE html>
<html lang="en">
<head>
<title>Search | lexicring</title>
<meta charset="UTF-8" />
<link
rel="stylesheet"
as="style"
crossorigin
href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Inter"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Gentium+Book+Plus"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Chocolate+Classical+Sans"
/>
<link rel="stylesheet" href="style.css">
<style>
.suggestions-container {
display: flex;
height: 300px;
overflow-y: auto;
border: 1px solid #ccc;
border-radius: 4px;
margin-top: 5px;
justify-content: center;
background-color: #f9f9f9;
}
.suggestion-column {
flex: 1;
min-width: 0;
max-width: 50%;
display: flex;
flex-direction: column;
align-items: center;
}
.suggestion-column:first-child {
border-right: 1px solid #ccc;
}
.suggestion-item {
padding: 8px 12px;
cursor: pointer;
width: 100%;
box-sizing: border-box;
text-align: center;
}
.suggestion-item:hover {
background-color: #f0f0f0;
}
.prefix {
font-weight: bold;
color: #666;
}
.empty-message {
padding: 8px 12px;
color: #999;
text-align: center;
width: 100%;
}
</style>
</head>
<body>
<header>
<div class="header">
<a href="https://fishlandicfishy.github.io/lexicring/" class="logo"><b>lexicring</b></a>
<a href="https://fishlandicfishy.github.io/lexicring/search.html" class="link">Search</a>
</div>
</header>
<div class="left-sidebar">
<!-- Placeholder left sidebar content -->
</div>
<div class="content">
<div align="center">
<p>
<input id="link" onkeyup="showSuggestions()">
<button onclick="search()">Search</button>
</p>
<div id="suggestions" class="suggestions-container">
<!-- Initial empty state will be populated by JavaScript -->
</div>
</div>
<h2>Hardly Searchable Articles</h2>
<h3>Non-ASCII</h3>
<a href="dict/æùgh.html">Dict:æùgh</a><br>
<a href="dict/æügh.html">Dict:æügh</a><br>
<h3>CJKVZ+</h3>
<a href="wiki/十邱.html">Wiki:<img src="wiki/十邱.svg" alt="十邱" style="filter: invert(1);"></a><br>
<a href="dict/嗯咁醒.html">Dict:嗯咁醒</a><br>
<a href="dict/爆炸糖.html">Dict:爆炸糖</a><br>
<a href="dict/花式落樓梯.html">Dict:花式落樓梯</a><br>
<a href="dict/偽人.html">Dict:偽人</a><br>
<a href="dict/病龍.html">Dict:病龍</a><br>
<a href="dict/張文來.html">Dict:張文來</a><br>
<a href="dict/高佩婷.html">Dict:高佩婷</a><br>
<h3>Hairy Pottah 🐙lang</h3>
<a href="dict/ч.html">Dict:ч</a><br>
<a href="dict/Ⴞ.html">Dict:Ⴞ</a><br>
<a href="dict/の.html">Dict:の</a><br>
<h3>Other</h3>
<a href="dict/🐬.html">Dict:🐬</a><br>
<a href="dict/🚡.html">Dict:🚡</a><br>
<a href="dict/🧴🪑.html">Dict:🧴🪑</a><br>
<a href="dict/💢⭕️💢.html">Dict:💢⭕️💢</a><br>
</div>
<div class="right-sidebar">
<div class="settings-option">
<div class="settings-title">Text</div>
<div class="settings-item" onclick="setTextSize('small')">Small</div>
<div class="settings-item selected" onclick="setTextSize('standard')">Standard</div>
<div class="settings-item" onclick="setTextSize('large')">Large</div>
</div>
<div class="settings-option">
<div class="settings-title">Color</div>
<div class="settings-item" onclick="setColorMode('light')">Light</div>
<div class="settings-item selected" onclick="setColorMode('dark')">Dark</div>
</div>
</div>
<div class="footer">
<hr>
<p>
<i>
Content and website are in the public domain. Please refer to the
<a href="https://github.com/FishlandicFishy/lexicring">GitHub repository</a>.
</i>
</p>
</div>
<script src="script.js"></script>
<script>
const repo = 'FishlandicFishy/lexicring';
// Initialize suggestions box on page load
document.addEventListener('DOMContentLoaded', function() {
initializeSuggestions();
});
async function fetchArticles(directory) {
try {
const response = await fetch(`https://api.github.com/repos/${repo}/contents/${directory}`);
const data = await response.json();
return data.filter(item => item.type === 'file' && item.name.endsWith('.md')).map(item => ({
name: item.name.replace('.md', ''),
source: directory
}));
} catch (error) {
console.error(`Error fetching ${directory}:`, error);
return [];
}
}
function initializeSuggestions() {
const suggestions = document.getElementById('suggestions');
suggestions.innerHTML = `
<div class="suggestion-column">
<div class="empty-message">Dict suggestions will appear here</div>
</div>
<div class="suggestion-column">
<div class="empty-message">Wiki suggestions will appear here</div>
</div>
`;
}
async function showSuggestions() {
const input = document.getElementById('link').value.toLowerCase();
const suggestions = document.getElementById('suggestions');
if (!input) {
initializeSuggestions();
return;
}
const [dictArticles, wikiArticles] = await Promise.all([
fetchArticles('dict'),
fetchArticles('wiki')
]);
const filteredDict = dictArticles.filter(item =>
item.name.toLowerCase().includes(input)
);
const filteredWiki = wikiArticles.filter(item =>
item.name.toLowerCase().includes(input)
);
// Clear and rebuild the suggestions container
suggestions.innerHTML = '';
// Create Dict column
const dictColumn = document.createElement('div');
dictColumn.className = 'suggestion-column';
if (filteredDict.length > 0) {
filteredDict.forEach(item => {
dictColumn.appendChild(createSuggestionItem(item));
});
} else {
dictColumn.appendChild(createEmptyMessage('No matching Dict articles'));
}
suggestions.appendChild(dictColumn);
// Create Wiki column
const wikiColumn = document.createElement('div');
wikiColumn.className = 'suggestion-column';
if (filteredWiki.length > 0) {
filteredWiki.forEach(item => {
wikiColumn.appendChild(createSuggestionItem(item));
});
} else {
wikiColumn.appendChild(createEmptyMessage('No matching Wiki articles'));
}
suggestions.appendChild(wikiColumn);
}
function createSuggestionItem(item) {
const div = document.createElement('div');
div.classList.add('suggestion-item');
const prefix = document.createElement('span');
prefix.classList.add('prefix');
prefix.textContent = item.source === 'dict' ? 'Dict: ' : 'Wiki: ';
const text = document.createElement('span');
text.classList.add('item-name');
text.textContent = item.name;
div.appendChild(prefix);
div.appendChild(text);
div.onclick = () => {
document.getElementById('link').value = item.name;
document.getElementById('suggestions').innerHTML = '';
search(item.source);
};
return div;
}
function createEmptyMessage(text) {
const div = document.createElement('div');
div.className = 'empty-message';
div.textContent = text;
return div;
}
function search(source = 'dict') {
var baseUrl = "https://" + window.location.hostname + `/lexicring/${source}/`;
var inputText = document.getElementById("link").value.toLowerCase();
var formattedInput = inputText.split(" ").join("-") + ".html";
var url = baseUrl + formattedInput;
window.location = url;
}
</script>
</body>
</html>