basic but better search results,
This commit is contained in:
20
main.js
20
main.js
@@ -62,7 +62,7 @@ document.addEventListener("keydown", (e) => {
|
||||
});
|
||||
|
||||
function stripWord(word) {
|
||||
return word.replace(/[^a-zA-Z-]/gu, "");
|
||||
return word.replace(/[^a-zA-Z-]/gu, "").toLowerCase();
|
||||
}
|
||||
|
||||
heonianVowels = {
|
||||
@@ -231,14 +231,26 @@ function doSearch() {
|
||||
meaning.innerHTML += "<br><details><summary>Translation</summary><p>"+json[results[i]][o]["translation"]+"</p></details>";
|
||||
}
|
||||
//example
|
||||
if (json[results[i]][o]["example"] != undefined) {
|
||||
//todo
|
||||
if (json[results[i]][o]["examples"] != undefined) {
|
||||
let temp = ""
|
||||
temp += "<details><summary>Examples</summary><p>";
|
||||
for (let e in json[results[i]][o]["examples"]) {
|
||||
temp += "<span class='heonian'>"+e+"</span> - "+json[results[i]][o]["examples"][e];
|
||||
}
|
||||
temp += "</p></details>";
|
||||
meaning.innerHTML += temp;
|
||||
}
|
||||
//notes
|
||||
if (json[results[i]][o]["notes"] != undefined) {
|
||||
meaning.innerHTML += "<br><p class='result-notes'>"+json[results[i]][o]["notes"]+"</p>";
|
||||
meaning.innerHTML += "<p class='result-notes'>"+json[results[i]][o]["notes"]+"</p>";
|
||||
}
|
||||
//(source, etc)
|
||||
if (json[results[i]][o]["canon-etymology"] != undefined) {
|
||||
meaning.innerHTML += "<details><summary>Canon Etymology</summary><p>"+json[results[i]][o]["canon-etymology"]+"</p></details>";
|
||||
}
|
||||
if (json[results[i]][o]["meta-etymology"] != undefined) {
|
||||
meaning.innerHTML += "<details><summary>Meta Etymology</summary><p>"+json[results[i]][o]["meta-etymology"]+"</p></details>";
|
||||
}
|
||||
//todo
|
||||
result.appendChild(meaning); //y, yeah.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user