diff --git a/main.css b/main.css
index 54a2155..ff8bd6e 100644
--- a/main.css
+++ b/main.css
@@ -239,10 +239,6 @@ main {
color: var(--darkgrey);
}
-.result-translation::before {
- content: " - ";
-}
-
.result summary {
margin-top: 4px;
color: grey;
@@ -254,6 +250,10 @@ main {
font-size: 1.25rem;
}
+.result details.result-meta p {
+ font-size: 1rem;
+}
+
.results-header-count::after {
content: ", ";
}
diff --git a/main.js b/main.js
index 8144f36..5bba123 100644
--- a/main.js
+++ b/main.js
@@ -132,7 +132,7 @@ heonianConsonants = {
"10": "h",
};
-function heonianToRoman(text) {
+function heonianToRoman(text, strict = false) {
let roman = "";
for (let i = 0; i < text.length; i++) {
let h = text.codePointAt(i);
@@ -147,7 +147,7 @@ function heonianToRoman(text) {
roman += heonianConsonants[h[1] + "" + h[2]] + heonianVowels[h[3] - 1];
}
}
- } else {
+ } else if (strict == false) {
roman += text.charAt(i);
}
}
@@ -161,6 +161,15 @@ function processVerb(word) {
//but ... not yet uwu
}
+function generateRuby(word) {
+ letters = word.split("");
+ ruby = "";
+ for (let i = 0; i < letters.length; i++) {
+ ruby += `${letters[i]}`;
+ }
+ return ruby;
+}
+
function loadDictionary() {
fetch("./wordlist.json").then((e) => {
if (e.status === 200) {
@@ -241,9 +250,9 @@ function doSearch() {
result.classList.add("result");
// 1. add word in heo + romanized ruby as header
- let header = document.createElement("ruby");
+ let header = document.createElement("span");
header.classList.add("result-header");
- header.innerHTML = results[i] + " ";
+ header.innerHTML = generateRuby(results[i]);
// 2. add tags [tags like. common word, slang, formal???, type, etc]
// hhh how do i do this part, what tags. would i add. would this be. per word, or per definition?
@@ -261,28 +270,30 @@ function doSearch() {
repeat for all meanings of word,
*/
result.appendChild(header);
+ let last = "";
for (let o = 0; o < json[results[i]].length; o++) {
let meaning = document.createElement("div");
meaning.classList.add("result-meaning");
//ripping off jisho: Bold, word type (*required)
- meaning.innerHTML += ""+json[results[i]][o]["type"]+"";
+ if (last != json[results[i]][o]["type"]) meaning.innerHTML += ""+json[results[i]][o]["type"]+"
";
+ last = json[results[i]][o]["type"];
if (types[json[results[i]][o]["type"]] == undefined) {
types[json[results[i]][o]["type"]] = 1;
} else {
types[json[results[i]][o]["type"]]++;
}
//number, meaning (*required)
- meaning.innerHTML += "
"+(o+1)+""+json[results[i]][o]["meaning"]+"";
+ meaning.innerHTML += ""+(o+1)+""+json[results[i]][o]["meaning"]+"";
//longer translation (below are not required, make sure to check for them)
if (json[results[i]][o]["translation"] != undefined && json[results[i]][o]["translation"].toLowerCase() != json[results[i]][o]["meaning"].toLowerCase()) {
- meaning.innerHTML += ""+json[results[i]][o]["translation"]+"";
+ meaning.innerHTML += "
"+json[results[i]][o]["translation"]+"";
}
//example
if (json[results[i]][o]["examples"] != undefined) {
let temp = ""
temp += "Examples
";
for (let e in json[results[i]][o]["examples"]) {
- temp += ""+e+" - "+json[results[i]][o]["examples"][e]+"
";
+ temp += ""+generateRuby(e)+" - "+json[results[i]][o]["examples"][e]+"
";
}
temp += "
";
meaning.innerHTML += temp;
@@ -293,10 +304,10 @@ function doSearch() {
}
//(source, etc)
if (json[results[i]][o]["canon-etymology"] != undefined) {
- meaning.innerHTML += "Canon Etymology
"+json[results[i]][o]["canon-etymology"]+"
";
+ meaning.innerHTML += "Canon Etymology
"+json[results[i]][o]["canon-etymology"]+"
";
}
if (json[results[i]][o]["meta-etymology"] != undefined) {
- meaning.innerHTML += "Meta Etymology
"+json[results[i]][o]["meta-etymology"]+"
";
+ meaning.innerHTML += "Meta Etymology
"+json[results[i]][o]["meta-etymology"]+"
";
}
//todo
result.appendChild(meaning); //y, yeah.