-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
454 lines (405 loc) · 18 KB
/
index.html
File metadata and controls
454 lines (405 loc) · 18 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RootFinder</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f4f7f6;
color: #333;
margin: 0;
padding: 40px;
display: flex;
flex-direction: column;
align-items: center;
}
.container {
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
max-width: 600px;
width: 100%;
text-align: center;
}
h1 {
color: #2c3e50;
margin-bottom: 5px;
}
h3 {
color: #7f8c8d;
margin-top: 0;
margin-bottom: 25px;
font-weight: 400;
}
input[type="text"] {
width: 80%;
padding: 10px;
font-size: 18px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 15px;
text-align: center;
}
button {
background-color: #3498db;
color: white;
border: none;
padding: 10px 25px;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background-color: #2980b9;
}
.results {
margin-top: 30px;
text-align: left;
direction: ltr;
}
.category {
margin-bottom: 20px;
padding: 15px;
background-color: #f9f9f9;
border-left: 4px solid #3498db;
border-radius: 4px;
}
.category.hebrew {
border-left: 4px solid #27ae60;
background-color: #f0fdf4;
direction: rtl;
text-align: right;
}
.category h4 {
margin-top: 0;
color: #2c3e50;
text-transform: uppercase;
border-bottom: 1px solid #e0e0e0;
padding-bottom: 5px;
}
.links a {
display: inline-block;
margin: 5px;
padding: 5px 10px;
background-color: #e8f4f8;
color: #2980b9;
text-decoration: none;
border-radius: 3px;
font-weight: bold;
font-size: 18px;
transition: background 0.2s;
}
.links a:hover {
background-color: #d1eaf3;
}
.hebrew .links a {
background-color: #d1f2eb;
color: #16a085;
}
.hebrew .links a:hover {
background-color: #a3e4d7;
}
.cad-link a {
background-color: #e8c678;
color: #8c6b14;
font-size: 16px;
}
.cad-link a:hover {
background-color: #d4b25e;
}
.note {
font-size: 13px;
color: #e67e22;
margin-top: 5px;
margin-bottom: 10px;
display: block;
font-weight: 500;
}
#toast {
visibility: hidden;
min-width: 250px;
background-color: #2c3e50;
color: #fff;
text-align: center;
border-radius: 8px;
padding: 16px;
position: fixed;
z-index: 1000;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
font-size: 16px;
box-shadow: 0px 4px 10px rgba(0,0,0,0.2);
opacity: 0;
transition: opacity 0.4s, bottom 0.4s;
}
#toast.show {
visibility: visible;
opacity: 1;
bottom: 50px;
}
</style>
</head>
<body>
<div class="container">
<h1>איפה השורשים שלך?</h1>
<h3>RootFinder</h3>
<input type="text" id="hebrewInput" placeholder="הכנס שורש בעברית..." autocomplete="off">
<br>
<button onclick="processSearch()">חפש</button>
<div class="results" id="resultsContainer" style="display: none;">
<div class="category">
<h4>Arabic</h4>
<div class="links" id="arabicLinks"></div>
</div>
<div class="category">
<h4>Aramaic</h4>
<div class="links" id="aramaicLinks"></div>
</div>
<div class="category">
<h4>Phoenician</h4>
<span class="note">Click a link to COPY it. Once the PDF opens, press Ctrl+F and PASTE to search!</span>
<div class="links" id="phoenicianLinks"></div>
</div>
<div class="category">
<h4>Ugaritic</h4>
<span class="note">Click a link to COPY it. Press Ctrl+F in the PDF and PASTE to search!</span>
<div class="links" id="ugariticLinks"></div>
</div>
<div class="category">
<h4>Akkadian (CAD Dictionary)</h4>
<span class="note">Opens the exact dictionary volume based on your input.</span>
<div class="links cad-link" id="akkadianLinks"></div>
</div>
<div class="category hebrew">
<h4>Hebrew</h4>
<span class="note">Dicta and AlHaTorah open instantly! Sefaria and Ben-Yehuda will COPY the word for you to PASTE.</span>
<div class="links" id="hebrewLinks"></div>
</div>
</div>
</div>
<div id="toast"></div>
<script>
const englishToHebrewMap = {
't': 'א', 'c': 'ב', 'd': 'ג', 's': 'ד', 'v': 'ה', 'u': 'ו', 'z': 'ז',
'j': 'ח', 'y': 'ט', 'h': 'י', 'f': 'כ', 'k': 'ל', 'n': 'מ', 'b': 'נ',
'x': 'ס', 'g': 'ע', 'p': 'פ', 'm': 'צ', 'e': 'ק', 'r': 'ר', 'a': 'ש', ',': 'ת',
'T': 'א', 'C': 'ב', 'D': 'ג', 'S': 'ד', 'V': 'ה', 'U': 'ו', 'Z': 'ז',
'J': 'ח', 'Y': 'ט', 'H': 'י', 'F': 'כ', 'K': 'ל', 'N': 'מ', 'B': 'נ',
'X': 'ס', 'G': 'ע', 'P': 'פ', 'M': 'צ', 'E': 'ק', 'R': 'ר', 'A': 'ש', '<': 'ת'
};
const finalLetterMap = {
'ם': 'מ', 'ן': 'נ', 'ץ': 'צ', 'ף': 'פ', 'ך': 'כ'
};
const maps = {
arabic: {
'א': ['ا'], 'ב': ['ب'], 'ג': ['ج'], 'ד': ['د', '(ذ)'], 'ה': ['ه'],
'ו': ['و'], 'ז': ['ز', 'ذ'],
'ח': ['ح', '(خ)'], 'ט': ['ط', '(ظ)'], 'י': ['ي'],
'כ': ['ك'], 'ל': ['ل'], 'מ': ['م'], 'נ': ['ن'],
'ס': ['ش', '(س)'],
'ע': ['ع', '(غ)'], 'פ': ['ف'], 'צ': ['ص', '(ض)', '(ظ)'], 'ק': ['ق'],
'ר': ['ر'],
'ש': ['س', 'ث', '(ش)'],
'ת': ['ت']
},
aramaic: {
'א': ['א'], 'ב': ['ב'], 'ג': ['ג'], 'ד': ['ד'], 'ה': ['ה'],
'ו': ['ו'], 'ז': ['ז', '(ד)'],
'ח': ['ח'], 'ט': ['ט'], 'י': ['י'],
'כ': ['כ'], 'ל': ['ל'], 'מ': ['מ'], 'נ': ['נ'],
'ס': ['ס', 'שׂ'],
'ע': ['ע'], 'פ': ['פ'], 'צ': ['צ', '(ט)', '(ע)'],
'ק': ['ק'], 'ר': ['ר'],
'ש': ['ש', 'שׂ', 'ת'],
'ת': ['ת']
},
phoenician: {
'א': ['‘', '·', "'"], 'ב': ['b'], 'ג': ['g'], 'ד': ['d'], 'ה': ['h'],
'ו': ['w'], 'ז': ['z'], 'ח': ['H'], 'ט': ['t'], 'י': ['y'],
'כ': ['k'], 'ל': ['l'], 'מ': ['m'], 'נ': ['n'], 'ס': ['s'],
'ע': ['‘', '·', "'"], 'פ': ['p'], 'צ': ['c'], 'ק': ['q'],
'ר': ['r'], 'ש': ['s'], 'ת': ['t']
},
ugaritic: {
'א': ['ả', 'ỉ', 'ủ'], 'ב': ['b'], 'ג': ['g'], 'ד': ['d', '(ḏ)'], 'ה': ['h'],
'ו': ['w'], 'ז': ['z', '(d)'],
'ח': ['ḥ', '(ḫ)'], 'ט': ['ṭ', '(ẓ)'], 'י': ['y'],
'כ': ['k'], 'ל': ['l'], 'מ': ['m'], 'נ': ['n'], 'ס': ['s'],
'ע': ['ʿ', '(ġ)'], 'פ': ['p'], 'צ': ['ṣ', '(ẓ)'], 'ק': ['q'],
'ר': ['r'], 'ש': ['š', '(ṯ)'], 'ת': ['t']
}
};
function fixKeyboard(text) {
let fixedText = '';
for (let char of text) {
fixedText += englishToHebrewMap[char] || char;
}
return fixedText;
}
function cartesianProduct(arr) {
if (arr.length === 0) return [];
return arr.reduce((a, b) => {
let res = [];
for (let x of a) {
for (let y of b) {
res.push({
v: x.v + y.v,
wrap: x.wrap || y.wrap
});
}
}
return res;
}, [{v: '', wrap: false}]);
}
function showToast(message) {
const toast = document.getElementById("toast");
toast.innerHTML = message;
toast.className = "show";
setTimeout(function(){ toast.className = toast.className.replace("show", ""); }, 4000);
}
function copyToClipboard(text, message) {
let textArea = document.createElement("textarea");
textArea.value = text;
textArea.style.position = "fixed";
textArea.style.top = "-9999px";
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
showToast(message);
} catch (err) {
console.error('Fallback copy failed', err);
}
document.body.removeChild(textArea);
}
function generateLinks(word, langMap, linkFormatter) {
let charArrays = [];
for (let char of word) {
let normalizedChar = finalLetterMap[char] || char;
let mappedChars = langMap[normalizedChar] || [normalizedChar];
let parsedChars = mappedChars.map(c => {
if (typeof c === 'string' && c.startsWith('(') && c.endsWith(')')) {
return { v: c.slice(1, -1), wrap: true };
}
return { v: c, wrap: false };
});
charArrays.push(parsedChars);
}
let combinations = cartesianProduct(charArrays);
let htmlOutput = '';
combinations.forEach(combo => {
htmlOutput += linkFormatter(combo.v, combo.wrap);
});
return htmlOutput;
}
function getCADVolumes(word) {
if (!word) return ['cad_a_1'];
let firstChar = finalLetterMap[word.charAt(0)] || word.charAt(0);
let secondChar = word.length > 1 ? (finalLetterMap[word.charAt(1)] || word.charAt(1)) : '';
if (firstChar === 'א') {
if (!secondChar) return ['cad_a_1'];
const hebrewAlphabet = "אבגדהוזחטיכלמנסעפצקרשת";
let index = hebrewAlphabet.indexOf(secondChar);
let memIndex = hebrewAlphabet.indexOf('מ');
if (index === -1 || index < memIndex) {
return ['cad_a_1'];
} else {
return ['cad_a_2'];
}
}
if (firstChar === 'מ') return ['cad_m_1', 'cad_m_2'];
if (firstChar === 'נ') return ['cad_n_1', 'cad_n_2'];
if (firstChar === 'ש') return ['cad_s_shin_1', 'cad_s_shin_2', 'cad_s_shin_3'];
const volumeMap = {
'ב': 'cad_b', 'ג': 'cad_g', 'ד': 'cad_d', 'ה': 'cad_h',
'ו': 'cad_u_w', 'ז': 'cad_z', 'ח': 'cad_h', 'ט': 'cad_tet',
'י': 'cad_i_j', 'כ': 'cad_k', 'ל': 'cad_l', 'ס': 'cad_s',
'ע': 'cad_e', 'פ': 'cad_p', 'צ': 'cad_s_tsade', 'ק': 'cad_q',
'ר': 'cad_r', 'ת': 'cad_t'
};
return [volumeMap[firstChar] || 'cad_a_1'];
}
function processSearch() {
let rawInput = document.getElementById('hebrewInput').value.trim();
if (!rawInput) return;
let input = fixKeyboard(rawInput);
document.getElementById('hebrewInput').value = input;
document.getElementById('resultsContainer').style.display = 'block';
// 1. Arabic
document.getElementById('arabicLinks').innerHTML = generateLinks(input, maps.arabic, (comboValue, isWrapped) => {
let url = `https://www.arabicreference.com/q/${encodeURIComponent(comboValue)}`;
let displayText = isWrapped ? `(${comboValue})` : comboValue;
return `<a href="${url}" target="_blank" rel="noopener noreferrer">${displayText}</a>`;
});
// 2. Aramaic
document.getElementById('aramaicLinks').innerHTML = generateLinks(input, maps.aramaic, (comboValue, isWrapped) => {
let url = `https://cal.huc.edu/browseSKEYheaders.php?tools=on&first3=${encodeURIComponent(comboValue)}`;
let displayText = isWrapped ? `(${comboValue})` : comboValue;
return `<a href="${url}" target="_blank" rel="noopener noreferrer">${displayText}</a>`;
});
// 3. Phoenician (Local PDF)
document.getElementById('phoenicianLinks').innerHTML = generateLinks(input, maps.phoenician, (comboValue, isWrapped) => {
let displayText = isWrapped ? `(${comboValue})` : comboValue;
let url1 = `phoenician.pdf#search=${encodeURIComponent(comboValue)}`;
let msg1 = `<b>הועתק ללוח: ${comboValue}</b><br>Press Ctrl+F (or Cmd+F) in the PDF and Paste!`;
let link1 = `<a href="${url1}" target="_blank" onclick="copyToClipboard('${comboValue}', '${msg1}')">${displayText}</a>`;
let hyphenatedCombo = comboValue.split('').join('-');
let displayHyphenated = isWrapped ? `(${hyphenatedCombo})` : hyphenatedCombo;
let url2 = `phoenician.pdf#search=${encodeURIComponent(hyphenatedCombo)}`;
let msg2 = `<b>הועתק ללוח: ${hyphenatedCombo}</b><br>Press Ctrl+F (or Cmd+F) in the PDF and Paste!`;
let link2 = `<a href="${url2}" target="_blank" onclick="copyToClipboard('${hyphenatedCombo}', '${msg2}')">${displayHyphenated}</a>`;
return link1 + link2;
});
// 4. Ugaritic (Local PDF)
document.getElementById('ugariticLinks').innerHTML = generateLinks(input, maps.ugaritic, (comboValue, isWrapped) => {
let displayText = isWrapped ? `(${comboValue})` : comboValue;
let url = `ugaritic.pdf#search=${encodeURIComponent(comboValue)}`;
let msg = `<b>הועתק ללוח: ${comboValue}</b><br>Press Ctrl+F in the PDF and Paste!`;
return `<a href="${url}" target="_blank" onclick="copyToClipboard('${comboValue}', '${msg}')">${displayText}</a>`;
});
// 5. Akkadian
let cadVolumes = getCADVolumes(input);
let akkadianHtml = '';
cadVolumes.forEach(vol => {
let cadUrl = `https://archive.org/details/Assyrian_cad/${vol}/mode/2up`;
let readableName = vol.replace(/cad_/g, '').toUpperCase().replace(/_/g, ' ');
akkadianHtml += `<a href="${cadUrl}" target="_blank" rel="noopener noreferrer">Vol: ${readableName}</a>`;
});
document.getElementById('akkadianLinks').innerHTML = akkadianHtml;
// 6. Hebrew
let encodedHebrew = encodeURIComponent(input);
let kleinUrl = `https://www.sefaria.org.il/Klein_Dictionary?tab=contents`;
let machberetUrl = `https://www.sefaria.org.il/Machberet_Menachem?tab=contents`;
let shorashimUrl = `https://www.sefaria.org.il/Sefer_HaShorashim?tab=contents`;
let aruchUrl = `https://www.sefaria.org.il/Sefer_HeArukh?tab=contents`;
let dictaUrl = `https://search.dicta.org.il/result?text=${encodedHebrew}&order=tanach+order`;
let alhatorahUrl = `https://library.alhatorah.org/Search?t=${encodedHebrew}`;
let avnionUrl = `https://www.milononline.net/do_search.php?Q=${encodedHebrew}`;
let wikiUrl = `https://he.wiktionary.org/wiki/${encodedHebrew}`;
let benYehudaUrl = `https://benyehuda.org/dict/24412`;
document.getElementById('hebrewLinks').innerHTML = `
<a href="${kleinUrl}" target="_blank" onclick="copyToClipboard('${input}', '<b>הועתק ללוח: ${input}</b><br>Paste it into Sefaria (Klein)!')">קליין</a>
<a href="${machberetUrl}" target="_blank" onclick="copyToClipboard('${input}', '<b>הועתק ללוח: ${input}</b><br>Paste it into Sefaria (Machberet Menachem)!')">מחברת מנחם</a>
<a href="${shorashimUrl}" target="_blank" onclick="copyToClipboard('${input}', '<b>הועתק ללוח: ${input}</b><br>Paste it into Sefaria (Sefer HaShorashim)!')">ספר השרשים</a>
<a href="${aruchUrl}" target="_blank" onclick="copyToClipboard('${input}', '<b>הועתק ללוח: ${input}</b><br>Paste it into Sefaria (Sefer HeArukh)!')">ספר הערוך</a>
<a href="${dictaUrl}" target="_blank" rel="noopener noreferrer">חיפוש בתנך</a>
<a href="${alhatorahUrl}" target="_blank" rel="noopener noreferrer">על התורה</a>
<a href="${avnionUrl}" target="_blank" rel="noopener noreferrer">אבניאון</a>
<a href="${wikiUrl}" target="_blank" rel="noopener noreferrer">ויקימילון</a>
<a href="${benYehudaUrl}" target="_blank" onclick="copyToClipboard('${input}', '<b>הועתק ללוח: ${input}</b><br>Paste it into the Ben-Yehuda search!')">בן־יהודה</a>
`;
}
document.getElementById('hebrewInput').addEventListener('keypress', function (e) {
if (e.key === 'Enter') {
processSearch();
}
});
</script>
</body>
</html>