summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-11-13 13:51:47 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2019-11-13 13:51:47 +0200
commit29c38b06b2fd700e7dbf49013ad91d473e65e812 (patch)
treeb5ea521394528d1f9ef9b94f80064a428f6ede18 /ext/mixed/js
parentdb4a30336595eca94e976b6279c1e8c79df85906 (diff)
only paste Japanese text from clipboard
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/japanese.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/mixed/js/japanese.js b/ext/mixed/js/japanese.js
index 9f401da7..d24f56a6 100644
--- a/ext/mixed/js/japanese.js
+++ b/ext/mixed/js/japanese.js
@@ -26,6 +26,15 @@ function jpIsKana(c) {
return wanakana.isKana(c);
}
+function jpIsJapaneseText(text) {
+ for (const c of text) {
+ if (jpIsKanji(c) || jpIsKana(c)) {
+ return true;
+ }
+ }
+ return false;
+}
+
function jpKatakanaToHiragana(text) {
let result = '';
for (const c of text) {