Skip to content

Commit

Permalink
formatting, tosmabru
Browse files Browse the repository at this point in the history
  • Loading branch information
mi2ebi committed Oct 10, 2023
1 parent 2064ba4 commit 29cb31a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
18 changes: 12 additions & 6 deletions construct.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ function mkelem(tag, props, children) {
function tohtml(json) {
const entry = mkelem("div", {"className": "entry"}, [
mkelem("p", null, [
mkelem("b", null, [json.word]),
" ",
json.selmaho ? mkelem("code", {"className": "selmaho"}, [json.selmaho]) : null,
mkelem("a", {
"href": "?q=" + json.word,
"target": rhyme || regex ? "_blank" : "_self"
}, [
mkelem("b", null, [json.word])
]),
" ",
json.rafsi ? mkelem("code", null, [
"[", ...json.rafsi.map(i => "-" + i), "-]"
json.rafsi ? mkelem("i", {"className": "rafsi"}, [
...json.rafsi.map(i => "-" + i), "-"
]) : null,
" • ",
json.selmaho ? mkelem("code", {"className": "selmaho"}, [json.selmaho]) : null,
" ",
mkelem("a", {
"href": "https://jbovlaste.lojban.org/dict/" + json.word.replace(/ /g, "%20"),
"target": "_blank"
}, [
json.score < -1 ? mkelem("b", {"className": "warn"}, [json.score]) :
json.score >= 1000 ? "official" : null,
json.score >= 1000 ? "official" :
json.score == -1 ? json.score : "+" + json.score,
" ↗"
])
]),
Expand Down
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
</head>
<body>
<h1>la xlasisku</h1>
<p>last data update 2023‑09‑29</p>
<p><a href="https://github.com/berrymot/xlasisku">github repo</a></p>
<p>last data update 2023‑09‑29 &bull; <a href="https://github.com/berrymot/xlasisku">github repo</a></p>
<p>
<b>mode</b>
<span class="nobr opt">
Expand Down
25 changes: 17 additions & 8 deletions search.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,26 @@ function search(query, jvo = true) {
mkelem("b", null, "tanru: "),
mkelem("i", null, parts)
]));
const [best, _] = getLujvo(parts);
if (query != best) {
id("lujvo").append(mkelem("p", null, [
mkelem("b", null, "best: "),
mkelem("i", null, best)
]));
}
}
}
} catch (e) {
id("lujvo").innerHTML = "";
switch (e.message.charAt(0)) {
case "m": // tosmabru
const correct = e.message.split("{")[2].slice(0, -1);
id("lujvo").append(mkelem("p", null, [
"do you mean ",
mkelem("a", {
"href": "?q=" + correct
}, [mkelem("i", null, [
correct
])]),
"?"
]));
break;
default:
id("lujvo").innerHTML = "";
break;
}
}
// exact matches
for (const entry of jbo) {
Expand Down
8 changes: 8 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ body.regex #search {
border-radius: 16px;
color: var(--bodyfg);
}
.entry a:first-child {
color: var(--bodyfg);
}
.entry .selmaho {
font-family: var(--mono);
}
.entry :is(.selmaho, .rafsi) {
color: var(--notesfg);
}
.entry details {
Expand Down Expand Up @@ -156,6 +161,9 @@ a {
color: var(--link);
text-decoration: none;
}
:is(a, button, summary):hover {
text-decoration: underline;
}
.opt {
color: var(--bodyfg);
border: 1px solid var(--bodyfg);
Expand Down

0 comments on commit 29cb31a

Please sign in to comment.