-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdictionary.html
251 lines (228 loc) · 7.66 KB
/
dictionary.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tiripode - Dictionary</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
<style>
.form-control-dark {
border-color: var(--bs-gray);
}
.form-control-dark:focus {
border-color: #fff;
box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .25);
}
.text-small {
font-size: 85%;
}
.dropdown-toggle:not(:focus) {
outline: 0;
}
</style>
<script>
// Set theme to the user's preferred color scheme
function updateTheme() {
const colorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ?
"dark" :
"light";
document.querySelector("html").setAttribute("data-bs-theme", colorMode);
}
function lookup() {
let resultsArea = document.getElementById("resultsArea");
let loadingSpinner = document.getElementById("loadingSpinner");
const definition = document.getElementById("definition");
const errorBox = document.getElementById("errorBox");
const readyText = document.getElementById("readyText");
// clear div for new forms
definition.replaceChildren();
// show results area and spinner while results are being fetched
resultsArea.style.display = "";
loadingSpinner.style.display = "";
loadingSpinner.classList.add("d-flex");
errorBox.style.display = "none";
readyText.style.display = "none";
let word = document.getElementById("wordBox").value
if (word === "") {
word = "please help am not good with computer"
// errorBox.style.display = "";
// errorBox.textContent = "Please why did you put that in the box smh";
}
word = word.trim().replace(/\s+/g, " ").replaceAll(" ", "-").toLowerCase();
try {
fetch("https://tech189.dev/tiripode/api.php?mode=lookup&word=" + word)
.then(response => response.json())
.then(data => {
if ("error" in data) {
errorBox.style.display = "";
errorBox.textContent = data["error"];
}
else {
document.getElementById("definition").innerText = data["definition"];
}
})
.finally(() => {
// hide spinner after results fetched
loadingSpinner.style.display = "none";
loadingSpinner.classList.remove("d-flex");
});
}
catch {
// hide spinner if error found
loadingSpinner.style.display = "none";
loadingSpinner.classList.remove("d-flex");
}
}
// Set theme on load
updateTheme()
// Update theme when the preferred scheme changes
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', updateTheme)
fetch("https://tech189.dev/tiripode/api.php?mode=size")
.then(response => response.json())
.then(data => {
document.getElementById("readyText").innerText = "Ready to look up from a database of " + data["lexicon_size"] + " words";
});
document.addEventListener("DOMContentLoaded", e => {
const form = document.getElementById("wordForm");
form.addEventListener("submit", (event) => {
event.preventDefault();
lookup();
});
});
</script>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
</svg>
<div class="container">
<header class="d-flex flex-wrap justify-content-center py-3 mb-4 border-bottom">
<a href="./"
class="d-flex align-items-center mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
<svg class="bi me-2" width="40" height="32">
<use xlink:href="#bootstrap"></use>
</svg>
<span class="fs-4">Tiripode</span>
</a>
<ul class="nav nav-pills">
<li class="nav-item"><a href="./" class="nav-link">Parse</a></li>
<li class="nav-item"><a href="./dictionary.html" class="nav-link active" aria-current="page">Dictionary</a></li>
<li class="nav-item"><a href="./tables.html" class="nav-link">Tables</a></li>
<li class="nav-item"><a href="./gloss.html" class="nav-link">Gloss</a></li>
<li class="nav-item"><a href="./about.html" class="nav-link">About</a></li>
</ul>
</header>
</div>
<br />
<div class="justify-content-center mb-5 row">
<div class="col-lg-9">
<h4>Please enter a Mycenaean Greek word* to look it up:</h4>
<p>*any headword</p>
</div>
</div>
<div class="justify-content-center mb-5 row">
<div class="col-lg-6">
<form class="" id="wordForm">
<div class="input-group"><input placeholder="e.g. ti-ri-po or 𐀴𐀪𐀡" spellcheck="false" type="text"
class="form-control form-control-lg" value="" id="wordBox"><button
class="btn btn-primary d-inline-flex align-items-center" type="button" onclick="lookup()">
Look up!
</button>
</div>
<br />
<!-- <div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked>
<label class="form-check-label" for="flexCheckChecked">
Unconfirmed parsing
</label>
</div> -->
</form>
<br />
<p id="readyText">Checking API...</p>
</div>
</div>
<div id="resultsArea" class="justify-content-center mb-5 row" style="display: none;">
<div class="col-lg-9">
<h4>Definition:</h4>
<br />
<div id="loadingSpinner" class="d-flex justify-content-center">
<div class="spinner-border m-5" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<div id="errorBox" class="alert alert-danger" role="alert" style="display: none;">
Error!
</div>
<div id="definition">
</div>
<!-- <br />
<div class="card">
<div class="card-header">
Word 1 - ti-ri-po-de
</div>
<div class="card-body">
<h5 class="card-title">Definition</h5>
<p class="card-text">Wiktionary: tripod Chadwick & Ventris 1973: tripod cf. τρίπους Chadwick & Ventris 1973: nominative dual of ti-ri-po Woodard 1997: The tri cluster is represented by ti-ri because the ti takes on the vowel of ri via the progressive spelling strategy. Chadwick John and Michael Ventris 1973 Documents in Mycenaean Greek Woodard Roger D. 1997 Greek Writing from Knossos to Homer: A Linguistic Interpretation of the Greek Alphabet and the Continuity of Ancient Greek Literacy</p>
<h5 class="card-title">Possible forms</h5>
<table class="table" id="resultTable">
<thead>
<tr>
<th scope="col">Declension</th>
<th scope="col">Case</th>
<th scope="col">Gender</th>
<th scope="col">Number</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2">2nd</td>
<td>allative</td>
<td>masculine</td>
<td>singular</td>
</tr>
<tr>
<td>allative</td>
<td>masculine</td>
<td>plural</td>
</tr>
<tr>
<td rowspan="5">3rd</td>
<td>locative</td>
<td>masculine/feminine</td>
<td>singular</td>
</tr>
<tr>
<td>instrumental</td>
<td>masculine/feminine</td>
<td>singular</td>
</tr>
<tr>
<td>nominative</td>
<td>masculine/feminine</td>
<td>dual</td>
</tr>
<tr>
<td>accusative</td>
<td>masculine/feminine</td>
<td>dual</td>
</tr>
<tr>
<td>nominative</td>
<td>masculine/feminine</td>
<td>plural</td>
</tr>
</tbody>
</table>
</div>
</div>
-->
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-Rx+T1VzGupg4BHQYs2gCW9It+akI2MM/mndMCy36UVfodzcJcF0GGLxZIzObiEfa"
crossorigin="anonymous"></script>
</body>
</html>