mirror of
https://github.com/patarapolw/cjdic2.git
synced 2026-11-08 17:35:18 +00:00
full text search and UI button
This commit is contained in:
1 parent
afacdc0856
commit
f0cafa450d
10 files changed
+189
-65
No files matched your search
@@ -7,6 +7,13 @@ import { listen } from "@tauri-apps/api/event";
|
||||
import { supabase } from "../lib/supabaseClient";
|
||||
|
||||
interface YomitanDictEntry {
|
||||
title: string;
|
||||
bundle_name: string;
|
||||
revision: string;
|
||||
lang: string;
|
||||
}
|
||||
|
||||
interface YomitanDownloadDictEntry {
|
||||
url: string;
|
||||
filepath: string;
|
||||
}
|
||||
@@ -66,13 +73,17 @@ function LoadingDialog() {
|
||||
}
|
||||
});
|
||||
async function downloadAssets(lang = "ja") {
|
||||
const dicts: YomitanDictEntry[] = [];
|
||||
const existing_dicts =
|
||||
await invoke<YomitanDictEntry[]>("list_yomitan_dict");
|
||||
|
||||
const dicts: YomitanDownloadDictEntry[] = [];
|
||||
|
||||
if (lang === "ja") {
|
||||
{
|
||||
const filename = "Pixiv.zip";
|
||||
const filepath = `yomitan/${lang}/${filename}`;
|
||||
|
||||
const filename = "Pixiv.zip";
|
||||
const filepath = `yomitan/${lang}/${filename}`;
|
||||
const existing = existing_dicts.find((d) => d.bundle_name === filename);
|
||||
if (!existing) {
|
||||
// Maybe check revision update
|
||||
dicts.push({
|
||||
filepath,
|
||||
url:
|
||||
@@ -84,6 +95,11 @@ function LoadingDialog() {
|
||||
return "";
|
||||
})) || "",
|
||||
});
|
||||
} else {
|
||||
dicts.push({
|
||||
filepath,
|
||||
url: "",
|
||||
});
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -115,6 +115,9 @@ function SearchPage() {
|
||||
if (isAutoKana) {
|
||||
norm_q = norm_q.replace(/n$/i, "ん").replace(/[a-z]$/i, "");
|
||||
}
|
||||
|
||||
norm_q = norm_q.replace(/*/g, "*").replace(/?/g, "?").replace(/^〜/, "~");
|
||||
|
||||
if (!norm_q) return;
|
||||
|
||||
const ender =
|
||||
@@ -391,6 +394,9 @@ function SearchPage() {
|
||||
{")"}
|
||||
</>
|
||||
) : null}
|
||||
<button onClick={() => onTermClicked("~" + term)}>
|
||||
🔗
|
||||
</button>
|
||||
<span>【{dict_title}】</span>
|
||||
<span>{JSONdumpClean(it)}</span>
|
||||
</Card.Header>
|
||||
|
||||
Reference in new issue
Block a user