From a11816e5ec39a887e9e182e6eb3a9a5fbfba019d Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih Date: Fri, 2 Feb 2024 10:39:09 +0900 Subject: [PATCH] =?UTF-8?q?enhance(ServerFinder):=20=E5=A4=A7=E6=96=87?= =?UTF-8?q?=E5=AD=97=E5=B0=8F=E6=96=87=E5=AD=97=E3=83=BB=E5=8D=8A=E8=A7=92?= =?UTF-8?q?=E3=82=AB=E3=83=8A=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=9E=E3=83=A9?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=82=92=E8=BF=BD=E5=8A=A0=20Fix=20#116?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/misc/index.ts | 34 +++++++++++++++++++++++++++++++++- components/servers/Finder.vue | 18 ++++++++++++++---- pages/servers/index.vue | 2 +- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/assets/js/misc/index.ts b/assets/js/misc/index.ts index bc2dce00..25fd517a 100644 --- a/assets/js/misc/index.ts +++ b/assets/js/misc/index.ts @@ -108,4 +108,36 @@ export function copyText(val: string) { document.body.removeChild(tmp); return result; -} \ No newline at end of file +} + +/** + * Converts half-width Katakana characters to full-width Katakana characters. + * @param str - The string to convert. + * @returns The converted string with full-width Katakana characters. + */ +export function kanaHalfToFull(str: string): string { + const kanaMap: Record = { + 'ガ': 'ガ', 'ギ': 'ギ', 'グ': 'グ', 'ゲ': 'ゲ', 'ゴ': 'ゴ', + 'ザ': 'ザ', 'ジ': 'ジ', 'ズ': 'ズ', 'ゼ': 'ゼ', 'ゾ': 'ゾ', + 'ダ': 'ダ', 'ヂ': 'ヂ', 'ヅ': 'ヅ', 'デ': 'デ', 'ド': 'ド', + 'バ': 'バ', 'ビ': 'ビ', 'ブ': 'ブ', 'ベ': 'ベ', 'ボ': 'ボ', + 'パ': 'パ', 'ピ': 'ピ', 'プ': 'プ', 'ペ': 'ペ', 'ポ': 'ポ', + 'ヴ': 'ヴ', 'ヷ': 'ヷ', 'ヺ': 'ヺ', + 'ア': 'ア', 'イ': 'イ', 'ウ': 'ウ', 'エ': 'エ', 'オ': 'オ', + 'カ': 'カ', 'キ': 'キ', 'ク': 'ク', 'ケ': 'ケ', 'コ': 'コ', + 'サ': 'サ', 'シ': 'シ', 'ス': 'ス', 'セ': 'セ', 'ソ': 'ソ', + 'タ': 'タ', 'チ': 'チ', 'ツ': 'ツ', 'テ': 'テ', 'ト': 'ト', + 'ナ': 'ナ', 'ニ': 'ニ', 'ヌ': 'ヌ', 'ネ': 'ネ', 'ノ': 'ノ', + 'ハ': 'ハ', 'ヒ': 'ヒ', 'フ': 'フ', 'ヘ': 'ヘ', 'ホ': 'ホ', + 'マ': 'マ', 'ミ': 'ミ', 'ム': 'ム', 'メ': 'メ', 'モ': 'モ', + 'ヤ': 'ヤ', 'ユ': 'ユ', 'ヨ': 'ヨ', + 'ラ': 'ラ', 'リ': 'リ', 'ル': 'ル', 'レ': 'レ', 'ロ': 'ロ', + 'ワ': 'ワ', 'ヲ': 'ヲ', 'ン': 'ン', + 'ァ': 'ァ', 'ィ': 'ィ', 'ゥ': 'ゥ', 'ェ': 'ェ', 'ォ': 'ォ', + 'ッ': 'ッ', 'ャ': 'ャ', 'ュ': 'ュ', 'ョ': 'ョ', + '。': '。', '、': '、', 'ー': 'ー', '「': '「', '」': '」', '・': '・' + }; + + var reg = new RegExp('(' + Object.keys(kanaMap).join('|') + ')', 'g'); + return str.replace(reg, (m) => kanaMap[m]).replace(/゙/g, '゛').replace(/゚/g, '゜'); +}; diff --git a/components/servers/Finder.vue b/components/servers/Finder.vue index 2f44c413..77e04c7d 100644 --- a/components/servers/Finder.vue +++ b/components/servers/Finder.vue @@ -18,7 +18,7 @@ -
+
@@ -129,7 +129,7 @@